/* ─── TOKENS & VARIABLES ─── */
:root {
  /* Colors matched with main Runa Nova brand */
  --green:       #1A4A35;
  --green-light: #266040;
  --green-dark:  #0F2D20;
  --green-pale:  #E6EFEA;
  
  --rust:        #8B3520;
  --rust-light:  #A8401A;
  --rust-pale:   #F5EAE6;
  
  --gold:        #D4A83C;
  --gold-light:  #F7D070;
  
  --cream:       #FBF8F3;
  --cream-dark:  #F5EFEB;
  --white:       #FFFFFF;
  
  --ink:         #1A1A1A;
  --ink-soft:    #4A4A4A;
  --ink-muted:   #8A8A8A;
  --border-light: rgba(0, 0, 0, 0.08);
  --glass-bg:    rgba(251, 248, 243, 0.85);

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Montserrat', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing & Borders */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 32px;
  
  /* Animations */
  --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-fast: 0.2s var(--ease-smooth);
  --transition-normal: 0.3s var(--ease-smooth);
}

/* Dark Mode Tokens */
@media (prefers-color-scheme: dark) {
  :root {
    --cream:       #0F1E16; /* Deep dark forest */
    --cream-dark:  #08120D;
    --white:       #172C21; /* Card backgrounds */
    --ink:         #FAF9F6; /* Soft off-white */
    --ink-soft:    #D5DCD8;
    --ink-muted:   #7A8C83;
    --border-light: rgba(255, 255, 255, 0.08);
    --glass-bg:    rgba(15, 30, 22, 0.85);
  }
}

/* ─── RESET & MOBILE SETUP ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent; /* Disable default tap blue highlight in mobile */
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  overflow-x: hidden;
  padding-bottom: 60px; /* Safe area for mobile navigation / drawers */
  transition: background-color var(--transition-normal);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button, input {
  font-family: inherit;
  color: inherit;
}

/* ─── LOADER ─── */
.loader-overlay {
  position: fixed;
  inset: 0;
  background: var(--cream-dark);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-light);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}
.loader-text {
  font-family: var(--font-display);
  letter-spacing: 0.2em;
  font-size: 14px;
  color: var(--green);
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── APP HEADER ─── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  transition: background-color var(--transition-normal);
}
.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  max-width: 600px;
  margin: 0 auto;
}
.header-logo img {
  height: 32px;
  width: auto;
  border-radius: 4px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.05));
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-lang {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: 30px;
  width: 32px;
  height: 32px;
  transition: all var(--transition-fast);
}
.btn-lang:active {
  background: var(--ink);
  color: var(--cream);
}

/* ─── YASAL UYARI BANTI ─── */
.legal-notice-ribbon {
  background: var(--green-pale);
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  padding: 6px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: center;
  align-items: center;
}
@media (prefers-color-scheme: dark) {
  .legal-notice-ribbon {
    background: rgba(38, 96, 64, 0.2);
    color: var(--green-pale);
  }
}
.ribbon-content {
  max-width: 600px;
  line-height: 1.3;
}

/* ─── MENU HERO ─── */
.menu-hero {
  position: relative;
  padding: 36px 16px;
  background: linear-gradient(135deg, var(--green-dark), var(--green-light));
  color: var(--white);
  text-align: center;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 80% 20%, rgba(212, 168, 60, 0.15) 0%, transparent 60%);
  pointer-events: none;
}
.hero-content {
  position: relative;
  z-index: 2;
}
.hero-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.hero-tagline {
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.1em;
  opacity: 0.85;
}

/* ─── STICKY CONTROLS (SEARCH & CATEGORIES) ─── */
.sticky-controls {
  position: sticky;
  top: 57px; /* Heights of Header */
  z-index: 80;
  background: var(--cream);
  border-bottom: 1px solid var(--border-light);
  padding-top: 12px;
  transition: background-color var(--transition-normal);
}
.search-filter-row {
  display: flex;
  gap: 8px;
  padding: 0 16px 10px;
  max-width: 600px;
  margin: 0 auto;
}
.search-box {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
  color: var(--ink-muted);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  background: var(--cream-dark);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 14px 10px 38px;
  font-size: 14px;
  transition: all var(--transition-fast);
}
.search-box input:focus {
  background: var(--white);
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(26, 74, 53, 0.15);
}
.btn-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--cream-dark);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-filter:active, .btn-filter.active {
  background: var(--green);
  color: var(--white);
  border-color: var(--green);
}
.filter-icon {
  width: 14px;
  height: 14px;
}
.filters-badge {
  background: var(--rust);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Categories Nav */
.categories-nav {
  max-width: 600px;
  margin: 0 auto;
}
.categories-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 16px 12px;
  scrollbar-width: none; /* Hide scrollbar Firefox */
}
.categories-container::-webkit-scrollbar {
  display: none; /* Hide scrollbar Webkit */
}
.category-tab {
  white-space: nowrap;
  background: none;
  border: 1px solid transparent;
  border-radius: 30px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.category-tab:active {
  background: var(--cream-dark);
}
.category-tab.active {
  background: var(--green-pale);
  color: var(--green-dark);
  border-color: rgba(26, 74, 53, 0.12);
}
@media (prefers-color-scheme: dark) {
  .category-tab.active {
    background: var(--green);
    color: var(--white);
  }
}

/* ─── MAIN MENU CONTAINER ─── */
.menu-main {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

/* Filter Chips Row */
.filter-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.filter-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--border-light);
  border-radius: 30px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
}
.filter-chip-remove {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--ink-muted);
  cursor: pointer;
  line-height: 1;
}

/* Category Sections */
.category-section {
  margin-bottom: 28px;
  scroll-margin-top: 130px; /* Offset for sticky header/categories */
}
.category-section-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--green);
  border-bottom: 1.5px solid var(--border-light);
  padding-bottom: 8px;
  margin-bottom: 14px;
}
@media (prefers-color-scheme: dark) {
  .category-section-title {
    color: var(--gold);
  }
}

/* ─── MENU ITEM CARD (LIST-VIEW) ─── */
.menu-item-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.01);
  cursor: pointer;
  position: relative;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.menu-item-card:active {
  transform: scale(0.985);
  background: var(--cream-dark);
}

.item-main-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}
.item-title-wrap {
  flex: 1;
}
.item-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
  margin-bottom: 4px;
}
.item-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--green-light);
  white-space: nowrap;
}
@media (prefers-color-scheme: dark) {
  .item-price {
    color: var(--gold-light);
  }
}

/* Badges (Calories & Diet) */
.item-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}
.badge-calorie {
  background: var(--cream-dark);
  color: var(--ink-soft);
  font-weight: 500;
}
.badge-diet {
  background: var(--green-pale);
  color: var(--green-dark);
}
@media (prefers-color-scheme: dark) {
  .badge-diet {
    background: rgba(38, 96, 64, 0.3);
    color: var(--green-pale);
  }
}

/* Description */
.item-description {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.4;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Truncate after 2 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Footer / Allergens row */
.item-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
  margin-top: auto;
}
.item-allergens-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}
.allergen-badge {
  font-size: 9px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Allergen-specific styling */
.allergen-gluten { background: #EEDD82; color: #5D4037; }
.allergen-sut { background: #BBDEFB; color: #0D47A1; }
.allergen-yumurta { background: #FFE082; color: #E65100; }
.allergen-soya { background: #C8E6C9; color: #1B5E20; }
.allergen-sulfit { background: #D1C4E9; color: #4A148C; }
.allergen-yerfistik { background: #FFE0B2; color: #E65100; }
.allergen-ceviz { background: #D7CCC8; color: #3E2723; }
.allergen-balik { background: #B2DFDB; color: #004D40; }
.allergen-kabuklu { background: #FFCDD2; color: #B71C1C; }
.allergen-yumusakca { background: #CFD8DC; color: #263238; }
.allergen-kereviz { background: #E8F5E9; color: #2E7D32; }
.allergen-hardal { background: #FFF9C4; color: #F57F17; }
.allergen-susam { background: #ECEFF1; color: #37474F; }
.allergen-acibakla { background: #F1F8E9; color: #33691E; }

.item-more-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 2px;
}

/* ─── MODALS (BOTTOM DRAWER) ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-drawer {
  width: 100%;
  max-width: 600px;
  background: var(--cream);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.open .modal-drawer {
  transform: translateY(0);
}

.modal-drag-indicator {
  width: 40px;
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  margin: 10px auto 4px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--green);
}
@media (prefers-color-scheme: dark) {
  .modal-header h3 {
    color: var(--gold);
  }
}
.btn-close-modal {
  background: var(--cream-dark);
  border: none;
  border-radius: 50%;
  font-size: 20px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-soft);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--cream-dark);
}
.btn-clear-modal {
  flex: 1;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-apply-modal {
  flex: 2;
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(26, 74, 53, 0.2);
}
.btn-apply-modal:active {
  transform: scale(0.98);
}

/* Filter Specific Layout */
.filter-section {
  margin-bottom: 24px;
}
.filter-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}
.filter-section-desc {
  font-size: 11px;
  color: var(--ink-muted);
  margin-bottom: 12px;
}
.filter-checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-chip-checkbox {
  cursor: pointer;
}
.filter-chip-checkbox input {
  display: none;
}
.filter-chip-checkbox span {
  display: inline-block;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 30px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: all var(--transition-fast);
}
.filter-chip-checkbox input:checked + span {
  background: var(--green-pale);
  color: var(--green-dark);
  border-color: var(--green);
}
@media (prefers-color-scheme: dark) {
  .filter-chip-checkbox input:checked + span {
    background: var(--green);
    color: var(--white);
    border-color: var(--green);
  }
}

/* Detail Specific Layout */
.detail-modal-footer {
  justify-content: space-between;
  align-items: center;
}
.detail-price-wrap {
  display: flex;
  flex-direction: column;
}
.detail-price-label {
  font-size: 10px;
  color: var(--ink-muted);
}
.detail-price-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--green);
}
@media (prefers-color-scheme: dark) {
  .detail-price-val {
    color: var(--gold-light);
  }
}
.detail-desc {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 20px;
}
.detail-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.detail-meta-box {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px;
}
.meta-box-label {
  font-size: 10px;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.meta-box-val {
  font-size: 14px;
  font-weight: 700;
}
.detail-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.detail-ingredients {
  list-style: none;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
}
.detail-ingredients li {
  font-size: 13px;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-ingredients li::before {
  content: "•";
  color: var(--green);
  font-size: 18px;
}
.detail-allergens {
  background: rgba(139, 53, 32, 0.05);
  border: 1px solid rgba(139, 53, 32, 0.15);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 20px;
}
.detail-allergens-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--rust);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.detail-allergens-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ─── FOOTER ─── */
.menu-footer {
  background: var(--cream-dark);
  border-top: 1px solid var(--border-light);
  padding: 32px 16px;
  margin-top: 40px;
  transition: background-color var(--transition-normal);
}
.allergen-legend {
  margin-bottom: 24px;
}
.legend-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--green);
}
@media (prefers-color-scheme: dark) {
  .legend-title {
    color: var(--gold);
  }
}
.legend-desc {
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.allergen-icons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.allergen-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-soft);
}
.footer-divider {
  height: 1px;
  background: var(--border-light);
  margin: 20px 0;
}
.footer-bottom {
  text-align: center;
}
.footer-copy {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}
.footer-legal {
  font-size: 9px;
  color: var(--ink-muted);
  line-height: 1.4;
}

/* Empty State & Errors */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--ink-muted);
}
.empty-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}
.empty-state h3 {
  font-size: 16px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.empty-state p {
  font-size: 13px;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.animate-fade-in {
  animation: fadeInUp 0.4s var(--ease-smooth) forwards;
}
