/* ==========================================================================
   APNA DRIVE CAR RENTAL GOA — GLOBAL RESPONSIVE STYLESHEET (CSS3)
   Comprehensive Mobile & Tablet Responsiveness (320px to 1024px)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Laptop & Tablet Breakpoint (Max 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  :root {
    --header-height: 82px;
  }

  .site-topbar {
    display: none; /* Hide top bar on tablet/mobile to keep header clean */
  }

  .mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--color-primary);
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast);
  }

  .mobile-menu-toggle:hover {
    background-color: var(--bg-surface-alt);
  }

  .main-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    max-width: 100vw;
    height: calc(100vh - var(--header-height));
    background-color: #FFFFFF;
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    box-shadow: var(--shadow-xl);
    z-index: 995;
  }

  .main-nav.active {
    transform: translateX(0);
  }

  .nav-list {
    flex-direction: column;
    width: 100%;
    align-items: flex-start;
    gap: 4px;
  }

  .nav-item {
    width: 100%;
  }

  .nav-link {
    width: 100%;
    justify-content: space-between;
    padding: 13px 16px;
    font-size: 1.02rem;
    border-bottom: 1px solid var(--border-light);
  }

  .nav-dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    background-color: var(--bg-surface-alt);
    border-radius: var(--radius-sm);
    margin: 4px 0 10px;
    display: none;
    padding: 6px 0;
    width: 100%;
  }

  .nav-item-dropdown.dropdown-open .nav-dropdown {
    display: block;
  }

  .nav-item-dropdown.dropdown-open .nav-dropdown-toggle svg {
    transform: rotate(180deg);
  }

  .nav-dropdown-link {
    padding: 10px 20px;
    font-size: 0.92rem;
    white-space: normal;
    overflow-wrap: break-word;
  }

  .booking-form-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-group.span-2,
  .form-group.span-4,
  .form-submit-group {
    grid-column: span 2;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
  }

  .footer-col:first-child {
    grid-column: span 2;
  }

  .car-detail-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }
}

/* --------------------------------------------------------------------------
   2. Tablet & Phablet Breakpoint (Max 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .section {
    padding-top: 48px;
    padding-bottom: 48px;
  }

  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  /* Typography */
  h1 { font-size: clamp(1.75rem, 5vw + 0.5rem, 2.25rem); }
  h2 { font-size: clamp(1.45rem, 4vw + 0.3rem, 1.95rem); }
  h3 { font-size: clamp(1.2rem, 3vw + 0.2rem, 1.45rem); }
  .section-header { margin-bottom: 32px; }

  /* Hero Section */
  .hero-section {
    min-height: auto;
    width: 100%;
    max-width: 100%;
  }

  .hero-content {
    padding: 44px 0 32px;
    max-width: 100%;
  }

  .hero-heading {
    font-size: clamp(1.6rem, 5.2vw, 2.2rem);
    line-height: 1.25;
    overflow-wrap: break-word;
  }

  .hero-lead-text {
    font-size: clamp(0.95rem, 3.2vw, 1.15rem);
    margin-bottom: 24px;
    max-width: 100%;
    overflow-wrap: break-word;
  }

  .hero-cta-group {
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-bottom: 24px;
  }

  .hero-cta-group .btn {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Booking Form Section */
  .booking-section-wrapper {
    margin-top: -24px;
    margin-bottom: 32px;
    width: 100%;
    max-width: 100%;
  }

  .booking-form-card {
    padding: 20px 16px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .booking-form-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 18px;
    padding-bottom: 12px;
  }

  .booking-form-header h3 {
    font-size: 1.25rem;
    overflow-wrap: break-word;
  }

  .booking-form-header p {
    font-size: 0.85rem;
    overflow-wrap: break-word;
  }

  .booking-form-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
    width: 100%;
    max-width: 100%;
  }

  .form-group,
  .form-group.span-2,
  .form-group.span-4,
  .form-submit-group {
    grid-column: span 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .form-control,
  input,
  select,
  textarea {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    font-size: 16px !important; /* Prevents iOS Safari auto-zoom */
  }

  .form-submit-group .btn {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    text-align: center !important;
    line-height: 1.35 !important;
    padding: 12px 14px !important;
    height: auto !important;
    min-height: 48px !important;
  }

  /* Fleet Controls Bar & Filters (Wrapping Naturally) */
  .fleet-controls-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 14px !important;
    gap: 14px !important;
    box-sizing: border-box !important;
  }

  .fleet-filter-group {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: visible !important;
    justify-content: flex-start !important;
  }

  .fleet-filter-btn {
    white-space: normal !important;
    max-width: 100% !important;
    padding: 6px 12px !important;
    font-size: 0.82rem !important;
    text-align: center !important;
    border-radius: var(--radius-pill) !important;
  }

  .fleet-search-group {
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 10px !important;
    align-items: stretch !important;
  }

  .search-input-wrap {
    width: 100% !important;
    max-width: 100% !important;
  }

  .search-input-wrap input {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    font-size: 16px !important;
  }

  #carSortSelect {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    font-size: 16px !important;
  }

  /* Fleet Grid & Car Cards */
  .fleet-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .car-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .car-card-actions {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .car-card-actions .btn {
    width: 100% !important;
    max-width: 100% !important;
    white-space: normal !important;
    text-align: center !important;
  }

  /* Content Grids (Features, Process, Locations, Services, Testimonials) */
  .feature-grid-3,
  .process-grid-4,
  .location-grid-4,
  .service-grid-4,
  .testimonial-grid-3,
  .gallery-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .feature-card,
  .process-step,
  .location-card,
  .service-card,
  .testimonial-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding: 20px 16px !important;
  }

  /* Multi-Button Groups & CTA Sections */
  .cta-btn-group,
  .page-cta-group,
  .car-detail-actions,
  .modal-actions {
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 10px !important;
  }

  .cta-btn-group .btn,
  .page-cta-group .btn,
  .car-detail-actions .btn,
  .modal-actions .btn {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    white-space: normal !important;
  }

  /* Booking Summary & Modal */
  .summary-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .summary-item.full-width {
    grid-column: span 1 !important;
  }

  .booking-modal-card {
    padding: 24px 16px !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .footer-col {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .footer-col:first-child {
    grid-column: span 1 !important;
  }

  .footer-bottom {
    flex-direction: column !important;
    text-align: center !important;
    gap: 14px !important;
    width: 100% !important;
  }

  .footer-bottom-links {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 12px !important;
    width: 100% !important;
  }

  /* Floating Actions & AI Assistant */
  .floating-action-container {
    bottom: 16px;
    right: 16px;
    max-width: calc(100vw - 32px);
  }

  .assistant-widget-container {
    bottom: 76px;
    right: 12px;
    left: 12px;
    width: auto !important;
    max-width: 100% !important;
  }

  .assistant-window {
    width: 100% !important;
    max-width: 400px;
    margin: 0 auto;
    height: 440px;
    max-height: calc(100vh - 100px);
  }
}

/* --------------------------------------------------------------------------
   3. Standard & Compact Mobile (Max 480px, 430px, 414px, 390px, 375px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  /* Header Controls & Compact Brand */
  .header-wrapper {
    gap: 6px;
    width: 100%;
    max-width: 100%;
  }

  .brand-logo {
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
  }

  .brand-logo-image {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
  }

  .brand-logo-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
    flex-shrink: 0;
  }

  .brand-logo-icon svg {
    width: 20px;
    height: 20px;
  }

  .brand-logo-text {
    min-width: 0;
    overflow: hidden;
  }

  .brand-logo-name {
    font-size: clamp(1rem, 3.8vw, 1.2rem);
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand-logo-sub {
    font-size: clamp(0.55rem, 2vw, 0.68rem);
    letter-spacing: 0.06em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-cta-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    min-width: 0;
  }

  /* Icon-Only Compact Header Buttons on Mobile */
  .header-cta-group .btn-sm {
    padding: 0 !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: var(--radius-sm) !important;
  }

  .header-cta-group .btn-sm span {
    display: none !important; /* Hide text, keep clear icon */
  }

  .header-cta-group .btn-sm svg {
    width: 18px;
    height: 18px;
    margin: 0;
  }

  .mobile-menu-toggle {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
  }

  .mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
  }

  /* Car Card Features Grid */
  .car-card-image-wrap {
    height: 180px;
  }

  .car-features-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px;
    padding: 10px;
    font-size: 0.76rem;
  }

  .feature-chip {
    font-size: 0.76rem;
    gap: 4px;
  }

  .feature-chip svg {
    width: 13px;
    height: 13px;
  }

  /* Spec Grid inside Car Detail Pages */
  .car-detail-grid .spec-table > div,
  .spec-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  /* General Button Wrapping */
  .btn,
  a.btn,
  button.btn {
    white-space: normal !important;
    max-width: 100% !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
    line-height: 1.35 !important;
  }

  /* FAQ Accordion */
  .faq-question {
    padding: 14px 16px;
    font-size: 0.95rem;
  }

  .faq-answer {
    padding: 0 16px;
  }

  .faq-item.active .faq-answer {
    padding-bottom: 16px;
  }

  /* Gallery Lightbox */
  .lightbox-backdrop {
    padding: 12px;
  }

  .lightbox-content {
    max-width: calc(100vw - 24px);
    width: 100%;
  }

  .lightbox-img {
    max-height: 65vh;
  }

  .lightbox-close {
    top: -36px;
    right: 0;
    font-size: 1.75rem;
  }
}

/* --------------------------------------------------------------------------
   4. Ultra Small Mobile Breakpoint (Max 360px & 320px)
   -------------------------------------------------------------------------- */
@media (max-width: 360px) {
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  .header-wrapper {
    gap: 4px;
  }

  .brand-logo-icon {
    width: 30px;
    height: 30px;
    min-width: 30px;
  }

  .brand-logo-icon svg {
    width: 16px;
    height: 16px;
  }

  .brand-logo-name {
    font-size: 0.98rem;
  }

  .brand-logo-sub {
    font-size: 0.55rem;
  }

  .header-cta-group {
    gap: 4px;
  }

  .header-cta-group .btn-sm {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
  }

  .header-cta-group .btn-sm svg {
    width: 15px;
    height: 15px;
  }

  .mobile-menu-toggle {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
  }

  .mobile-menu-toggle svg {
    width: 20px;
    height: 20px;
  }

  .booking-form-card {
    padding: 16px 12px;
  }

  .car-card-body {
    padding: 14px 12px;
  }

  .car-title {
    font-size: 1.1rem;
  }

  .price-amount {
    font-size: 1.05rem;
  }

  .car-features-grid {
    grid-template-columns: 1fr !important;
  }

  .floating-main-trigger {
    width: 46px;
    height: 46px;
  }

  .floating-icon {
    width: 40px;
    height: 40px;
  }

  .floating-label {
    font-size: 0.72rem;
    padding: 3px 8px;
    max-width: calc(100vw - 80px);
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
