/*
 * ============================================================
 *  assets/css/style.css
 *  QR Menü & Yönetici Paneli — Özel Stil Dosyası
 *  Tailwind CDN'in üzerine eklenen özel kurallar burada tutulur.
 *  Tailwind yapılandırması HTML dosyasındaki <script> içindedir.
 * ============================================================
 */

/* ----------------------------------------------------------
   1. CSS Özel Değişkenleri (Custom Properties)
   Renk paleti ve genel değerler tek yerden yönetilir.
   ---------------------------------------------------------- */
:root {
  --color-primary:           #be0017;
  --color-primary-dark:      #93000f;
  --color-primary-container: #e62129;
  --color-surface:           #f9f9fb;
  --color-surface-high:      #e8e8ea;
  --color-surface-highest:   #e2e2e4;
  --color-on-surface:        #1a1c1d;
  --color-on-surface-var:    #5d3f3c;
  --color-outline-var:       #e7bdb8;
  --color-white:             #ffffff;
  --color-error:             #ba1a1a;
  --color-tertiary:          #00648d;

  --font-headline: 'Manrope', sans-serif;
  --font-body:     'Inter', sans-serif;

  --radius-xl: 0.75rem;  /* 12px */
  --radius-2xl: 1rem;    /* 16px */
  --radius-full: 9999px;

  /* Mobil Bottom Nav yüksekliği — layout atlamasını önler */
  --bottom-nav-height: 72px;
  /* Sticky header yüksekliği */
  --header-height: 68px;
}

/* ----------------------------------------------------------
   2. Temel Reset ve Body
   ---------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-surface);
  color: var(--color-on-surface);
  /* Minimum yükseklik — içerik az olduğunda bile boş alan oluşmaz */
  min-height: 100dvh;
  overscroll-behavior-y: contain;
}

/* ----------------------------------------------------------
   3. Scrollbar Gizleme (Yatay Kategori Scrollu İçin)
   ---------------------------------------------------------- */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ----------------------------------------------------------
   4. Material Symbols Ayarı
   ---------------------------------------------------------- */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  /* İkon hizalamasını düzeltir — inline metinle taşma önlenir */
  vertical-align: middle;
  line-height: 1;
}

/* ----------------------------------------------------------
   5. Tipografi Yardımcı Sınıfları
   ---------------------------------------------------------- */
.font-headline { font-family: var(--font-headline); }
.font-body     { font-family: var(--font-body); }

/* ----------------------------------------------------------
   6. LAYOUT SHIFT ÖNLEYİCİLER
   Dil değiştiğinde veya içerik güncellendiğinde
   navbar, butonlar yerinden oynamamalıdır.
   ---------------------------------------------------------- */

/* Sabit yükseklikli header — içerik değişse de yükseklik sabit kalır */
.site-header {
  height: var(--header-height);
  min-height: var(--header-height);
  display: flex;
  align-items: center;
}

/* Dil butonu — metin uzunluğu değişse bile genişlik sabit */
.lang-btn {
  min-width: 100px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
}

/* Kategori butonları — sabit yükseklik, içerik kayması yok */
.cat-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Ürün kartı görsel alanı — yükleme öncesi boşluk tutar */
.product-img-wrapper {
  position: relative;
  /* Görsel yüklenene kadar yer ayır (4:3 oran) */
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background-color: var(--color-surface-high);
}

.product-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.product-img-wrapper:hover img {
  transform: scale(1.03);
}

/* ----------------------------------------------------------
   7. ARAPÇA (RTL) DESTEĞI
   dir="rtl" uygulandığında sadece METİN yönü değişir.
   Ana iskelet (navbar ikon yerleri, buton konumları) bozulmaz.
   ---------------------------------------------------------- */
[dir="rtl"] {
  /* Temel metin hizalaması sağdan sola */
  text-align: right;
}

/* RTL'de flex satırları ters döner — ancak bu header'ı bozabilir.
   Header'ı RTL'den muaf tut (tasarım değişmemeli) */
[dir="rtl"] .site-header,
[dir="rtl"] .admin-header {
  flex-direction: row; /* Ters çevirme — orijinal düzen korunur */
}

/* RTL'de dil butonu sağda kalmalı */
[dir="rtl"] .lang-btn {
  margin-left: 0;
  margin-right: auto;
}

/* RTL'de yatay kategori scroll soldan değil sağdan başlar */
[dir="rtl"] .cat-scroll {
  direction: rtl;
}

/* RTL'de arama ikonunun yeri — sağ tarafa geçer */
[dir="rtl"] .search-icon-left {
  left: auto;
  right: 1rem;
}
[dir="rtl"] .search-input-padded {
  padding-left: 1rem;
  padding-right: 3rem;
}

/* RTL'de ürün kartı metin hizalaması */
[dir="rtl"] .product-text {
  text-align: right;
}
[dir="rtl"] .product-price {
  text-align: left; /* Fiyat solda kalır (tipik RTL kafe tasarımı) */
}

/* ----------------------------------------------------------
   8. Mobil Bottom Navigation
   ---------------------------------------------------------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--color-outline-var);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
}

/* Mobil'de içeriğin bottom nav altında kalmaması için padding */
.mobile-content-pad {
  padding-bottom: calc(var(--bottom-nav-height) + 1rem);
}

/* ----------------------------------------------------------
   9. Toggle Switch (Aktif/Pasif)
   Admin panelindeki ürün aktiflik toggle'ı
   ---------------------------------------------------------- */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  gap: 8px;
}

.toggle-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  width: 36px;
  height: 20px;
  background-color: #d1d5db; /* Gri — pasif durumu */
  border-radius: var(--radius-full);
  transition: background-color 0.25s ease;
  position: relative;
  flex-shrink: 0;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Checkbox işaretlendiğinde toggle aktif (kırmızı) */
.toggle-switch input:checked + .toggle-track {
  background-color: var(--color-primary);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(16px);
}

/* Focus halkası — erişilebilirlik */
.toggle-switch input:focus-visible + .toggle-track {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ----------------------------------------------------------
   10. Sayfalama (Pagination) Stilleri
   ---------------------------------------------------------- */
.pagination-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--color-surface-high);
  background: transparent;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
  font-size: 0.875rem;
  font-weight: 500;
}

.pagination-btn:hover:not(:disabled) {
  background-color: var(--color-surface);
  color: var(--color-on-surface);
}

.pagination-btn.active {
  background-color: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ----------------------------------------------------------
   11. Dil Seçici Dropdown
   ---------------------------------------------------------- */
.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  border: 1px solid var(--color-outline-var);
  z-index: 100;
  overflow: hidden;
  /* Başlangıçta gizli */
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.lang-dropdown.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.1s;
}

.lang-option:hover {
  background-color: var(--color-surface);
}

.lang-option.active {
  color: var(--color-primary);
  background-color: #fef2f2;
}

.lang-flag {
  font-size: 1.2em;
  line-height: 1;
}

/* ----------------------------------------------------------
   12. Ürün Kartı Rozeti (Badge)
   ---------------------------------------------------------- */
.product-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.4;
}

.badge-discount    { background: var(--color-primary); color: white; }
.badge-chef        { background: rgba(0,0,0,0.65); color: white; }
.badge-daily       { background: #d97706; color: white; }
.badge-popular     { background: var(--color-tertiary); color: white; }
.badge-vip         { background: linear-gradient(135deg, #7c3aed, #4f46e5); color: white; }

/* ----------------------------------------------------------
   13. Masaüstü Sol Sidebar Kategori Menüsü
   ---------------------------------------------------------- */
.desktop-sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100dvh - var(--header-height));
  overflow-y: auto;
  padding: 1.5rem 1rem;
}

.sidebar-cat-btn {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--radius-xl);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  border: none;
  background: transparent;
  color: var(--color-on-surface-var);
}

.sidebar-cat-btn:hover {
  background-color: var(--color-surface-high);
  color: var(--color-on-surface);
}

.sidebar-cat-btn.active {
  background-color: #fef2f2;
  color: var(--color-primary);
  font-weight: 700;
}

/* RTL'de sidebar metin sağa hizalanır */
[dir="rtl"] .sidebar-cat-btn {
  text-align: right;
  flex-direction: row-reverse;
}

/* ----------------------------------------------------------
   14. Admin Paneli Genel Düzen
   ---------------------------------------------------------- */
.admin-sidebar {
  width: 256px; /* 16rem */
  flex-shrink: 0;
}

/* ----------------------------------------------------------
   15. Animasyonlar
   ---------------------------------------------------------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.35s ease forwards;
}

/* Yükleme iskeleti (skeleton loader) */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-surface-high) 25%,
    var(--color-surface-highest) 50%,
    var(--color-surface-high) 75%
  );
  background-size: 400px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius-xl);
}

/* ----------------------------------------------------------
   16. Modal / Overlay
   ---------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: white;
  border-radius: var(--radius-2xl);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.2);
  transform: translateY(16px);
  transition: transform 0.25s;
}

.modal-overlay.open .modal-box {
  transform: translateY(0);
}

/* ----------------------------------------------------------
   17. Admin Giriş Ekranı — Dekoratif Arkaplan
   ---------------------------------------------------------- */
.login-bg-pattern {
  position: fixed;
  inset: 0;
  /* Geometrik ince nokta deseni */
  background-image: radial-gradient(circle, var(--color-outline-var) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

.login-card {
  position: relative;
  z-index: 1;
  background: white;
  border-radius: var(--radius-2xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.1), 0 0 0 1px var(--color-outline-var);
}

/* ----------------------------------------------------------
   18. Tablo Satırı Hover
   ---------------------------------------------------------- */
.data-table tbody tr {
  transition: background-color 0.1s;
}

.data-table tbody tr:hover {
  background-color: var(--color-surface);
}

/* ----------------------------------------------------------
   19. Responsive Yardımcılar
   ---------------------------------------------------------- */

/* 700px altı: mobil görünüm */
@media (max-width: 699px) {
  .desktop-only { display: none !important; }
  .mobile-bottom-pad { padding-bottom: calc(var(--bottom-nav-height) + 0.5rem); }
  /* Mobilde ürün görselleri gösterilmez */
  .product-img-wrapper { display: none !important; }
}

/* 700px üstü: masaüstü görünüm */
@media (min-width: 700px) {
  .mobile-only { display: none !important; }
}

/* ----------------------------------------------------------
   20. Karanlık Mod (Dark Mode) — Hazırlık Sınıfları
   Tailwind dark: önekleri HTML'de kullanılır.
   Burada sadece ek özel düzeltmeler var.
   ---------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  /* Otomatik dark mod tercih edilmez; class-based dark kullanıyoruz */
}

.dark .login-card {
  background: #1e1f20;
  border: 1px solid rgba(255,255,255,0.08);
}

.dark .lang-dropdown {
  background: #2f3132;
  border-color: rgba(255,255,255,0.1);
}

.dark .lang-option:hover {
  background-color: rgba(255,255,255,0.06);
}

/* ----------------------------------------------------------
   21. Baskı Stili (Print) — Opsiyonel
   ---------------------------------------------------------- */
@media print {
  .bottom-nav,
  .site-header,
  .lang-btn,
  .admin-sidebar { display: none !important; }
  body { background: white; }
}


/* ===========================================================
   RESPONSIVE ÜRÜN LAYOUT  v3.1
   ≤999px  → Kompakt liste (fotoğraf yok)
   ≥1000px → 2-3 sütun grid + fotoğraflı kart
   =========================================================== */

/* ── Ürün listesi sarmalayıcı ── */
.product-list-wrap {
  display: flex;
  flex-direction: column;
}

/* ── Her kart ── */
.product-card-wrap {
  display: block;
}

/* ── Kompakt satır (liste modu) ── */
.product-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #efeff1;
}
.product-card-wrap:last-child .product-row {
  border-bottom: none;
}
.product-row-text  { flex: 1; min-width: 0; }
.product-row-price { flex-shrink: 0; text-align: right; }

/* ── Satır-içi rozet (fotoğrafsız modda gösterilir) ── */
.inline-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.4;
}

/* ── Kategori bölüm ayırıcı çizgi ── */
.cat-section-divider {
  border: none;
  border-top: 1.5px solid #e8e8ea;
  margin: 0 0 1rem 0;
  display: block;
}

/* ── ≤999px: liste görünümü, fotoğraf yok ── */
@media (max-width: 999px) {
  .product-img-wrapper    { display: none !important; }
  .product-list-wrap      { gap: 0; }
  .hide-on-desktop        { display: inline-flex; }
}

/* ── ≥1000px: grid + fotoğraflı kart ── */
@media (min-width: 1000px) {
  .product-list-wrap {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    flex-direction: unset;
  }
  .product-card-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
  }
  .product-row {
    flex-direction: column;
    border-bottom: none;
    padding: 0;
    gap: 5px;
  }
  .product-row-price { text-align: left; }
  .hide-on-desktop   { display: none; }
}

@media (min-width: 1280px) {
  .product-list-wrap { grid-template-columns: repeat(3, 1fr); }
}

/* ✅ DÜZELTME: Mobil header - Logo ortada, dil sağda */
@media (max-width: 699px) {
  :root            { --header-height: 68px; }
  .site-header     { height: auto; min-height: var(--header-height); }
  
  /* Mobil header düzeni */
  .mobile-header-inner {
    position: relative;
    min-height: 68px;
  }
  
  .mobile-logo-wrapper {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
  }
  
  .mobile-lang-wrap {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
  }
}

/* ✅ DÜZELTME: Ürün içeriğinin bottom-nav ile çakışmaması - artırıldı */
.products-pad {
  padding-bottom: calc(var(--bottom-nav-height, 72px) + 40px);
}

/* ── Mobil: fotoğraflar yok (700px altı da kapsıyoruz) ── */
@media (max-width: 699px) {
  .product-img-wrapper { display: none !important; }
}
