/* ==========================================================================
   DC Clinic - Premium Mobile Experience
   World-class responsive layer for tablet & mobile
   Target breakpoints: 320, 360, 375, 390, 393, 414, 430, 480, 576, 768, 820, 1024
   ========================================================================== */

/* ==========================================================================
   1. Global Mobile Optimizations (≤1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  /* Prevent horizontal scroll on all devices */
  html, body {
    overflow-x: clip;
    max-width: 100vw;
  }

  /* Smooth scroll with momentum */
  body {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  /* Remove tap highlight */
  * {
    -webkit-tap-highlight-color: transparent;
  }

  /* Premium touch targets */
  a, button, input, select, textarea {
    touch-action: manipulation;
  }

  /* Disable hover effects on touch devices */
  @media (hover: none) {
    .dc-card:hover,
    .dc-service-card:hover,
    .dc-mm-surgery__card:hover,
    .dc-mm-wellness__card:hover,
    .dc-mm-reviews__cat:hover,
    .btn-dc-gold:hover,
    .btn-dc-outline:hover,
    .btn-dc-ghost:hover,
    .btn-dc-ghost-light:hover,
    .btn-dc-primary:hover {
      transform: none !important;
      box-shadow: var(--dc-shadow-sm) !important;
    }

    .dc-card:hover .dc-card__icon {
      background: linear-gradient(135deg, var(--dc-surface-low) 0%, var(--dc-surface-container) 100%);
      color: var(--dc-gold);
      transform: none;
    }

    .dc-service-card:hover img {
      transform: none;
    }

    .dc-mm-surgery__card:hover .dc-mm-surgery__card-img img,
    .dc-mm-wellness__card:hover .dc-mm-wellness__card-img img,
    .dc-mm-reviews__cat:hover .dc-mm-reviews__cat-img img {
      transform: none;
    }
  }

  /* Focus visible for keyboard nav */
  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible {
    outline: 2px solid var(--dc-gold);
    outline-offset: 2px;
  }
}

@media (max-width: 768px) {
  .dc-mobile-menu__languages {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px 28px;
    color: #635943;
  }

  .dc-mobile-menu__languages .dc-lang-switcher {
    display: flex;
    gap: 8px;
  }

  .dc-mobile-menu__languages .dc-lang-switcher__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid rgba(172, 141, 98, 0.35);
    border-radius: 999px;
    color: inherit;
    text-decoration: none;
  }

  .dc-mobile-menu__languages .dc-lang-switcher__link--current {
    background: #AC8D62;
    color: #fff;
  }
}

/* ==========================================================================
   2. Tablet Optimizations (768px–1024px)
   ========================================================================== */
@media (max-width: 1024px) and (min-width: 769px) {
  :root {
    --dc-header-height: 64px;
    --dc-space-section: 56px;
    --dc-gutter: 24px;
  }

  /* Compact header */
  .dc-header {
    height: var(--dc-header-height);
  }

  .dc-header__inner {
    padding: 0 var(--dc-gutter);
  }

  .dc-logo__img {
    height: 40px;
  }

  /* Tablet grids */
  .dc-grid-2,
  .dc-grid-3,
  .dc-grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  /* Service cards 2-col */
  .dc-service-card {
    height: 380px;
  }

  /* Cards 16px radius */
  .dc-card,
  .dc-service-card {
    border-radius: 16px;
  }

  /* Section spacing */
  .dc-section {
    padding-top: var(--dc-space-section);
    padding-bottom: var(--dc-space-section);
  }

  .section-header {
    margin-bottom: 32px;
  }

  .section-header h2 {
    font-size: 26px;
  }
}

/* ==========================================================================
   3. Mobile Optimizations (≤768px)
   ========================================================================== */
@media (max-width: 768px) {
  :root {
    --dc-header-height: 56px;
    --dc-bottom-nav-height: 68px;
    --dc-space-section: 40px;
    --dc-space-card: 20px;
    --dc-gutter: 16px;
    --dc-text-display: 26px;
    --dc-text-headline-lg: 22px;
    --dc-text-headline-md: 18px;
    --dc-text-body-lg: 15px;
    --dc-text-body: 14px;
    --dc-radius: 16px;
    --dc-radius-lg: 16px;
    --dc-radius-xl: 16px;
  }

  /* Body padding for header + bottom nav */
  body {
    padding-top: var(--dc-header-height);
    padding-bottom: calc(var(--dc-bottom-nav-height) + env(safe-area-inset-bottom));
  }

  /* Prevent body scroll when menu open */
  body.menu-open,
  body.dc-mobile-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }

  /* ========== Header ========== */
  .dc-header {
    height: var(--dc-header-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(99, 89, 67, 0.06);
  }

  .dc-header__inner {
    padding: 0 var(--dc-gutter);
    height: var(--dc-header-height) !important;
    gap: 8px;
  }

  .dc-logo__img {
    height: 36px;
  }

  /* Show hamburger + language + appointment */
  .dc-menu-toggle {
    display: flex !important;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
  }

  .dc-menu-toggle span {
    width: 22px;
    height: 2px;
    background: var(--dc-navy-deep);
    border-radius: 2px;
  }

  /* ========== Hero ========== */
  .dc-hero {
    min-height: auto;
    padding-top: 24px;
    padding-bottom: 32px;
  }

  .dc-hero__content {
    padding: 16px 0 24px;
  }

  .dc-hero h1,
  .dc-hero__title {
    font-size: 24px;
    line-height: 1.25;
    margin-bottom: 12px;
  }

  .dc-hero p,
  .dc-hero__desc {
    font-size: 14px;
    line-height: 1.55;
    margin-bottom: 20px;
  }

  .dc-hero__buttons {
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .dc-hero__buttons a {
    width: 100%;
    text-align: center;
    min-height: 48px;
    padding: 14px 24px;
    font-size: 15px;
  }

  /* ========== Sections ========== */
  .dc-section {
    padding-top: var(--dc-space-section);
    padding-bottom: var(--dc-space-section);
  }

  .section-header {
    margin-bottom: 24px;
    text-align: center;
  }

  .section-header h2 {
    font-size: 22px;
    line-height: 1.3;
    margin-bottom: 8px;
  }

  .section-header p {
    font-size: 14px;
    line-height: 1.5;
  }

  .label-caps {
    font-size: 10px;
    margin-bottom: 4px;
  }

  /* ========== Grids → 1 column ========== */
  .dc-grid-2,
  .dc-grid-3,
  .dc-grid-4 {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* ========== Cards ========== */
  .dc-card {
    padding: var(--dc-space-card);
    border-radius: 16px;
  }

  .dc-card__icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    margin-bottom: 20px;
  }

  .dc-card__icon .material-symbols-outlined {
    font-size: 26px;
  }

  .dc-service-card {
    height: 300px;
    border-radius: 16px;
  }

  .dc-service-card__content {
    padding: 20px;
  }

  .dc-service-card__content h3 {
    font-size: 17px;
  }

  .dc-service-card__content p {
    font-size: 13px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  /* ========== Buttons — 48px min ========== */
  .btn-dc-primary,
  .btn-dc-outline,
  .btn-dc-gold,
  .btn-dc-ghost,
  .btn-dc-ghost-light {
    min-height: 48px;
    padding: 14px 24px;
    font-size: 15px;
    border-radius: 50px;
  }

  .btn-dc-lg {
    padding: 16px 32px;
    min-height: 52px;
    font-size: 16px;
  }

  .btn-dc-sm {
    min-height: 40px;
    padding: 10px 18px;
    font-size: 13px;
  }

  /* ========== Stats Section ========== */
  .dc-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .dc-stat__value {
    font-size: 22px;
  }

  .dc-stat__label {
    font-size: 10px;
  }

  /* ========== Testimonials → Swipe Carousel ========== */
  .dc-testimonial-slider {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0 4px 8px;
  }

  .dc-testimonial-slider::-webkit-scrollbar {
    display: none;
  }

  .dc-testimonial-slider__slide {
    scroll-snap-align: center;
    min-width: 88vw;
    max-width: 360px;
  }

  .dc-testimonial {
    padding: 20px;
    border-radius: 16px;
  }

  /* ========== FAQ ========== */
  .dc-faq-item {
    border-radius: 12px;
    margin-bottom: 12px;
  }

  .dc-faq-question {
    padding: 16px 18px;
    font-size: 15px;
    min-height: 52px;
    display: flex;
    align-items: center;
    cursor: pointer;
  }

  .dc-faq-answer {
    padding: 0 18px 16px;
    font-size: 14px;
    line-height: 1.6;
  }

  /* ========== CTA Section ========== */
  .dc-cta,
  .dc-footer-cta {
    padding: 48px 20px;
  }

  .dc-cta__title,
  .dc-footer-cta__title {
    font-size: 22px;
    line-height: 1.3;
  }

  .dc-cta__desc,
  .dc-footer-cta__desc {
    font-size: 14px;
    line-height: 1.6;
  }

  .dc-cta__buttons,
  .dc-footer-cta__buttons {
    flex-direction: column;
    gap: 10px;
  }

  .dc-cta__buttons a,
  .dc-footer-cta__buttons a {
    width: 100%;
    text-align: center;
  }

  /* ========== Forms ========== */
  .dc-form__group {
    margin-bottom: 20px;
  }

  .dc-form__label {
    font-size: 14px;
    margin-bottom: 8px;
  }

  .dc-form__input,
  .dc-form-control,
  .dc-form-select,
  .dc-form-textarea {
    width: 100%;
    min-height: 52px;
    padding: 14px 16px;
    font-size: 16px;
    border-radius: 12px;
    border: 1.5px solid rgba(99, 89, 67, 0.12);
  }

  .dc-form-textarea {
    min-height: 120px;
  }

  /* ========== Footer ========== */
  .dc-footer {
    padding-top: var(--dc-space-section);
    padding-bottom: calc(var(--dc-bottom-nav-height) + 32px + env(safe-area-inset-bottom));
  }

  .dc-footer__grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .dc-footer__bottom-info {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .dc-footer__logo-img {
    max-height: 40px;
  }

  .dc-footer__desc {
    font-size: 13px;
    line-height: 1.6;
  }

  .dc-footer__heading {
    font-size: 14px;
  }

  .dc-footer__links li a {
    font-size: 13px;
    padding: 6px 0;
  }

  /* Clickable contacts */
  .dc-footer__links a[href^="tel:"] {
    color: var(--dc-gold-light);
  }

  /* ========== Images — prevent CLS ========== */
  img {
    max-width: 100%;
    height: auto;
  }

  .dc-service-card img,
  .dc-card img {
    aspect-ratio: var(--img-ratio, 4/3);
  }

  /* ========== Container ========== */
  .dc-container {
    padding-left: var(--dc-gutter);
    padding-right: var(--dc-gutter);
    max-width: 100%;
  }

  /* ========== Mobile Menu Drawer ========== */
  .dc-mobile-menu {
    width: 100vw;
    max-width: 400px;
    border-radius: 0;
    box-shadow: -8px 0 40px rgba(99, 89, 67, 0.15);
  }

  .dc-mobile-menu__header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(99, 89, 67, 0.06);
  }

  .dc-mobile-menu__close {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .dc-mobile-menu__nav {
    padding: 8px 0;
  }

  .dc-mobile-menu__item {
    min-height: 52px;
    padding: 14px 20px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(99, 89, 67, 0.04);
    transition: background 0.2s ease;
  }

  .dc-mobile-menu__item:active {
    background: rgba(172, 141, 98, 0.06);
  }

  .dc-mobile-menu__item-icon {
    font-size: 22px;
    color: var(--dc-gold);
  }

  /* Mobile menu accordion */
  .dc-mobile-dropdown {
    border-bottom: 1px solid rgba(99, 89, 67, 0.04);
  }

  .dc-mobile-dropdown__toggle {
    min-height: 52px;
    padding: 14px 20px;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
  }

  .dc-mobile-dropdown__content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
  }

  .dc-mobile-dropdown.is-open .dc-mobile-dropdown__content {
    max-height: 500px;
  }

  .dc-mobile-dropdown__content a {
    padding: 12px 20px 12px 48px;
    font-size: 14px;
    display: block;
    border-bottom: 1px solid rgba(99, 89, 67, 0.03);
  }

  /* ========== Announcement Bar ========== */
  .dc-announcement {
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    overflow: hidden;
  }

  .dc-announcement__inner {
    height: 100%;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .dc-announcement__text {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    flex: 1;
    min-width: 0;
  }

  .dc-announcement__cta {
    padding: 5px 12px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* ========== Back to top ========== */
  .dc-back-to-top {
    bottom: calc(var(--dc-bottom-nav-height) + 16px + env(safe-area-inset-bottom));
    right: 16px;
  }

  /* ========== Performance ========== */
  .dc-card,
  .dc-service-card,
  .dc-testimonial {
    will-change: transform;
    transform: translateZ(0);
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}

/* ==========================================================================
   4. Sticky Mobile CTA Bar (≤768px)
   ========================================================================== */
@media (max-width: 768px) {
  /* Show floating chat widget on mobile */
  .dc-chat-widget {
    display: block !important;
  }

  .dc-mobile-nav {
    height: var(--dc-bottom-nav-height);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(99, 89, 67, 0.08);
    box-shadow: 0 -2px 12px rgba(99, 89, 67, 0.06);
    padding: 8px 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  /* Hide when mobile menu is open */
  body.menu-open .dc-mobile-nav,
  body.dc-mobile-menu-open .dc-mobile-nav {
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }

  .dc-mobile-nav__item {
    flex: 1;
    min-width: 0;
    min-height: 52px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--dc-on-surface-variant);
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    transition: color 0.2s ease;
  }

  .dc-mobile-nav__item .material-symbols-outlined {
    font-size: 22px;
  }

  .dc-mobile-nav__item:active {
    color: var(--dc-gold);
  }

  .dc-mobile-nav__item.active {
    color: var(--dc-gold);
  }

  /* Chat button in bottom bar — gold highlight */
  .dc-mobile-nav__item--chat {
    flex: 1.3;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--dc-gold) 0%, var(--dc-gold-light) 100%);
    color: var(--dc-navy-deep);
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(172, 141, 98, 0.3);
  }

  .dc-mobile-nav__item--chat .material-symbols-outlined {
    font-size: 22px;
    color: var(--dc-navy-deep);
  }

  .dc-mobile-nav__item--chat:active {
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(172, 141, 98, 0.25);
  }
}

/* ==========================================================================
   5. Fine-tuned Breakpoints
   ========================================================================== */

/* 430px — Large Android */
@media (max-width: 430px) {
  .dc-hero h1 {
    font-size: 22px;
  }

  .dc-section h2 {
    font-size: 20px;
  }
}

/* 414px — iPhone Plus */
@media (max-width: 414px) {
  :root {
    --dc-gutter: 16px;
  }

  .dc-hero__buttons a {
    padding: 14px 20px;
  }
}

/* 390px — iPhone 14/15 */
@media (max-width: 390px) {
  :root {
    --dc-text-display: 24px;
    --dc-text-headline-lg: 20px;
    --dc-text-headline-md: 17px;
    --dc-gutter: 16px;
  }

  .dc-hero h1 {
    font-size: 21px;
  }

  .dc-card {
    padding: 18px;
  }

  .dc-service-card {
    height: 280px;
  }

  .dc-service-card__content {
    padding: 16px;
  }

  .dc-footer-cta__title {
    font-size: 20px;
  }
}

/* 393px — Pixel */
@media (max-width: 393px) {
  .dc-hero h1 {
    font-size: 20px;
  }
}

/* 375px — iPhone SE/Mini */
@media (max-width: 375px) {
  :root {
    --dc-text-display: 22px;
    --dc-text-headline-lg: 19px;
    --dc-text-headline-md: 16px;
    --dc-gutter: 14px;
  }

  .dc-container {
    padding-left: var(--dc-gutter);
    padding-right: var(--dc-gutter);
  }

  .dc-hero h1 {
    font-size: 19px;
  }

  .dc-hero p {
    font-size: 13px;
  }

  .dc-section {
    padding-top: 32px;
    padding-bottom: 32px;
  }

  .dc-card {
    padding: 16px;
  }

  .dc-service-card {
    height: 260px;
  }

  .dc-mobile-nav__item {
    padding: 4px 6px;
  }

  .dc-mobile-nav__item span:last-child {
    font-size: 9px;
  }
}

/* 360px — Small Android */
@media (max-width: 360px) {
  :root {
    --dc-gutter: 12px;
  }

  .dc-hero h1 {
    font-size: 18px;
  }

  .dc-section h2 {
    font-size: 18px;
  }

  .dc-mobile-nav__item span:last-child {
    font-size: 9px;
  }
}

/* 320px — Very small devices */
@media (max-width: 320px) {
  :root {
    --dc-gutter: 12px;
    --dc-text-display: 20px;
    --dc-text-headline-lg: 17px;
  }

  body {
    font-size: 13px;
  }

  .dc-hero h1 {
    font-size: 17px;
  }

  .dc-hero p {
    font-size: 12px;
  }

  .dc-mobile-nav__item span:last-child {
    display: none;
  }

  .dc-mobile-nav__item {
    min-width: 40px;
  }

  .dc-mobile-nav__item--cta span:last-child {
    display: inline;
    font-size: 10px;
  }
}

/* ==========================================================================
   6. 820px — iPad Air portrait
   ========================================================================== */
@media (max-width: 820px) and (min-width: 769px) {
  .dc-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .dc-service-card {
    height: 340px;
  }
}

/* ==========================================================================
   7. 480px — Small tablet / Large phone
   ========================================================================== */
@media (max-width: 480px) and (min-width: 431px) {
  .dc-hero h1 {
    font-size: 23px;
  }

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

/* ==========================================================================
   8. 576px — Bootstrap sm
   ========================================================================== */
@media (max-width: 576px) and (min-width: 431px) {
  .dc-grid-2,
  .dc-grid-3,
  .dc-grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   9. Overflow Prevention (all mobile)
   ========================================================================== */
@media (max-width: 1024px) {
  /* Ensure no element causes horizontal scroll */
  img,
  video,
  iframe,
  svg {
    max-width: 100%;
  }

  pre,
  code {
    overflow-x: auto;
    max-width: 100%;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    max-width: 100%;
  }

  /* Prevent flex overflow */
  .dc-hero__buttons,
  .dc-cta__buttons,
  .dc-footer-cta__buttons {
    flex-wrap: wrap;
  }
}

/* ==========================================================================
   10. Landscape Orientation (mobile)
   ========================================================================== */
@media (max-width: 1024px) and (orientation: landscape) {
  :root {
    --dc-header-height: 48px;
    --dc-bottom-nav-height: 56px;
    --dc-space-section: 32px;
  }

  .dc-header {
    height: var(--dc-header-height);
  }

  .dc-logo__img {
    height: 32px;
  }

  .dc-hero {
    padding-top: 12px;
    padding-bottom: 20px;
  }

  .dc-hero h1 {
    font-size: 20px;
  }

  .dc-hero__buttons {
    flex-direction: row;
    gap: 10px;
  }

  .dc-hero__buttons a {
    width: auto;
    flex: 1;
  }

  .dc-section {
    padding-top: var(--dc-space-section);
    padding-bottom: var(--dc-space-section);
  }

  .dc-mobile-nav {
    height: var(--dc-bottom-nav-height);
  }

  .dc-mobile-nav__item {
    min-height: 44px;
  }

  .dc-footer {
    padding-bottom: calc(var(--dc-bottom-nav-height) + 24px + env(safe-area-inset-bottom));
  }
}

/* ==========================================================================
   11. Print
   ========================================================================== */
@media print {
  .dc-header,
  .dc-footer,
  .dc-mobile-menu,
  .dc-mobile-nav,
  .dc-cta,
  .dc-back-to-top,
  .dc-announcement {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
    padding: 0;
  }
}
