/* ==========================================================================
   Gourmet & Papilles - Design System & Modern CSS Core
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,500;0,700;1,400&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Palette */
  --primary: #E65100;
  --primary-hover: #F57C00;
  --primary-light: rgba(230, 81, 0, 0.12);
  --secondary: #2E7D32;
  --secondary-hover: #388E3C;
  --secondary-light: rgba(46, 125, 50, 0.12);
  --accent: #FFB300;

  /* Theme - Dark Mode Default */
  --bg-main: #0F0F17;
  --bg-card: rgba(26, 26, 38, 0.75);
  --bg-card-hover: rgba(36, 36, 52, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(230, 81, 0, 0.4);
  
  --text-main: #F3F4F6;
  --text-muted: #9CA3AF;
  --text-inverse: #111827;

  /* Typography */
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;

  /* Shadows & Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(230, 81, 0, 0.25);

  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-main: #FDFBF7;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8F6F0;
  --bg-glass: rgba(0, 0, 0, 0.03);
  --border-color: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(230, 81, 0, 0.5);
  
  --text-main: #1F2937;
  --text-muted: #6B7280;
  --text-inverse: #FFFFFF;

  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 20px rgba(230, 81, 0, 0.15);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-smooth), color var(--transition-smooth);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  outline: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: 1rem;
}

/* Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header & Navigation */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-main);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  transition: all var(--transition-fast);
}

.navbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
}

.brand-icon {
  font-size: 1.8rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand span {
  color: var(--primary);
}

.nav-links {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-glass);
  padding: 0.35rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.nav-btn {
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-glow);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #D84315);
  color: #FFFFFF;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-glow);
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(230, 81, 0, 0.4);
}

/* Hero Banner */
.hero {
  padding: 3.5rem 0 2.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1.2rem;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 1.2rem;
  border: 1px solid rgba(230, 81, 0, 0.2);
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 3.2rem;
  line-height: 1.15;
  margin-bottom: 1rem;
  font-weight: 700;
}

.hero-title span {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  max-width: 650px;
  margin: 0 auto 2rem;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* View Sections */
.tab-view {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.tab-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Controls Bar (Search & Categories) */
.controls-bar {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-bottom: 2.5rem;
  background: var(--bg-card);
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.search-wrapper {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 0.9rem 1.2rem 0.9rem 3rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-main);
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  outline: none;
}

.search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
}

.filter-pills {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.pill-btn {
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-glass);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.pill-btn:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

.pill-btn.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.8rem;
  margin-bottom: 4rem;
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 750px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  position: relative;
  transform: scale(0.95);
  transition: transform var(--transition-fast);
}

.modal-overlay.active .modal-container {
  transform: scale(1);
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg-main);
  z-index: 10;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
}

.btn-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all var(--transition-fast);
}

.btn-close:hover {
  background: #EF4444;
  color: #FFFFFF;
  border-color: #EF4444;
}

.modal-body {
  padding: 2rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--primary);
  color: var(--text-main);
  padding: 0.9rem 1.4rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  animation: slideInRight 0.3s ease forwards;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Form Controls */
.form-group {
  margin-bottom: 1.4rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: var(--shadow-glow);
}

.form-help { display:block; margin-top:0.45rem; color:var(--text-muted); font-size:0.8rem; }
.ingredients-form-list { display:flex; flex-direction:column; gap:0.6rem; }
.ingredient-form-row { display:grid; grid-template-columns:minmax(0, 1fr) 90px 150px 42px; gap:0.55rem; align-items:center; }
.ingredient-form-row .form-input, .ingredient-form-row .form-select { padding:0.65rem 0.75rem; }
.ingredient-remove { width:42px; height:42px; color:#ef4444; border-color:rgba(239,68,68,.35); }
.ingredient-add { margin-top:0.75rem; font-size:0.85rem; }
.ingredient-amount:disabled { opacity:.55; cursor:not-allowed; }
.btn-like { background:transparent; border:1px solid var(--border-color); color:var(--text-muted); border-radius:var(--radius-full); padding:.4rem .65rem; cursor:pointer; font-weight:600; }
.btn-like:hover, .btn-like.liked { color:#ef4444; border-color:rgba(239,68,68,.5); background:rgba(239,68,68,.08); }
.recipe-rank { color:var(--accent); font-size:.8rem; font-weight:700; margin-left:auto; }
@media (max-width: 560px) { .ingredient-form-row { grid-template-columns:minmax(0, 1fr) 72px 42px; } .ingredient-form-row .ingredient-unit { grid-column:1 / 3; } }
.nav-btn[data-tab="ideas"], #tab-ideas { display: none !important; }
.captcha-box { padding:0.9rem; border:1px solid var(--border-color); border-radius:var(--radius-md); background:var(--bg-glass); }
.captcha-row { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:0.65rem; font-weight:600; }
.captcha-refresh { min-width:2.2rem; min-height:2.2rem; }

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.2rem;
  }
  .navbar-content {
    flex-wrap: wrap;
    gap: 1rem;
  }
  .nav-links {
    order: 3;
    width: 100%;
    justify-content: space-around;
  }
  .cards-grid {
    grid-template-columns: 1fr;
  }
}
