/**
 * Zytek — mobil / dokunmatik optimizasyonları
 * theme-head.php üzerinden tüm public sayfalara yüklenir
 */

:root {
  --zytek-safe-bottom: env(safe-area-inset-bottom, 0px);
  --zytek-safe-top: env(safe-area-inset-top, 0px);
  --zytek-touch-min: 44px;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 72px;
}

/* Dokunmatik hedefler */
button,
a.pub-theme-btn,
.hamburger,
.zytek-cookie-btn,
.legal-btn,
.adm-btn,
.adm-icon-btn,
.adm-sidebar-toggle {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ——— Public navigasyon ——— */
@media (max-width: 1023px) {
  .premium-nav > div {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    gap: 8px;
  }

  .premium-nav .font-h2.text-h2 {
    font-size: clamp(1rem, 4.5vw, 1.25rem);
  }

  .premium-nav .brand-mark-premium {
    width: 32px !important;
    height: 32px !important;
    font-size: 14px !important;
  }

  .mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
  }

  .mobile-menu.active {
    max-height: min(78vh, 520px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  body.mobile-nav-open {
    overflow: hidden;
    touch-action: none;
  }

  body.mobile-nav-open .premium-nav {
    z-index: 60;
  }

  .mobile-menu-lang {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid rgba(195, 245, 255, 0.1);
  }

  .mobile-menu-lang button {
    flex: 1 1 calc(33% - 8px);
    min-height: var(--zytek-touch-min);
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(195, 245, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(220, 225, 251, 0.85);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
  }

  .mobile-menu-lang button.is-active {
    border-color: rgba(0, 218, 243, 0.45);
    color: #00daf3;
    background: rgba(0, 218, 243, 0.1);
  }
}

@media (max-width: 480px) {
  .mobile-nav-actions-compact .pub-theme-btn {
    width: 36px;
    height: 36px;
  }

  .mobile-nav-actions-compact .hamburger {
    min-width: var(--zytek-touch-min);
    min-height: var(--zytek-touch-min);
    padding: 10px 6px;
    justify-content: center;
  }
}

/* ——— Hero & bölümler ——— */
@media (max-width: 768px) {
  .hero-premium {
    min-height: auto !important;
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
  }

  .premium-assurance span {
    font-size: 11px;
    padding: 7px 10px;
  }

  .premium-stats {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .premium-stats > div {
    width: 100%;
  }

  .luxury-orb {
    width: 14rem;
    height: 14rem;
    left: -4rem;
  }

  footer .grid {
    gap: 1.5rem;
  }
}

@media (max-width: 640px) {
  .btn-premium,
  .primary-glow,
  button.btn-glow {
    width: 100%;
    justify-content: center;
  }

  .flex.flex-wrap.gap-stack-md.animate-delay-1 {
    flex-direction: column;
  }
}

/* ——— Sabit widget’lar (çakışma önleme) ——— */
@media (max-width: 768px) {
  .whatsapp-button {
    width: 52px;
    height: 52px;
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(84px + var(--zytek-safe-bottom));
    z-index: 998;
  }

  .whatsapp-button span {
    font-size: 24px;
  }

  #chatbot-widget {
    right: max(16px, env(safe-area-inset-right)) !important;
    bottom: calc(16px + var(--zytek-safe-bottom)) !important;
    z-index: 999 !important;
  }

  #chatbot-toggle {
    width: 52px !important;
    height: 52px !important;
  }

  #chatbot-window {
    width: min(92vw, 340px) !important;
    max-height: min(70vh, 420px) !important;
    right: 0 !important;
    bottom: calc(60px + var(--zytek-safe-bottom)) !important;
  }

  /* index’te chatbot varken _public_settings chatWidget gizle */
  body.page-has-chatbot #chatWidget {
    display: none !important;
  }

  #scrollTopBtn {
    bottom: calc(152px + var(--zytek-safe-bottom)) !important;
    left: max(16px, env(safe-area-inset-left)) !important;
    width: 40px !important;
    height: 40px !important;
  }

  .zytek-cookie-fab {
    bottom: calc(152px + var(--zytek-safe-bottom)) !important;
    left: max(16px, env(safe-area-inset-left)) !important;
    font-size: 11px;
    padding: 8px 12px;
  }

  .zytek-cookie-banner.is-visible ~ .zytek-cookie-fab,
  .zytek-cookie-banner.is-visible ~ #scrollTopBtn {
    bottom: calc(200px + var(--zytek-safe-bottom)) !important;
  }

  .zytek-cookie-modal-panel {
    width: min(94vw, 420px) !important;
    max-height: 88vh;
    overflow-y: auto;
    margin: 12px;
  }
}

/* ——— İletişim & basit sayfalar ——— */
@media (max-width: 768px) {
  .zytek-mobile-page {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-top: calc(72px + var(--zytek-safe-top));
    padding-bottom: calc(32px + var(--zytek-safe-bottom));
  }

  .zytek-mobile-page .container {
    padding: 24px 0 !important;
    max-width: 100%;
  }

  .zytek-mobile-page h1 {
    font-size: clamp(1.5rem, 6vw, 2rem) !important;
  }

  .zytek-mobile-page .btn {
    width: 100%;
    justify-content: center;
    min-height: var(--zytek-touch-min);
  }

  .zytek-mobile-fixed-settings {
    top: max(12px, var(--zytek-safe-top)) !important;
    right: max(12px, env(safe-area-inset-right)) !important;
  }
}

/* ——— KVKK / yasal ——— */
@media (max-width: 768px) {
  .legal-wrap {
    padding: calc(72px + var(--zytek-safe-top)) max(16px, env(safe-area-inset-left)) calc(40px + var(--zytek-safe-bottom)) !important;
  }

  .legal-wrap h1 {
    font-size: clamp(1.45rem, 6vw, 1.85rem) !important;
  }

  .legal-toc {
    gap: 6px;
  }

  .legal-toc a {
    font-size: 11px;
    padding: 8px 10px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  .legal-card {
    padding: 18px 16px !important;
  }

  .legal-actions {
    flex-direction: column;
  }

  .legal-actions .legal-btn {
    width: 100%;
    text-align: center;
    min-height: var(--zytek-touch-min);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .legal-info-grid,
  .legal-rights-grid,
  .legal-cookie-grid,
  .hub-grid {
    grid-template-columns: 1fr !important;
  }

  .legal-section h2 {
    font-size: 16px;
    flex-wrap: wrap;
  }

  .kvkk-form .legal-card {
    padding: 16px !important;
  }

  .kvkk-field input,
  .kvkk-field select,
  .kvkk-field textarea {
    font-size: 16px; /* iOS zoom önleme */
  }
}

/* ——— Public ayarlar modalı ——— */
@media (max-width: 640px) {
  .pub-settings-panel {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }

  .pub-settings-overlay {
    padding: 0 !important;
  }

  .pub-color-grid,
  .pub-settings-options.pub-color-options {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .pub-settings-option {
    min-height: var(--zytek-touch-min);
  }
}

/* ——— Admin / müşteri paneli ——— */
@media (max-width: 900px) {
  .adm-topbar {
    padding-left: max(12px, env(safe-area-inset-left)) !important;
    padding-right: max(12px, env(safe-area-inset-right)) !important;
    gap: 6px !important;
  }

  .adm-topbar-right {
    flex-shrink: 1;
    min-width: 0;
    gap: 4px !important;
  }

  .adm-status-pill {
    display: none !important;
  }

  .adm-user-meta {
    display: none !important;
  }

  .adm-breadcrumb {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 42vw;
  }

  .adm-page-hero {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }

  .adm-page-hero h1 {
    font-size: clamp(1.25rem, 5vw, 1.75rem) !important;
  }

  .adm-main {
    padding-bottom: calc(24px + var(--zytek-safe-bottom)) !important;
  }

  .adm-table {
    font-size: 12px;
  }

  .adm-table th,
  .adm-table td {
    padding: 8px 6px !important;
  }

  .sb-wrap,
  .cust-main {
    padding-left: max(12px, env(safe-area-inset-left)) !important;
    padding-right: max(12px, env(safe-area-inset-right)) !important;
  }

  .sb-wrap .max-w-3xl {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

@media (max-width: 520px) {
  .adm-page-hero .adm-btn,
  .adm-flash + .adm-card form {
    width: 100%;
  }

  .adm-page-hero > div:last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .adm-page-hero .adm-btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}
