* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1c1c1c;
  --surface-3: #242424;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --text-muted: #888;
  --accent: #ff6b35;
  --accent-glow: rgba(255, 107, 53, 0.15);
  --green: #34d399;
  --blue: #60a5fa;
  --purple: #a78bfa;
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, #0f0f0f 0%, #1a1207 50%, #0f0f0f 100%);
  border-bottom: 1px solid var(--border);
  padding: 4rem 1.5rem 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(255,107,53,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content { position: relative; max-width: 700px; margin: 0 auto; }

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  background: var(--accent-glow);
  border: 1px solid rgba(255,107,53,0.3);
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff 0%, #ff6b35 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.75rem;
}

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

.hero-sub a { color: var(--accent); text-decoration: none; }
.hero-sub a:hover { text-decoration: underline; }

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
}

.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat-num { font-size: 1.5rem; font-weight: 800; color: #fff; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Controls */
.controls {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
}

.controls-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

#search {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

#search:focus { border-color: var(--accent); }
#search::placeholder { color: var(--text-muted); }

.filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-group { display: flex; flex-direction: column; gap: 2px; }
.filter-group label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.filter-group select {
  padding: 8px 28px 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='m4.427 6.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 6H4.604a.25.25 0 0 0-.177.427z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.2s;
}

.filter-group select:focus { border-color: var(--accent); }

.results-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: auto;
}

.results-count span { color: var(--accent); font-weight: 700; }

/* Grid */
.grid-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: rgba(255,107,53,0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,107,53,0.1);
}

.card-rank {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 0 var(--radius) 0 var(--radius-sm);
}

.card-rank.top-10 {
  background: var(--accent);
  color: #fff;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  padding-right: 2.5rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-macros {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.macro-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.macro-cal {
  background: rgba(255,107,53,0.12);
  color: var(--accent);
}

.macro-prot {
  background: rgba(52,211,153,0.12);
  color: var(--green);
}

.macro-meal {
  background: rgba(167,139,250,0.12);
  color: var(--purple);
}

.macro-time {
  background: rgba(96,165,250,0.12);
  color: var(--blue);
}

.card-ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 0.75rem;
}

.ing-tag {
  padding: 2px 8px;
  background: var(--surface-3);
  border-radius: 4px;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.card-likes {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card-likes svg { width: 14px; height: 14px; }

.card-views {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-date {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* No Results */
.no-results {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

.no-results svg { margin-bottom: 1rem; color: var(--text-muted); }

.no-results button {
  margin-top: 1rem;
  padding: 8px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--surface-3);
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover { background: var(--border); color: #fff; }

.modal-header { margin-bottom: 1.25rem; }

.modal-rank {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal h2 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-top: 4px;
  line-height: 1.3;
}

.modal-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.modal-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.ms-icon { font-size: 1rem; }

.modal-section { margin-bottom: 1.5rem; }

.modal-section h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.meal-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.meal-tags span {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: capitalize;
}

.meal-tag-breakfast { background: rgba(251,191,36,0.15); color: #fbbf24; }
.meal-tag-lunch { background: rgba(52,211,153,0.15); color: var(--green); }
.meal-tag-dinner { background: rgba(96,165,250,0.15); color: var(--blue); }
.meal-tag-snack { background: rgba(167,139,250,0.15); color: var(--purple); }

.ingredient-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.ingredient-tags span {
  padding: 5px 12px;
  background: var(--surface-3);
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text);
}

.transcript-text {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-muted);
  max-height: 200px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.transcript-text::-webkit-scrollbar { width: 4px; }
.transcript-text::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.modal-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: #ff0000;
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.modal-cta:hover { background: #cc0000; }
.modal-cta svg { flex-shrink: 0; }

/* Footer */
footer {
  text-align: center;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

footer a { color: var(--accent); text-decoration: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }

/* Responsive */
@media (max-width: 768px) {
  .hero { padding: 2.5rem 1rem 2rem; }
  .hero-stats { gap: 1.5rem; }
  .controls-inner { flex-direction: column; align-items: stretch; }
  .filters { flex-wrap: wrap; }
  .recipe-grid { grid-template-columns: 1fr; }
  .results-count { margin-left: 0; }
  .modal { padding: 1.5rem; margin: 0.5rem; }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card { animation: fadeIn 0.3s ease both; }
.card:nth-child(n+4) { animation-delay: 0.05s; }
.card:nth-child(n+7) { animation-delay: 0.1s; }
.card:nth-child(n+10) { animation-delay: 0.15s; }
