/* ============================================
   RESPONSIVE - Auto Tuan Linh
   Mobile-First Responsive Overrides
   ============================================ */

/* === GLOBAL MOBILE FIXES === */
html, body {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

/* Prevent horizontal scroll from any element */
*, *::before, *::after {
  max-width: 100vw;
}

/* Ensure all images are responsive */
img {
  max-width: 100%;
  height: auto;
}

/* Responsive Tables */
table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
}

.table-responsive,
.wp-block-table {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.5rem;
}

/* Form inputs on mobile - avoid Android/iOS auto-zoom */
input, select, textarea {
  font-size: 16px !important;
}

/* === TABLET & MOBILE HEADER: 1024px and below === */
@media (max-width: 1024px) {
  :root {
    --header-h: 70px;
  }

  /* Header Bar */
  #luxury-header {
    height: var(--header-h);
    background: rgba(10, 10, 10, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(212, 175, 55, 0.25);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.8);
  }

  #luxury-header.scrolled {
    height: 62px;
    background: #080808;
    border-bottom-color: rgba(212, 175, 55, 0.35);
  }

  /* Sát mép 2 bên: container chiếm 100% chiều rộng với padding tối thiểu 10px */
  #luxury-header .lux-container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  /* 3-Zone Architecture: Left (Menu sát mép), Center (Logo), Right (Actions sát mép) */
  #luxury-header .header-inner {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
  }

  /* 1. Mép trái: Nút Hamburger Menu */
  .lux-mobile-btn {
    display: inline-flex !important;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: column !important;
    gap: 5px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(212, 175, 55, 0.25) !important;
    border-radius: 10px !important;
    color: var(--gold) !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    z-index: 10 !important;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1) !important;
  }

  .lux-mobile-btn:active {
    background: rgba(212, 175, 55, 0.15) !important;
    border-color: var(--gold) !important;
    transform: scale(0.94) !important;
  }

  .lux-mobile-btn span {
    display: block !important;
    width: 20px !important;
    height: 2px !important;
    background: var(--gold) !important;
    border-radius: 2px !important;
    transition: all 0.3s ease !important;
  }

  .lux-mobile-btn span:nth-child(2) {
    width: 14px !important;
    margin-left: -6px !important;
  }

  /* 2. Chính giữa: Logo Auto Tuấn Linh căn tâm tuyệt đối, kích thước chuẩn, không đè icon */
  #luxury-header .lux-logo {
    display: flex !important;
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    z-index: 5 !important;
    max-width: 140px !important;
    pointer-events: auto !important;
  }

  #luxury-header .lux-logo-img {
    display: block !important;
    max-width: 130px !important;
    max-height: 38px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    filter: drop-shadow(0 2px 8px rgba(212, 175, 55, 0.4)) !important;
    transition: all 0.3s ease !important;
  }

  #luxury-header.scrolled .lux-logo-img {
    max-height: 32px !important;
    max-width: 115px !important;
  }

  /* Hide Desktop Nav & Desktop Actions */
  .lux-nav { display: none !important; }
  .header-hotline { display: none !important; }
  #luxury-header .btn-appointment { display: none !important; }
  .dropdown-menu { display: none !important; }

  /* 3. Mép phải: Tiện ích nhanh (Theo dõi đơn hàng & Giỏ hàng) */
  .header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    margin-left: auto !important;
    z-index: 10 !important;
  }

  .header-cart {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(212, 175, 55, 0.2) !important;
    border-radius: 50% !important;
    color: var(--gold) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    transition: all 0.3s ease !important;
  }

  .header-cart:active {
    background: rgba(212, 175, 55, 0.15) !important;
    border-color: var(--gold) !important;
    transform: scale(0.94) !important;
  }

  .header-cart svg {
    width: 19px !important;
    height: 19px !important;
    stroke: var(--gold) !important;
  }

  .cart-count {
    top: -3px !important;
    right: -3px !important;
    min-width: 18px !important;
    height: 18px !important;
    font-size: 10px !important;
    background: linear-gradient(135deg, var(--gold), var(--gold-2)) !important;
    color: var(--black) !important;
    font-weight: 800 !important;
    border: 2px solid #0A0A0A !important;
  }

  /* About */
  .about-grid {
    grid-template-columns: 1fr !important;
    gap: 2.5rem;
  }
  .about-media { height: 350px; }
  .about-media-badge { right: 1rem; }
  .about-text { padding-right: 0; }
  .about-features {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  /* Cars / Products Grid */
  .cars-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem;
  }

  /* Footer */
  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

/* === MOBILE LANDSCAPE & SMALL TABLET: 768px and below === */
@media (max-width: 768px) {
  :root {
    --header-h: 68px;
  }

  .lux-container {
    padding: 0 1rem;
  }

  /* --- HEADER MOBILE REFINED --- */
  #luxury-header {
    height: var(--header-h);
  }

  #luxury-header.scrolled {
    height: 62px;
  }

  /* --- HERO SECTION MOBILE --- */
  #hero-section {
    min-height: 100svh;
    min-height: -webkit-fill-available;
  }

  .hero-content {
    padding-top: calc(var(--header-h) + 2.5rem) !important;
    padding-bottom: 5rem !important;
    padding-left: 0;
    padding-right: 0;
  }

  .hero-badge {
    font-size: 0.55rem;
    padding: 0.35rem 0.85rem;
    margin-bottom: 1.25rem;
    letter-spacing: 0.15em;
  }

  .hero-headline-wrap {
    margin-bottom: 1rem;
    overflow: visible;
    padding: 0;
  }

  .hero-title-1,
  .hero-title-2 {
    font-size: clamp(1.75rem, 8vw, 2.8rem) !important;
    line-height: 1.15 !important;
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    word-break: keep-all;
  }

  .hero-desc {
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 100%;
    margin-bottom: 1.5rem;
  }

  .hero-desc br {
    display: none;
  }

  .hero-cta {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    width: 100%;
  }

  .hero-cta .btn-gold,
  .hero-cta .btn-outline-white {
    width: 100%;
    justify-content: center;
    padding: 0.9rem 1.5rem;
    font-size: 0.8rem;
    min-height: 48px;
  }

  .hero-arrow { display: none !important; }
  .hero-scroll-hint { display: none !important; }
  .hero-stats-row { display: none !important; }

  .hero-nav {
    bottom: 1.5rem;
  }

  .hero-dot {
    width: 8px;
    height: 8px;
  }

  /* --- SECTIONS MOBILE --- */
  .lux-section {
    padding: 3.5rem 0;
  }

  .section-header {
    margin-bottom: 2rem;
  }

  .lux-label {
    font-size: 0.6rem;
    letter-spacing: 0.18em;
  }

  .lux-title {
    font-size: clamp(1.4rem, 5.5vw, 2.2rem) !important;
    line-height: 1.2;
  }

  .lux-title br {
    display: none;
  }

  .lux-subtitle {
    font-size: 0.9rem;
    max-width: 100%;
  }

  .gold-divider {
    margin: 1rem 0;
  }

  /* --- ABOUT MOBILE --- */
  .about-media {
    height: 280px;
  }

  .about-media-badge {
    right: 0.75rem;
    bottom: 1.5rem;
    padding: 1rem 1.25rem;
  }

  .about-media-badge-num {
    font-size: 2rem;
  }

  .about-features {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
    margin: 1.5rem 0;
  }

  .about-feature {
    padding: 1rem;
  }

  /* --- CARDS MOBILE --- */
  .cars-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem;
  }

  .car-card {
    border-radius: 8px;
  }

  .car-card:hover {
    transform: none;
  }

  .car-card-img {
    height: 140px !important;
  }

  .car-card-body {
    padding: 0.75rem !important;
  }

  .car-card-brand {
    font-size: 0.55rem;
    letter-spacing: 0.1em;
    margin-bottom: 0.2rem;
  }

  .car-card-name {
    font-size: 0.85rem !important;
    min-height: auto !important;
    margin-bottom: 0.25rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .car-card-name a {
    font-size: inherit !important;
  }

  .car-card-specs {
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .car-spec-val {
    font-size: 0.75rem;
  }

  .car-spec-label {
    font-size: 0.55rem;
  }

  .car-card-body p {
    font-size: 0.75rem !important;
    line-height: 1.4 !important;
    margin-bottom: 0.5rem !important;
    -webkit-line-clamp: 2 !important;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .car-card-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding-top: 0.5rem !important;
  }

  .car-price-val {
    font-size: 0.9rem !important;
  }

  .btn-view-car {
    width: 100%;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    min-height: 36px;
  }

  .cars-footer {
    margin-top: 2rem;
  }

  .cars-footer .btn-outline-white {
    width: 100%;
    justify-content: center;
    padding: 0.85rem 1.5rem;
    font-size: 0.8rem;
  }

  /* --- BRANDS MARQUEE MOBILE --- */
  .brands-section {
    padding: 2.5rem 0;
  }

  .brands-label {
    font-size: 0.55rem;
    margin-bottom: 1.5rem;
    padding: 0 1rem;
  }

  .brands-marquee-track {
    gap: 2rem;
  }

  .brand-name {
    font-size: 1rem;
  }

  /* --- SERVICES MOBILE --- */
  .services-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1px;
  }

  .service-card {
    padding: 1.5rem 1rem;
  }

  .service-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
  }

  .service-icon svg {
    width: 22px;
    height: 22px;
  }

  .service-title {
    font-size: 0.85rem;
  }

  .service-desc {
    font-size: 0.72rem;
    line-height: 1.5;
  }

  /* --- TESTIMONIALS MOBILE --- */
  .testimonial-card {
    flex: 0 0 100% !important;
    padding: 0 0.25rem;
  }

  .testimonial-inner {
    padding: 1.5rem;
  }

  .testimonial-quote-icon {
    font-size: 3rem;
  }

  .testimonial-text {
    font-size: 0.85rem;
    line-height: 1.7;
  }

  .testimonial-avatar {
    width: 40px;
    height: 40px;
    font-size: 0.85rem;
  }

  .testimonial-name {
    font-size: 0.85rem;
  }

  .testimonial-role {
    font-size: 0.7rem;
  }

  /* --- FINAL CTA MOBILE --- */
  .final-cta-section {
    padding: 5rem 0;
  }

  .cta-headline {
    font-size: clamp(1.6rem, 6vw, 2.5rem) !important;
  }

  .cta-desc {
    font-size: 0.9rem;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
  }

  .btn-cta-vip {
    padding: 0.9rem 2rem;
    font-size: 0.8rem;
    width: 100%;
    justify-content: center;
  }

  .final-cta-section .btn-outline-white {
    width: 100%;
    justify-content: center;
  }

  /* --- FOOTER MOBILE --- */
  .footer-top {
    grid-template-columns: 1fr !important;
    gap: 2rem;
    padding: 3rem 0 2rem;
  }

  .footer-brand-desc {
    font-size: 0.85rem;
  }

  .footer-col-title {
    font-size: 0.9rem;
    margin-bottom: 1rem;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
    padding: 1.25rem 0;
  }

  .footer-copy, .footer-bottom-right {
    font-size: 0.72rem;
  }

  /* --- SCROLL TOP MOBILE --- */
  #scroll-top-btn {
    width: 40px;
    height: 40px;
    bottom: 1rem;
    right: 1rem;
  }

  /* --- MODAL MOBILE --- */
  #appointment-modal {
    padding: 0.75rem;
    align-items: flex-end;
  }

  .modal-inner {
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-title {
    font-size: 1.3rem;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 0.75rem 0.85rem;
    font-size: 16px; /* Prevents iOS zoom */
    min-height: 48px;
  }

  .form-group textarea {
    min-height: 80px;
  }

  .modal-submit button {
    min-height: 48px;
    font-size: 0.85rem;
  }

  /* --- MOBILE MENU ENHANCEMENTS --- */
  .lux-mobile-menu {
    padding: 1.5rem;
  }

  .mobile-menu-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    position: relative !important;
    padding-bottom: 1.25rem !important;
    margin-bottom: 2rem !important;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2) !important;
  }

  .mobile-menu-header .lux-logo {
    position: static !important;
    transform: none !important;
    max-width: 200px !important;
    padding: 0 !important;
  }

  .mobile-menu-header .lux-logo-img {
    max-width: 160px !important;
    max-height: 42px !important;
  }

  .mobile-close-btn {
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(212, 175, 55, 0.25) !important;
    border-radius: 50% !important;
    color: var(--gold) !important;
    font-size: 1.6rem !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
  }

  .mobile-close-btn:active {
    background: rgba(212, 175, 55, 0.2) !important;
    transform: scale(0.92) !important;
  }

  .mobile-nav-list a {
    padding: 1rem 0;
    font-size: 1.15rem;
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  /* --- PAGINATION MOBILE --- */
  .pagination-wrap .nav-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .pagination-wrap .page-numbers {
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* === SMALL MOBILE: 480px and below === */
@media (max-width: 480px) {
  .lux-container {
    padding: 0 0.875rem;
  }

  .hero-title-1,
  .hero-title-2 {
    font-size: clamp(1.5rem, 7.5vw, 2.2rem) !important;
  }

  .hero-badge {
    font-size: 0.5rem;
    letter-spacing: 0.12em;
  }

  .about-media {
    height: 220px;
  }

  .service-card {
    padding: 1.25rem 0.75rem;
  }

  .service-title {
    font-size: 0.78rem;
  }

  .service-desc {
    font-size: 0.68rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* === VERY SMALL MOBILE: 360px and below === */
@media (max-width: 360px) {
  .lux-container {
    padding: 0 0.6rem !important;
  }

  /* Header adjustments for 360px */
  .lux-mobile-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
  }
  .header-cart {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
  }
  .header-cart svg {
    width: 17px !important;
    height: 17px !important;
  }

  .hero-title-1,
  .hero-title-2 {
    font-size: 1.4rem !important;
  }

  .hero-desc {
    font-size: 0.82rem;
  }

  .lux-title {
    font-size: 1.3rem !important;
  }

  .car-card-img {
    height: 120px !important;
  }

  .car-card-body {
    padding: 0.6rem !important;
  }

  .car-card-name {
    font-size: 0.78rem !important;
  }

  .testimonial-inner {
    padding: 1.25rem;
  }

  .testimonial-text {
    font-size: 0.8rem;
  }
}

/* === TINY SCREEN: 320px === */
@media (max-width: 320px) {
  #header-track-order {
    display: none !important;
  }

  .hero-title-1,
  .hero-title-2 {
    font-size: 1.25rem !important;
  }

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

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

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

/* === LANDSCAPE PHONE === */
@media (max-width: 812px) and (orientation: landscape) {
  #hero-section {
    min-height: 100vh;
    height: auto;
  }

  .hero-content {
    padding-top: calc(var(--header-h) + 1rem);
    padding-bottom: 4rem;
  }

  .hero-title-1,
  .hero-title-2 {
    font-size: clamp(1.5rem, 4vw, 2rem) !important;
  }

  .hero-cta {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .hero-cta .btn-gold,
  .hero-cta .btn-outline-white {
    width: auto;
  }
}

/* === TOUCH DEVICE OPTIMIZATIONS === */
@media (hover: none) and (pointer: coarse) {
  /* Disable hover effects that cause issues on touch */
  .car-card:hover {
    transform: none;
    box-shadow: none;
  }

  .service-card:hover {
    background: var(--piano);
  }

  .service-card:hover .service-icon {
    transform: none;
    background: var(--glass);
    color: var(--gold);
    border-color: var(--glass-border);
  }

  .btn-gold:hover,
  .btn-outline-white:hover {
    transform: none;
  }

  .btn-cta-vip:hover {
    transform: none;
  }

  /* Ensure minimum touch target sizes */
  .hero-dot {
    width: 12px;
    height: 12px;
    padding: 8px;
  }

  .test-dot {
    width: 10px;
    height: 10px;
    padding: 6px;
  }

  .footer-links a {
    display: block;
    padding: 0.4rem 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .footer-social-link {
    width: 44px;
    height: 44px;
  }

  /* Active state feedback for touch */
  .btn-gold:active {
    transform: scale(0.97);
    opacity: 0.9;
  }

  .btn-outline-white:active {
    transform: scale(0.97);
    opacity: 0.9;
  }

  .car-card:active {
    transform: scale(0.98);
    border-color: var(--gold);
  }
}

/* === PERFORMANCE: Reduce animations on mobile === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* === DROPDOWN MENU STYLES (integrated) === */
.has-dropdown {
  position: relative;
}

.has-dropdown > a::after {
  content: "▼";
  font-size: 0.6em;
  margin-left: 6px;
  opacity: 0.7;
  display: inline-block;
  vertical-align: middle;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: rgba(20, 20, 20, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-top: 2px solid var(--gold);
  list-style: none;
  padding: 0.5rem 0;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 100;
}

.has-dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu li {
  width: 100%;
}

.dropdown-menu a {
  display: block;
  padding: 0.75rem 1.5rem;
  color: var(--white);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.dropdown-menu li:last-child a {
  border-bottom: none;
}

.dropdown-menu a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--gold);
  padding-left: 1.8rem;
}

/* Hide dropdown on mobile (handled by mobile menu) */
@media (max-width: 1024px) {
  .dropdown-menu {
    display: none !important;
  }
  .has-dropdown > a::after {
    display: none;
  }
}

/* === ARCHIVE/TAXONOMY PAGE HEADER FIX === */
.page-hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50vh;
  background: linear-gradient(180deg, #0a0a0a, #1a1a1a);
  z-index: -1;
}

/* === SINGLE SERVICE PAGE MOBILE === */
@media (max-width: 768px) {
  .single-service .single-hero {
    height: 350px !important;
  }

  .single-service .lux-title {
    font-size: clamp(1.5rem, 6vw, 2.5rem) !important;
  }

  .service-cta-box {
    padding: 2rem 1.25rem !important;
  }

  .service-cta-box h3 {
    font-size: 1.3rem !important;
  }

  .post-content {
    font-size: 0.95rem !important;
  }
}
