/* ============================================================================
   GuFood AI Pipeline - Stylesheet
   Modern, clean UI for recipe generation demo
   ============================================================================ */

/* CSS Variables */
:root {
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-light: #d1fae5;
  --secondary: #6366f1;
  --secondary-light: #e0e7ff;
  --accent: #f59e0b;
  --accent-light: #fef3c7;

  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-dark: #1e293b;

  --text: #1e293b;
  --text-light: #64748b;
  --text-muted: #94a3b8;

  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;

  --font:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

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

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

/* App Container */
.app {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

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

.logo h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}

.tagline {
  color: var(--text-light);
  font-size: 1rem;
}

/* Main Content */
.main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Input Section */
.input-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}

.tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.tab:hover {
  background: var(--border-light);
  color: var(--text);
}

.tab.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.tab-icon {
  font-size: 1.1rem;
}

/* Tab Content */
.tab-content {
  display: none;
}

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

/* Input Groups */
.input-group {
  margin-bottom: 1.25rem;
}

.input-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.input-group input,
.input-group textarea,
.input-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.input-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* URL Input Wrapper */
.url-input-wrapper {
  display: flex;
  gap: 0.5rem;
}

.url-input-wrapper input {
  flex: 1;
}

/* Extraction Result */
.extraction-result {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--primary-light);
  border-radius: var(--radius);
  border: 1px solid var(--primary);
}

.result-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 0.75rem;
}

.result-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.result-field label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--primary-dark);
}

.result-field textarea {
  background: white;
}

/* Warnings */
.warnings {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--accent);
}

.warnings::before {
  content: "⚠️ ";
}

/* Preferences Section */
.preferences-section {
  margin: 1.5rem 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.preferences-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.preferences-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.preference-item label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 0.25rem;
}

.preference-item select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: white;
}

/* Toggles */
.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
}

.toggle input {
  display: none;
}

.toggle-slider {
  width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: 11px;
  position: relative;
  transition: background 0.2s;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle input:checked + .toggle-slider::after {
  transform: translateX(18px);
}

.toggle-label {
  color: var(--text-light);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-secondary:hover {
  background: #4f46e5;
}

.btn-large {
  width: 100%;
  padding: 1rem;
  font-size: 1.05rem;
  border-radius: var(--radius);
}

.btn-small {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

.btn-icon {
  font-size: 1.1rem;
}

/* Output Section */
.output-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

/* Status Banner */
.status-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius);
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.status-banner.processing {
  background: var(--secondary-light);
  color: var(--secondary);
}

.status-banner.success {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.status-banner.error {
  background: #fee2e2;
  color: var(--error);
}

.status-banner.warning {
  background: var(--accent-light);
  color: var(--accent);
}

/* Recipe Container */
.recipe-container {
  margin-top: 1rem;
}

.recipe-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.recipe-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.recipe-description {
  color: var(--text-light);
  margin-bottom: 1rem;
}

.recipe-meta {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-light);
  font-size: 0.9rem;
}

.meta-icon {
  font-size: 1.1rem;
}

/* Recipe Time Breakdown (prep vs cook) */
.recipe-time-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 1rem auto 0;
  max-width: 520px;
  padding: 0 0.5rem;
}

.recipe-time-breakdown.hidden {
  display: none;
}

.time-bar {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.time-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.time-bar-label {
  font-weight: 600;
  color: var(--text);
}

.time-bar-value {
  color: var(--text-light);
  font-variant-numeric: tabular-nums;
}

.time-bar-track {
  height: 8px;
  background: var(--border-light, #e5e7eb);
  border-radius: 4px;
  overflow: hidden;
}

.time-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.time-bar-prep .time-bar-fill {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.time-bar-cook .time-bar-fill {
  background: linear-gradient(90deg, #10b981, #34d399);
}

/* Recipe Sections */
.recipe-section {
  margin-bottom: 2rem;
}

.recipe-section h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary-light);
}

.section-icon {
  font-size: 1.25rem;
}

/* Recipe Tags */
.recipe-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1rem;
}

.recipe-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.3;
}

.tag-meal {
  background: var(--secondary-light);
  color: var(--secondary);
}

.tag-diet {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.tag-method {
  background: var(--border-light);
  color: var(--text-light);
  border: 1px solid var(--border);
}

.tag-nationality {
  background: #fef3c7;
  color: #92400e;
}

.tag-nutri {
  font-weight: 700;
  color: white;
  padding: 0.3rem 0.85rem;
}

.tag-nutri.nutri-a {
  background: #16a34a;
}
.tag-nutri.nutri-b {
  background: #65a30d;
}
.tag-nutri.nutri-c {
  background: #eab308;
  color: #1e293b;
}
.tag-nutri.nutri-d {
  background: #ea580c;
}
.tag-nutri.nutri-e {
  background: #dc2626;
}

.has-tooltip {
  cursor: help;
}

.nutri-explanation {
  width: 100%;
  font-size: 0.75rem;
  color: var(--text-light);
  font-style: italic;
  text-align: center;
  margin-top: 0.3rem;
  line-height: 1.4;
}

/* Servings Slider */
.servings-slider {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--border-light);
  border-radius: var(--radius);
}

.servings-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.servings-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-light);
}

.servings-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 2rem;
  text-align: center;
}

.servings-slider-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.servings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: white;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.servings-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.servings-btn:active {
  transform: scale(0.92);
}

.servings-slider-controls input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}

.servings-slider-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s ease;
}

.servings-slider-controls input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.servings-slider-controls input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.servings-status {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.4rem;
}

/* Ingredients List */
.ingredients-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

.ingredients-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.ingredients-list li::before {
  content: "•";
  color: var(--primary);
  font-weight: bold;
}

.ingredient-estimated {
  opacity: 0.7;
  font-style: italic;
}

.ingredient-estimated::after {
  content: " (stimato)";
  font-size: 0.75rem;
  color: var(--accent);
}

/* Procedure List */
.procedure-list {
  list-style: none;
  counter-reset: step;
}

.procedure-list li {
  counter-increment: step;
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--border-light);
  border-radius: var(--radius);
}

.procedure-list li::before {
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  font-weight: 600;
  border-radius: 50%;
  font-size: 0.9rem;
}

.step-content {
  flex: 1;
}

.step-action {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.step-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-light);
}

.step-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Step Condition (inline in meta) */
.step-condition-meta {
  color: var(--accent);
  font-weight: 500;
}

/* Optimized Procedure */
.time-saved {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-weight: 500;
}

.optimized-groups {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.optimized-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--border-light);
  font-weight: 500;
}

.group-parallel {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  background: var(--secondary-light);
  color: var(--secondary);
  border-radius: var(--radius-sm);
}

.group-steps {
  padding: 1rem;
}

.group-steps ol {
  list-style: decimal;
  padding-left: 1.5rem;
}

/* (parallel group styles removed — design uses flat list only) */

.group-steps li {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* Nutrition */
.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.nutrition-item {
  text-align: center;
  padding: 1rem;
  background: var(--border-light);
  border-radius: var(--radius);
}

.nutrition-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.nutrition-label {
  font-size: 0.8rem;
  color: var(--text-light);
}

.nutrition-notes {
  font-size: 0.85rem;
  color: var(--text-light);
  font-style: italic;
}

/* Quick Tweak Section */
.tweak-section {
  margin-top: 2rem;
  padding: 1.25rem;
  background: var(--accent-light);
  border-radius: var(--radius);
  border: 1px solid #fde68a;
}

.tweak-section h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  border-bottom: none;
  padding-bottom: 0;
}

.tweak-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.tweak-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.tweak-chip {
  padding: 0.35rem 0.7rem;
  background: white;
  border: 1px solid #fde68a;
  border-radius: 20px;
  font-size: 0.78rem;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.tweak-chip:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Stato disabilitato durante l'applicazione di un tweak */
.tweak-suggestions.tweak-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.tweak-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tweak-input-wrapper {
  display: flex;
  gap: 0.5rem;
}

.tweak-input-wrapper input {
  flex: 1;
  padding: 0.65rem 0.85rem;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: white;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.tweak-input-wrapper input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

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

.btn-accent:hover {
  background: #d97706;
}

.btn-accent:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
}

.tweak-result {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: white;
  border-radius: var(--radius-sm);
  border: 1px solid #fde68a;
}

.tweak-result-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--primary-dark);
  margin-bottom: 0.4rem;
}

.tweak-changes-list {
  list-style: none;
  padding: 0;
}

.tweak-changes-list li {
  font-size: 0.82rem;
  color: var(--text-light);
  padding: 0.2rem 0;
  padding-left: 1rem;
  position: relative;
}

.tweak-changes-list li::before {
  content: "-";
  position: absolute;
  left: 0.25rem;
  color: var(--accent);
  font-weight: 600;
}

/* Chef Chat Section */
.chef-chat-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.chat-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Chat Messages */
.chat-messages {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.25rem 0;
}

.chat-msg {
  display: flex;
}

.chat-msg-user {
  justify-content: flex-end;
}

.chat-msg-assistant {
  justify-content: flex-start;
}

.chat-bubble {
  max-width: 85%;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg-user .chat-bubble {
  background: var(--secondary);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-msg-assistant .chat-bubble {
  background: var(--border-light);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

/* Intent badges */
.chat-intent-badge {
  display: block;
  margin-top: 0.5rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  width: fit-content;
}

.chat-intent-route_to_tweaker {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.chat-intent-route_to_nutritionist {
  background: var(--accent-light);
  color: var(--accent);
}

.chat-intent-reject_unsafe_request {
  background: #fee2e2;
  color: var(--error);
}

/* Typing indicator */
.typing-dots {
  display: inline-flex;
  gap: 4px;
  padding: 2px 0;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Chat suggestions */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.suggestion {
  padding: 0.4rem 0.75rem;
  background: var(--border-light);
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}

.suggestion:hover {
  background: var(--secondary-light);
  color: var(--secondary);
}

/* Chat input */
.chat-input-wrapper {
  display: flex;
  gap: 0.5rem;
}

.chat-input-wrapper input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.chat-input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.chat-input-wrapper input:disabled {
  opacity: 0.6;
}

/* XML Output */
.xml-output {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--bg-dark);
  border-radius: var(--radius);
}

.xml-output summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.xml-output pre {
  margin: 1rem 0;
  padding: 1rem;
  background: #0f172a;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.xml-output code {
  font-family: "Monaco", "Consolas", monospace;
  font-size: 0.8rem;
  color: #e2e8f0;
  white-space: pre;
}

/* Pipeline Trace */
.pipeline-trace {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--border-light);
  border-radius: var(--radius);
}

.pipeline-trace summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--text-light);
}

#pipeline-trace {
  margin-top: 1rem;
}

.trace-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

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

.trace-name {
  font-weight: 500;
}

.trace-status {
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}

.trace-status.success {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.trace-status.error {
  background: #fee2e2;
  color: var(--error);
}

.trace-status.skipped {
  background: var(--border);
  color: var(--text-light);
}

.trace-time {
  color: var(--text-muted);
  font-size: 0.8rem;
}

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

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

/* Simple loader (non-streaming) */
.simple-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.loader {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#loading-text {
  margin-top: 1rem;
  color: var(--text-light);
  font-weight: 500;
}

/* ============================
   Cooking Stations (streaming)
   ============================ */

.cooking-stations {
  width: 100%;
  max-width: 520px;
  padding: 0 1.5rem;
}

.stations-header {
  text-align: center;
  margin-bottom: 2rem;
}

.stations-logo {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
  animation: gentle-bounce 2s ease-in-out infinite;
}

@keyframes gentle-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.stations-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}

/* Timeline */
.stations-timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Station */
.station {
  position: relative;
  padding-left: 36px;
  padding-bottom: 0.5rem;
}

.station:last-child {
  padding-bottom: 0;
}

/* Connector line */
.station-connector {
  position: absolute;
  left: 11px;
  top: 24px;
  width: 2px;
  height: calc(100% - 12px);
  background: var(--border);
  transition: background 0.5s ease;
}

.station:last-child .station-connector {
  display: none;
}

.station.completed .station-connector {
  background: var(--primary);
}

/* Dot */
.station-dot {
  position: absolute;
  left: 4px;
  top: 16px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--border);
  border: 3px solid white;
  box-shadow: 0 0 0 2px var(--border);
  transition: all 0.4s ease;
  z-index: 1;
}

.station.active .station-dot {
  background: var(--primary);
  box-shadow:
    0 0 0 2px var(--primary),
    0 0 12px rgba(16, 185, 129, 0.4);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.station.completed .station-dot {
  background: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
}

@keyframes pulse-dot {
  0%,
  100% {
    box-shadow:
      0 0 0 2px var(--primary),
      0 0 8px rgba(16, 185, 129, 0.3);
  }
  50% {
    box-shadow:
      0 0 0 2px var(--primary),
      0 0 16px rgba(16, 185, 129, 0.6);
  }
}

/* Card */
.station-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--border-light);
  transition: all 0.4s ease;
  min-height: 52px;
}

.station.active .station-card {
  background: white;
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.15);
  border: 1px solid var(--primary-light);
}

.station.completed .station-card {
  background: var(--primary-light);
  border: 1px solid transparent;
}

.station-icon {
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0.4;
  transition: opacity 0.3s ease;
}

.station.active .station-icon,
.station.completed .station-icon {
  opacity: 1;
}

.station-info {
  flex: 1;
  min-width: 0;
}

.station-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.station.active .station-name,
.station.completed .station-name {
  opacity: 1;
}

.station-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 1px;
  transition: color 0.3s ease;
}

.station.active .station-desc {
  color: var(--text-light);
}

.station.completed .station-desc {
  display: none;
}

/* Data section (shown after completion) */
.station-data {
  font-size: 0.8rem;
  color: var(--primary-dark);
  font-weight: 500;
  margin-top: 3px;
  line-height: 1.4;
}

/* Status indicator */
.station-status {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 44px;
  text-align: right;
  margin-top: 3px;
}

/* Footer */
.stations-footer {
  text-align: center;
  margin-top: 1.5rem;
}

.stations-elapsed {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  font-variant-numeric: tabular-nums;
}

/* Active station shimmer */
.station.active .station-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--radius);
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(16, 185, 129, 0.04) 50%,
    transparent 100%
  );
  animation: shimmer 2s ease-in-out infinite;
}

.station-card {
  position: relative;
  overflow: hidden;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
  .app {
    padding: 1rem 0.75rem;
  }

  .logo h1 {
    font-size: 1.5rem;
  }

  .tabs {
    flex-direction: column;
  }

  .preferences-grid {
    grid-template-columns: 1fr;
  }

  .toggles {
    flex-direction: column;
  }

  .recipe-meta {
    gap: 1rem;
  }

  .ingredients-list {
    grid-template-columns: 1fr;
  }

  .chat-input-wrapper {
    flex-direction: column;
  }

  .tweak-input-wrapper {
    flex-direction: column;
  }

  .chat-bubble {
    max-width: 95%;
  }
}

/* Style tabs (guided / confident) */
.style-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.style-tab {
  padding: 0.4rem 0.9rem;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #374151;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}

.style-tab:hover:not(:disabled) {
  background: #eef2ff;
  border-color: #6366f1;
}

.style-tab.active {
  background: #6366f1;
  color: white;
  border-color: #6366f1;
}

.style-tab:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
