/**
 * SinemArsiv PWA Stilleri
 * Kurulum banner, bottom navigation, toast ve mobil optimizasyonları
 */

/* ─── PWA Kurulum Banner ─── */
#pwa-install-banner {
  position: fixed;
  bottom: -150px;
  left: 0;
  right: 0;
  z-index: 99999;
  padding: 10px 16px;
  transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
#pwa-install-banner.visible {
  bottom: 65px;
}
.pwa-install-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 18px;
  padding: 14px 18px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
}
.pwa-install-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.pwa-install-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
}
.pwa-install-left strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: #f1f5f9;
  white-space: nowrap;
}
.pwa-install-left span {
  font-size: 11px;
  color: #a5b4fc;
  font-weight: 500;
}
.pwa-install-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.pwa-install-btn {
  padding: 10px 18px;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.2s;
  white-space: nowrap;
}
.pwa-install-btn:hover { transform: scale(1.04); }
.pwa-dismiss-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}
.pwa-dismiss-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ─── PWA Toast Mesajları ─── */
.pwa-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  padding: 12px 24px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  z-index: 999999;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.pwa-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.pwa-toast-success {
  background: rgba(16, 185, 129, 0.95);
  color: #fff;
}
.pwa-toast-info {
  background: rgba(56, 189, 248, 0.95);
  color: #fff;
}

/* ─── Mobil Alt Navigasyon (PWA Mode) ─── */
.pwa-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9990;
  background: var(--kart-arka-plan, #1e293b);
  border-top: 1px solid var(--kenarlik, #334155);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(16px);
}

.pwa-bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 500px;
  margin: 0 auto;
}

.pwa-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  text-decoration: none;
  color: var(--yazi-ikincil, #94a3b8);
  font-size: 10px;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  position: relative;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.pwa-nav-item i {
  font-size: 20px;
  transition: transform 0.2s;
}
.pwa-nav-item.active {
  color: var(--ana-renk, #8b5cf6);
}
.pwa-nav-item.active i {
  transform: scale(1.1);
}
.pwa-nav-item:active i {
  transform: scale(0.9);
}

/* Badge (bildirim sayısı) */
.pwa-nav-badge {
  position: absolute;
  top: 0;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ─── KAPSAMLI MOBİL VE RESPONSIVE DÜZELTMELERİ ─── */
@media (max-width: 900px) {
  /* Panel Düzeni: Sidebar'ı sol çekmeceye dönüştür */
  .panel-sarmalayici {
    display: block !important;
    width: 100% !important;
    overflow-x: hidden !important;
  }

  .yan-menu {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    height: 100vh !important;
    z-index: 9999 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 20px 0 50px rgba(0,0,0,0.5) !important;
    overflow-y: auto !important;
  }

  .yan-menu.mobil-acik {
    transform: translateX(0) !important;
  }

  .mobil-sidebar-kapat {
    display: block !important;
  }

  .mobil-hamburger-btn,
  .mobil-hizli-arama-btn {
    display: inline-flex !important;
  }

  /* İçerik Alanı: Sol boşluğu kaldır, tam genişlik yap */
  .panel-icerik {
    margin-left: 0 !important;
    padding: 0 16px 20px 16px !important;
    width: 100% !important;
    min-width: 100% !important;
    overflow-x: hidden !important;
  }

  .panel-ust-bar {
    padding: 14px 0 !important;
    margin-bottom: 20px !important;
  }

  /* Alt Menü Barı Göster */
  .pwa-bottom-nav {
    display: block !important;
  }

  body {
    padding-bottom: 75px !important;
  }

  /* Sağ Alt Bildirim FAB butonunu yukarı kaydır (alt menüyle çakışmasın) */
  #notif-fab {
    bottom: 80px !important;
    right: 18px !important;
    width: 48px !important;
    height: 48px !important;
    font-size: 18px !important;
  }

  #notif-popup {
    bottom: 140px !important;
    right: 12px !important;
    left: 12px !important;
    width: auto !important;
    max-width: calc(100vw - 24px) !important;
  }

  /* Dashboard ve Kart Düzeltmeleri */
  .hero-slider {
    height: 220px !important;
    border-radius: 18px !important;
    margin-bottom: 25px !important;
  }

  .hero-content {
    left: 16px !important;
    right: 16px !important;
    bottom: 16px !important;
    max-width: 100% !important;
  }

  .hero-title {
    font-size: 20px !important;
    margin-bottom: 8px !important;
  }

  .hero-overview {
    display: none !important;
  }

  .hero-meta {
    font-size: 12px !important;
    gap: 12px !important;
    margin-bottom: 12px !important;
  }

  .hero-btn {
    padding: 8px 18px !important;
    font-size: 12px !important;
    border-radius: 10px !important;
  }

  /* Mini Stats */
  .mini-stats-bar {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    padding: 10px 14px !important;
    gap: 8px !important;
  }
  .stat-item {
    font-size: 11px !important;
    gap: 5px !important;
  }

  /* Film Kartları Mobilde Şık ve Kompakt */
  .movie-card-discovery {
    min-width: 130px !important;
    width: 130px !important;
  }
  .card-info h4 {
    font-size: 12px !important;
  }
  .card-info span {
    font-size: 11px !important;
  }

  /* Yatay Kaydırma (Horizontal scroll) */
  .horizontal-scroll {
    gap: 12px !important;
    padding-bottom: 10px !important;
  }

  /* Sub Nav Çubuğu */
  .discovery-sub-nav {
    margin-bottom: 25px !important;
  }
  .sub-nav-container {
    overflow-x: auto !important;
    white-space: nowrap !important;
    display: flex !important;
    gap: 8px !important;
    padding-bottom: 4px !important;
  }
  .sub-nav-item {
    font-size: 12px !important;
    padding: 8px 14px !important;
    white-space: nowrap !important;
  }

  /* Tablo ve Grid Taşmalarını Engelle */
  .admin-table, table {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
  }

  .admin-card-box {
    padding: 16px !important;
    border-radius: 14px !important;
  }

  /* Footer Minimal */
  .panel-minimal-footer {
    flex-direction: column !important;
    text-align: center !important;
    gap: 12px !important;
    padding: 20px 10px !important;
  }
}

/* Desktop'ta mobiller gizli */
@media (min-width: 901px) {
  .pwa-bottom-nav {
    display: none !important;
  }
  .mobil-hamburger-btn,
  .mobil-sidebar-kapat,
  .mobil-hizli-arama-btn,
  #mobil-sidebar-backdrop {
    display: none !important;
  }
}

/* ─── PWA Standalone Modunda Ekstra Optimizasyonlar ─── */
@media (display-mode: standalone) {
  body {
    padding-top: env(safe-area-inset-top, 0px);
  }
  * {
    -webkit-tap-highlight-color: transparent;
  }
}
