/* Apply Apple's San Francisco font to the entire page */
* {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
}

body {
    opacity: 1;
    transition: opacity 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
}

/* Only apply max-width in desktop view */
@media (min-width: 768px) {
    .desktop-width {
        max-width: 28rem !important; /* matches max-w-md */
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

.divider {
    height: 1px;
    background-color: #d1d5db; /* Tailwind's gray-300 */
    margin-top: 0.5cm;
    margin-bottom: 0.5cm;
}

.category-divider {
    height: 2px;
    background-color: #4a5568; /* Tailwind's gray-700 */
    margin-top: 1cm;
    margin-bottom: 1cm;
}

.service-category > .service-card:not(:last-child) + .divider {
    display: block;
}

.service-category > .service-card:last-child + .divider {
    display: none;
}

/* Updated header with centered title */
.header {
    position: fixed;
    top: 0;
    width: 100%;
    height: 2cm;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center; /* Center the content */
    padding: 0 1rem;
    z-index: 1000;
    border-bottom: 1px solid #e5e7eb;
}

/* Centered header title */
.header-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    text-align: center;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
}

/* Back button positioned absolutely to stay on the left */
.back-button {
    position: absolute;
    left: 1rem;
    width: 40px;
    height: 40px;
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #374151;
}

/* Apply margin-left only on screens wider than 768px for desktop positioning */
@media (min-width: 768px) {
    .back-button {
        left: 5.5cm;
    }
}

.back-button:hover {
    background-color: #f9fafb;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.back-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.content-container {
    display: flex;
    margin-top: 3cm; /* Header height + 1cm */
}

/* Service Grid Container */
.service-grid-container {
    position: fixed;
    top: 3.7cm;
    left: 6cm; /* Moves it 5cm to the left */
    transition: top 0.3s ease-in-out;
}

/* Service Grid */
.service-grid {
    width: 9cm;
    padding: 1rem;
    border-radius: 0.5rem;
}

/* Service Box */
.service-box {
    padding: 0;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: box-shadow 0.3s ease-in-out;
}

/* Service Container */
.service-container {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    width: 14cm;
}

/* Service Card */
.service-card {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    background-color: #ffffff;
}

.cart-container {
    position: fixed;
    top: 3.7cm;
    right: 6cm;
    z-index: 1000;
}

/* 🔹 Keep item name fixed-width to avoid shifting */
.cart-item-name {
    width: 120px; /* Adjust width as needed */
    display: -webkit-box;
    -webkit-line-clamp: 2;  /* Allow max 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word; /* Ensure long words break */
}

#cartItemsContainer > div {
    margin-bottom: 0.30cm; /* Adds 0.30 cm spacing between cart items */
}

.quantity-controls {
    display: flex;
    align-items: center;
    background: #F4F3FF;
    border: 1px solid #D3BFFD;
    border-radius: 6px;  /* Reduced from round to slightly square */
    padding: 2px 4px; /* Reduced padding to match button size */
    min-width: 50px; /* Match the add button width */
    justify-content: space-between;
}

/* 🔹 Lock price width */
.cart-price {
    font-size: 14px;
    font-weight: bold;
    min-width: 70px;
    text-align: right;
}

/* Loading spinner */
.loading-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: #6039DB;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile View Cart Container */
.mobile-cart-container {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: white;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    padding: 12px 16px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

/* Mobile Responsive Styles */
@media (max-width: 639px) {
    /* Hide desktop cart container on mobile */
    .cart-container {
        display: none;
    }
    
    /* Show mobile cart container when items are in cart */
    .mobile-cart-container {
        display: flex;
    }
    
    /* Mobile header adjustments */
    .header {
        height: 1.5cm;
        padding: 0 0.5rem;
    }
    
    /* Mobile back button positioning */
    .back-button {
        width: 36px;
        height: 36px;
        left: 0.5rem;
    }
    
    /* Mobile header title */
    .header-title {
        font-size: 1.1rem;
    }
    
    /* Hide "Select a service" heading on mobile */
    .service-grid h2 {
        display: none !important;
    }
    
    /* SLIGHTLY LARGER MOBILE GRID - Increased spacing and padding */
    .mobile-grid-4 {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.65rem !important; /* Increased from 0.5rem */
        padding: 0.5rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* SLIGHTLY LARGER SERVICE CATEGORY CARDS - Increased dimensions */
    .mobile-grid-4 > div {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: 100% !important;
        height: 100px !important; /* Increased from 85px */
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* SLIGHTLY LARGER SERVICE BOX - Increased image area */
    .mobile-grid-4 .service-box {
        width: 100% !important;
        height: 68px !important; /* Increased from 55px */
        aspect-ratio: 1 / 1 !important;
        max-width: 68px !important; /* Increased from 55px */
        border-radius: 0.6rem !important; /* Slightly larger radius */
        padding: 0 !important;
        margin: 0 !important;
        margin-bottom: 0.35rem !important; /* Increased from 0.25rem */
        display: block !important;
        border: 1px solid #e5e7eb !important;
        overflow: hidden !important;
        position: relative !important;
        background-color: #f8f9fa !important;
        flex-shrink: 0 !important;
    }
    
    /* SLIGHTLY LARGER IMAGE FILL - Covers entire service box */
    .mobile-grid-4 .service-box img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        border-radius: 0.6rem !important; /* Match container */
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
    }
    
    /* SLIGHTLY LARGER TEXT CONTAINER - Increased text area */
    .mobile-grid-4 span {
        width: 100% !important;
        height: 30px !important; /* Increased from 26px */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        margin: 0 !important;
        padding: 0.1rem !important; /* Increased from 0.15rem */
        box-sizing: border-box !important;
        overflow: hidden !important;
        position: relative !important;
        flex-shrink: 0 !important;
    }
    
    /* SLIGHTLY LARGER TEXT STYLING - More readable text */
    .mobile-grid-4 span,
    .mobile-grid-4 .service-box + span {
        font-size: 0.6rem !important; /* Increased from 0.55rem */
        line-height: 1.5 !important; /* Slightly more relaxed */
        font-weight: 600 !important;
        color: #374151 !important;
        word-wrap: break-word !important;
        hyphens: auto !important;
        display: block !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: unset !important;
        max-height: none !important;
            }
    
    /* Remove any text overlays or gradients that might interfere */
    .mobile-grid-4 .service-box .text-content,
    .mobile-grid-4 .service-box p,
    .mobile-grid-4 .service-box div:not(:has(img)) {
        display: none !important; /* Hide any conflicting text elements */
    }
    
    /* Ensure no text appears inside the image container */
    .mobile-grid-4 .service-box * {
        position: static !important;
        background: none !important;
        z-index: auto !important;
    }
    
    /* Override any existing text styling within service box */
    .mobile-grid-4 .service-box span,
    .mobile-grid-4 .service-box p,
    .mobile-grid-4 .service-box div {
        display: none !important; /* Ensure no text appears over images */
    }
    
    /* Reposition content container for mobile */
    .content-container {
        flex-direction: column;
        margin-top: 2.5cm;
        padding: 0; /* Remove horizontal padding */
        padding-bottom: 60px; /* Add padding at bottom for mobile cart container */
    }
    
    /* Reposition service grid container */
    .service-grid-container {
        position: relative;
        top: 0;
        left: 0;
        margin-bottom: 0.5rem;
        width: 100%;
    }
    
    /* Make service grid full width and remove border radius on left and right */
    .service-grid {
        width: 100%;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 0; /* Remove padding to let grid handle spacing */
        background-color: white !important;
    }
    
    /* Adjust service container for mobile */
    #servicesContainer {
        width: 100% !important;
        margin-top: 0.5rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 0.75rem 0.5rem;
    }
    

    /* Improved service card layout for mobile */
    .service-card > div:first-child {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    /* Make text area take appropriate space */
    .service-card > div:first-child > div:first-child {
        flex: 3;
    }
    
    /* MOBILE: Image container with 5cm fixed width */
    .service-card > div:first-child > div:last-child {
        width: 5cm !important; /* Fixed width 5cm for mobile */
        flex-shrink: 0 !important; /* Prevent shrinking */
        flex-grow: 0 !important; /* Prevent growing */
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-top: 0;
        margin-left: 0.25rem;
    }
    
    /* MOBILE: Service card images with 5cm x 5cm size */
    .service-card img {
        width: 5cm !important; /* Fixed width 5cm for mobile */
        height: 5cm !important; /* Fixed height 5cm for mobile */
        object-fit: cover;
        border-radius: 0.25rem;
        margin-bottom: 0.25rem;
        flex-shrink: 0 !important; /* Prevent image from shrinking */
    }

    /* Increased height for service cards */
    .service-card {
        width: 100%;
        padding: 0.75rem;  /* Increased padding */
        margin-bottom: 0.75rem;  /* Increased margin */
        border-radius: 0.25rem;
        min-height: 2.5cm;  /* Added minimum height - approx 1cm more than before */
    }
    
    /* Larger service card headings */
    .service-card h3 {
        font-size: 1rem !important;  /* Increased from 0.875rem */
        line-height: 1.35;  /* Improved line height */
        margin-bottom: 0.25rem;  /* More space below heading */
    }
    
    /* Larger service card duration text */
    .service-card p {
        font-size: 0.875rem !important;  /* Increased from 0.75rem */
        margin-bottom: 0.25rem !important;  /* More space below paragraph */
    }
    
    /* Larger text in lists */
    .service-card ul {
        padding-left: 1.25rem !important;  /* Slightly more indent */
        margin-bottom: 0.5rem !important;  /* More space below lists */
    }
    
    .service-card li {
        font-size: 0.8rem !important;  /* Increased from 0.7rem */
        line-height: 1.25;  /* Improved line height */
        margin-bottom: 0.2rem;  /* More space between list items */
    }
    
    /* Larger view details text */
    .service-card button.text-blue-600 {
        font-size: 0.8rem !important;  /* Increased from 0.7rem */
        margin-top: 0.2rem;  /* Added space above button */
    }
    
    /* MOBILE: Add button with fixed width - no auto adjustment */
    .service-card button.add-to-cart {
        padding: 0.2rem 0.4rem !important; /* Compact padding */
        font-size: 0.75rem !important; /* Smaller font */
        margin-top: 0.2rem;
        width: 50px !important; /* Fixed width */
        flex-shrink: 0 !important; /* Prevent shrinking */
    }
    
    /* Adjust category titles */
    #servicesContainer h3.text-xl {
        font-size: 1rem !important;
        margin-bottom: 0.5rem;
        padding-left: 0.25rem;
    }
    
    /* Reduce spacing between sections */
    .divider {
        margin-top: 0.25cm;
        margin-bottom: 0.25cm;
    }
    
    .category-divider {
        margin-top: 0.5cm;
        margin-bottom: 0.5cm;
    }

    /* Ensure containers stretch edge to edge */
    body {
        padding: 0 !important;
    }
}

/* DESKTOP: Add button with fixed width */
.service-card button.add-to-cart {
    padding: 0.2rem 0.4rem !important;
    font-size: 0.75rem !important;
    width: 50px !important; /* Fixed width for desktop too */
    flex-shrink: 0 !important;
}

/* DESKTOP: Service card images with larger fixed size */
.service-card img {
    width: 7rem !important; /* Larger for desktop - 112px */
    height: 7rem !important; /* Larger for desktop - 112px */
    object-fit: cover;
    border-radius: 0.25rem;
    margin-bottom: 0.25rem;
    flex-shrink: 0 !important;
}

/* DESKTOP: Image container with larger fixed width */
.service-card > div:first-child > div:last-child {
    width: 7rem !important; /* Larger for desktop */
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 0;
    margin-left: 0.25rem;
}

/* Tablet Styles */
@media (min-width: 640px) and (max-width: 767px) {
    .service-grid-container {
        left: 2cm;
    }
    
    .cart-container {
        right: 2cm;
    }
}
@media (min-width: 1024px) {
    #mobileCartContainer {
        display: none !important;
    }
}


/* Add these styles to your CSS file */
.line-loader {
    width: 50%;
    height: 2px;
    position: absolute;
    bottom: 0;
    left: -50%;
    background-color: #6039DB;
    animation: line-loading 1.5s infinite linear;
  }
  
  @keyframes line-loading {
    0% {
      left: -50%;
    }
    100% {
      left: 100%;
    }
  }
  
  .quantity-controls {
    display: flex;
    align-items: center;
    gap: 4px; /* Reduced gap for tighter layout */
  }
  
  /* FIXED: Quantity control buttons to match Add button size */
  .quantity-controls button {
    width: 20px !important; /* Match proportional size to Add button */
    height: 24px !important; /* Match Add button height */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6039DB;
    font-size: 14px !important; /* Match Add button font size */
    cursor: pointer;
    background: none;
    border: none;
    padding: 0 !important; /* Remove padding for consistent sizing */
    flex-shrink: 0 !important; /* Prevent shrinking */
  }
  
  /* Quantity display styling */
  .quantity-controls span {
    font-size: 0.75rem !important; /* Match Add button font size */
    font-weight: 500;
    color: #6039DB;
    min-width: 16px;
    text-align: center;
  }

  /* Mobile Full Screen Overlay - Controlled Scrolling */
  @media (max-width: 768px) {
      #loginContainer {
          background: #ffffff !important;
          backdrop-filter: none !important;
          -webkit-backdrop-filter: none !important;
          padding: 0 !important;
          margin: 0 !important;
          overflow: hidden !important; /* No scroll by default */
          -webkit-overflow-scrolling: touch !important;
          position: fixed !important;
          top: 0 !important;
          left: 0 !important;
          right: 0 !important;
          bottom: 0 !important;
      }
      
      #loginContainer .login-container {
          width: 100vw !important;
          height: 100vh !important;
          max-width: none !important;
          border-radius: 0 !important;
          margin: 0 !important;
          padding: 0 !important;
          display: flex !important;
          align-items: center !important;
          justify-content: center !important;
          box-shadow: none !important;
          overflow: hidden !important; /* No scroll by default */
      }
      
      #loginContainer .login-form {
          width: 100vw !important;
          height: 100vh !important;
          display: flex !important;
          flex-direction: column !important;
          justify-content: center !important;
          padding: 3rem 1.5rem 2rem 1.5rem !important;
          box-sizing: border-box !important;
          position: relative !important;
          margin: 0 !important;
          overflow: hidden !important; /* No scroll by default */
      }
      
      /* Enable scrolling ONLY when input is focused */
      #loginContainer:has(input:focus) {
          overflow-y: auto !important;
          -webkit-overflow-scrolling: touch !important;
      }
      
      #loginContainer:has(input:focus) .login-container {
          height: auto !important;
          min-height: 100vh !important;
          align-items: flex-start !important;
          overflow-y: auto !important;
      }
      
      #loginContainer:has(input:focus) .login-form {
          min-height: 100vh !important;
          overflow-y: auto !important;
      }
      
      /* Move close button down */
      #loginContainer .close-btn {
          position: absolute !important;
          right: 1.5rem !important;
          top: 1.5cm !important;
          margin-top: 1.5cm !important;  /* optional */
          font-size: 28px !important;
          z-index: 10 !important;
          background: rgba(0, 0, 0, 0.1) !important;
          border-radius: 50% !important;
          width: 40px !important;
          height: 40px !important;
          display: flex !important;
          align-items: center !important;
          justify-content: center !important;
          border: none !important;
          cursor: pointer !important;
      }
      
      /* Back button for OTP screen */
      #loginContainer #otpScreen .back-btn {
          position: absolute !important;
          left: 1.5rem !important;
          top: 1.5cm !important;
          margin-top: 1.5cm !important;  /* optional */
          background: rgba(0, 0, 0, 0.1) !important;
          border: none !important;
          border-radius: 50% !important;
          width: 40px !important;
          height: 40px !important;
          display: flex !important;
          align-items: center !important;
          justify-content: center !important;
          cursor: pointer !important;
          z-index: 10 !important;
      }
      
      /* Prevent body scroll when modal is open */
      body.no-scroll {
          overflow: hidden !important;
          position: fixed !important;
          width: 100% !important;
          height: 100% !important;
      }
      
      /* Ensure inputs prevent zoom */
      #loginContainer input[type="tel"] {
          font-size: 16px !important;
          -webkit-appearance: none !important;
          appearance: none !important;
      }
      
      /* OTP Input Styles - Remove fill and align left */
      #loginContainer .otp-inputs {
          display: flex !important;
          justify-content: flex-start !important;
          gap: 8px !important;
          margin-bottom: 15px !important;
      }
      
      #loginContainer .otp-input {
          width: 45px !important;
          height: 45px !important;
          border: 1px solid #ddd !important;
          border-radius: 8px !important;
          text-align: center !important;
          font-size: 18px !important;
          font-weight: 500 !important;
          background-color: #ffffff !important;
          transition: border-color 0.2s ease !important;
      }
      
      #loginContainer .otp-input:focus {
          border-color: #6039DB !important;
          outline: none !important;
          background-color: #ffffff !important;
          box-shadow: 0 0 0 2px rgba(96, 57, 219, 0.1) !important;
      }
      
      #loginContainer .otp-input.filled {
          background-color: #ffffff !important;
          border-color: #6039DB !important;
      }
  }
  
  /* Desktop styles remain the same */
  @media (min-width: 769px) {
      .otp-inputs {
          display: flex !important;
          justify-content: flex-start !important;
          gap: 10px !important;
          margin-bottom: 15px !important;
      }
      
      .otp-input {
          width: 50px !important;
          height: 50px !important;
          border: 1px solid #ddd !important;
          border-radius: 12px !important;
          text-align: center !important;
          font-size: 20px !important;
          font-weight: 500 !important;
          background-color: #ffffff !important;
          transition: border-color 0.2s ease !important;
      }
      
      .otp-input:focus {
          border-color: #6039DB !important;
          outline: none !important;
          background-color: #ffffff !important;
          box-shadow: 0 0 0 2px rgba(96, 57, 219, 0.1) !important;
      }
      
      .otp-input.filled {
          background-color: #ffffff !important;
          border-color: #6039DB !important;
      }
  }