:root {
  --bg: #0a0a0f;
  --bg-light: #12121a;
  --bg-card: #1a1a24;
  --text: #f5f5f7;
  --text-muted: #8b8b9e;
  --accent: #10b981;
  --accent-glow: rgba(16, 185, 129, 0.15);
  --accent-hover: #059669;
  --border: #2a2a3a;
  --error: #ef4444;
  --warning: #f59e0b;
  --font-display: 'Instrument Serif', serif;
  --font-body: 'Satoshi', -apple-system, sans-serif;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
}

.logo-icon {
  font-size: 1.75rem;
}

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

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-card);
}

.nav-link-primary {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

.nav-link-primary:hover {
  background: var(--accent-hover);
  color: var(--bg);
}

.user-email {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== HERO ===== */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem 6rem;
  align-items: center;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.hero-title .accent {
  color: var(--accent);
  font-style: italic;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.25rem;
  margin-bottom: 2rem;
  max-width: 480px;
}

.hero-cta {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hero-note {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.hero-visual {
  display: flex;
  justify-content: center;
}

.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  box-shadow: var(--shadow);
}

.hero-card-image {
  font-size: 4rem;
  background: var(--bg-light);
  padding: 1.5rem;
  border-radius: var(--radius);
}

.hero-card-arrow {
  font-size: 2rem;
  color: var(--accent);
}

.hero-card-result {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mini-meal {
  background: var(--bg-light);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

/* ===== BUTTONS ===== */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text);
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

.btn-full {
  width: 100%;
}

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

/* ===== MODAL ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
  z-index: 1;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 1.25rem;
}

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

.form-group input {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: var(--transition);
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-error {
  color: var(--error);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  min-height: 1.25rem;
}

.auth-switch {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  margin-left: 0.5rem;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* ===== APP SECTION ===== */
.app-section {
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.app-container {
  max-width: 800px;
  margin: 0 auto;
}

.step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.step-number {
  background: var(--accent);
  color: var(--bg);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.step-header h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
}

/* ===== UPLOAD ZONE ===== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.upload-zone:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.upload-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.preview-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius);
}

/* ===== CALORIE SELECTOR ===== */
.calorie-selector {
  margin-bottom: 2rem;
}

.calorie-presets {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.calorie-preset {
  padding: 1rem 1.5rem;
  background: var(--bg-light);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.calorie-preset span {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 2px;
}

.calorie-preset:hover {
  border-color: var(--accent);
}

.calorie-preset.active {
  background: var(--accent-glow);
  border-color: var(--accent);
}

.calorie-custom {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.calorie-custom label {
  color: var(--text-muted);
}

.calorie-custom input {
  width: 120px;
  padding: 0.75rem 1rem;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
}

.calorie-custom input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ===== RESULTS ===== */
.ingredients-section {
  margin-bottom: 2rem;
}

.ingredients-section h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.ingredients-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ingredient-tag {
  background: var(--bg-light);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  border: 1px solid var(--border);
}

.ingredient-tag.produce { border-color: #22c55e; }
.ingredient-tag.protein { border-color: #ef4444; }
.ingredient-tag.dairy { border-color: #3b82f6; }
.ingredient-tag.grain { border-color: #f59e0b; }

/* ===== MEAL PLAN ===== */
.meal-plan {
  margin-bottom: 2rem;
}

.day-card {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}

.day-header {
  background: var(--bg-card);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
}

.day-header:hover {
  background: var(--accent-glow);
}

.day-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.day-calories {
  color: var(--accent);
  font-weight: 600;
}

.day-meals {
  padding: 1rem 1.5rem;
  display: none;
}

.day-card.expanded .day-meals {
  display: block;
}

.meal-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.meal-item:last-child {
  border-bottom: none;
}

.meal-type {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.meal-name {
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
}

.meal-calories {
  color: var(--accent);
  font-size: 0.9rem;
}

.meal-ingredients {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.meal-instructions {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

/* ===== TIPS & SHOPPING ===== */
.tips-section,
.shopping-section {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.tips-section h3,
.shopping-section h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.tips-section ul,
.shopping-section ul {
  list-style: none;
}

.tips-section li,
.shopping-section li {
  padding: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
  color: var(--text-muted);
}

.tips-section li::before {
  content: '💡';
  position: absolute;
  left: 0;
}

.shopping-section li::before {
  content: '+';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

.results-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

/* ===== UPGRADE MODAL ===== */
.upgrade-content {
  text-align: center;
}

.upgrade-content h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.upgrade-desc {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.upgrade-features {
  list-style: none;
  text-align: left;
  background: var(--bg-light);
  padding: 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.upgrade-features li {
  padding: 0.5rem 0;
  color: var(--text);
}

.upgrade-price {
  margin-bottom: 1.5rem;
}

.upgrade-price .price {
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--accent);
}

.upgrade-price .period {
  color: var(--text-muted);
}

/* ===== HISTORY ===== */
.history-section {
  padding: 2rem;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.history-header h2 {
  font-family: var(--font-display);
  font-size: 2rem;
}

.history-list {
  display: grid;
  gap: 1rem;
}

.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  gap: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.history-item:hover {
  border-color: var(--accent);
}

.history-image {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius);
}

.history-info h3 {
  margin-bottom: 0.5rem;
}

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

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem 1rem 4rem;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .hero-visual {
    order: -1;
  }

  .header {
    padding: 1rem;
  }

  .calorie-presets {
    justify-content: center;
  }

  .history-item {
    flex-direction: column;
  }

  .history-image {
    width: 100%;
    height: 150px;
  }
}
