/**
 * YNR Makine - Evrensel Mobil Responsive CSS Motoru (Universal Mobile Optimization Engine)
 * Tüm cihazlar (320px - 1024px) için kusursuz mobil uyumluluk ve sıfır taşma garantisi.
 */

/* ==========================================================================
   1. GLOBAL ZERO HORIZONTAL OVERFLOW & SAFE RESETS
   ========================================================================== */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100% !important;
  position: relative !important;
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after {
  box-sizing: border-box !important;
}

img, video, iframe, canvas, svg {
  max-width: 100% !important;
  height: auto;
}

/* Önceden inline veya sabit genişlik atanmış tabloların taşmasını engelle */
table {
  max-width: 100% !important;
}

/* Form girdilerinin iOS Safari'de otomatik ekran zoomlamasını engelle (min 16px) */
@media screen and (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="password"],
  input[type="search"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* ==========================================================================
   2. TABLET VE ORTA EKRANLAR (max-width: 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  /* Header & Navigation Fixes */
  .header-container {
    height: 70px !important;
  }
  
  .nav-menu {
    position: fixed !important;
    top: 70px !important;
    left: -100% !important;
    width: 100% !important;
    height: calc(100vh - 70px) !important;
    max-height: calc(100dvh - 70px) !important;
    background: var(--bg-darker, #070a13) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 1.5rem 1.25rem 5rem 1.25rem !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.4rem !important;
    border-top: 1px solid var(--border-color, #334155) !important;
    z-index: 1090 !important;
  }

  .nav-menu.active {
    left: 0 !important;
  }

  .nav-menu .nav-link {
    width: 100% !important;
    padding: 0.65rem 0.5rem !important;
    font-size: 0.92rem !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .nav-dropdown {
    width: 100% !important;
  }

  .nav-dropdown-menu {
    position: static !important;
    transform: none !important;
    width: 100% !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    padding: 0.5rem !important;
    margin: 0.35rem 0 0.5rem 0 !important;
  }

  .nav-cta {
    width: 100% !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
    margin-top: 1rem !important;
    padding-top: 1rem !important;
    border-top: 1px dashed rgba(255, 255, 255, 0.12) !important;
  }

  .nav-cta .btn {
    width: 100% !important;
    justify-content: center !important;
    min-height: 44px !important;
  }

  .nav-cta .lang-selector {
    width: 100% !important;
  }

  .nav-cta .lang-btn {
    width: 100% !important;
    justify-content: space-between !important;
    min-height: 44px !important;
  }

  .lang-dropdown-menu {
    position: static !important;
    width: 100% !important;
    box-shadow: none !important;
    margin-top: 0.4rem !important;
  }
}

/* ==========================================================================
   3. MODEL, MARKA VE LANDING SAYFALARI (max-width: 991px)
   ========================================================================== */
@media (max-width: 991px) {
  /* 2 Kolonlu Ana Sayfa Gövdesini Mobilde Tek Kolona Çevir */
  .model-content-grid,
  .brand-content-layout,
  .landing-content-layout,
  div[style*="grid-template-columns: 2.5fr 1fr"],
  div[style*="grid-template-columns: 2fr 1fr"],
  .grid-2col {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 2rem !important;
  }

  aside, 
  aside > div[style*="position: sticky"],
  .sidebar-sticky {
    position: static !important;
    top: auto !important;
    width: 100% !important;
  }

  /* Faz 5 Hero Grid */
  .faz5-hero-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  /* Faz 5 Sticky Subnav */
  .faz5-subnav-sticky {
    top: 70px !important;
    border-radius: 8px !important;
    margin-bottom: 1.5rem !important;
  }

  .faz5-subnav-list {
    padding: 6px 8px !important;
    gap: 6px !important;
  }

  .faz5-subnav-link {
    font-size: 0.78rem !important;
    padding: 6px 10px !important;
  }

  .faz5-subnav-cta {
    font-size: 0.78rem !important;
    padding: 6px 12px !important;
  }

  .faz5-title {
    font-size: 1.65rem !important;
    line-height: 1.3 !important;
  }

  .faz5-summary-card {
    padding: 1.5rem !important;
  }

  /* Markalar Sayfası Grid */
  #brandsGrid {
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)) !important;
    gap: 1.25rem !important;
  }
}

/* ==========================================================================
   4. AKILLI TELEFONLAR (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .section {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }

  .faz5-container {
    padding-top: 85px !important;
    padding-bottom: 40px !important;
  }

  /* Tipografi Küçültmeleri */
  h1, .hero-title, .faz5-title {
    font-size: 1.5rem !important;
    line-height: 1.28 !important;
  }

  .hero-btns {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.75rem !important;
  }

  .hero-btns .btn {
    width: 100% !important;
    justify-content: center !important;
    min-height: 44px !important;
  }

  .section-title {
    font-size: 1.65rem !important;
  }

  .section-subtitle {
    font-size: 0.95rem !important;
    margin-bottom: 2rem !important;
  }

  /* Tüm Büyük CTA Butonları Mobilde Tam Genişlik */
  .btn-lg {
    padding: 0.8rem 1.25rem !important;
    font-size: 0.9rem !important;
  }

  /* Marka Detay Hero Butonları */
  .brand-hero-buttons,
  div[style*="display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;"] {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 0.75rem !important;
  }

  div[style*="display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;"] > a,
  div[style*="display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;"] > button {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
  }

  /* Markalar Sayfası İstatistik Kartları */
  div[style*="grid-template-columns: repeat(auto-fit, minmax(180px, 1fr))"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }

  /* Form Alanları & Teklif Sayfası Grid Taşma Çözümü */
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns: repeat(auto-fit, minmax(350px, 1fr))"],
  .form-grid {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 1rem !important;
  }

  .form-group {
    width: 100% !important;
  }

  /* Marka Modelleri Kart Gridi */
  div[style*="grid-template-columns: repeat(auto-fill, minmax(185px, 1fr))"],
  div[style*="grid-template-columns: repeat(auto-fill, minmax(180px, 1fr))"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }

  /* Kova Seçenekleri Kartları */
  .faz5-buckets-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* Model Özellikler Tablosu */
  .faz5-specs-table {
    font-size: 0.82rem !important;
  }

  .faz5-specs-table td {
    padding: 8px 10px !important;
  }

  .faz5-specs-label {
    width: 50% !important;
  }

  /* Tabloların Taşmaması İçin Scroll Container */
  .tech-table,
  .seo-rich-content table {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-collapse: collapse !important;
  }

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

  .footer-bottom {
    flex-direction: column !important;
    text-align: center !important;
    gap: 0.75rem !important;
  }

  .footer-legal-links {
    justify-content: center !important;
  }

  /* Alt Sabit Butonlar (Floating Call & WhatsApp) */
  .floating-contact-actions {
    bottom: 20px !important;
    right: 12px !important;
    gap: 8px !important;
  }

  .floating-contact-actions .call-widget,
  .floating-contact-actions .whatsapp-widget {
    height: 42px !important;
    padding: 0 0.9rem !important;
    font-size: 0.82rem !important;
  }

  .floating-contact-actions .call-widget i {
    font-size: 1.1rem !important;
  }

  .floating-contact-actions .whatsapp-widget i {
    font-size: 1.3rem !important;
  }
}

/* ==========================================================================
   5. ÇOK KÜÇÜK MOBİL EKRANLAR (max-width: 480px)
   ========================================================================== */
@media (max-width: 480px) {
  .logo img {
    height: 34px !important;
  }

  .faz5-container {
    padding-top: 75px !important;
  }

  h1, .faz5-title {
    font-size: 1.35rem !important;
  }

  .faz5-main-image-wrap {
    aspect-ratio: 16 / 11 !important;
  }

  .faz5-thumbs-strip {
    gap: 6px !important;
  }

  .faz5-thumb-btn {
    width: 68px !important;
    height: 52px !important;
  }

  /* Marka Modelleri Kartları dar ekranda */
  div[style*="grid-template-columns: repeat(auto-fill, minmax(185px, 1fr))"],
  div[style*="grid-template-columns: repeat(auto-fill, minmax(180px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }

  /* Wizard Sihirbaz Modalı */
  .wizard-card {
    width: 95% !important;
    padding: 1.5rem 1rem !important;
    border-radius: 12px !important;
    max-height: 94vh !important;
  }

  .wizard-options-grid {
    grid-template-columns: 1fr !important;
    gap: 0.65rem !important;
  }

  .wizard-indicators-bar {
    max-width: 280px !important;
    margin-bottom: 1.75rem !important;
  }

  /* Floating CTA'lar çok dar ekranda simge + kısa metin */
  .floating-contact-actions .call-widget span.call-text,
  .floating-contact-actions .whatsapp-widget span.wa-text {
    font-size: 0.78rem !important;
  }
}
