/* ==========================================================================
   🎨 Gourmet Theme CSS - Focused Single-Column Conversational Stream
   ========================================================================== */

:root {
  --bg-app: hsl(220, 12%, 6%);
  --bg-panel: rgba(22, 24, 30, 0.7);
  --bg-panel-solid: hsl(222, 15%, 12%);
  --border-glass: rgba(255, 255, 255, 0.06);
  --border-glass-hover: rgba(255, 255, 255, 0.12);
  
  --text-primary: hsl(0, 0%, 95%);
  --text-secondary: hsl(220, 8%, 65%);
  --text-muted: hsl(220, 6%, 45%);
  
  --accent-gold: hsl(38, 92%, 52%);
  --accent-gold-rgb: 241, 168, 10;
  --accent-green: hsl(142, 38%, 45%);
  --accent-red: hsl(0, 75%, 45%);
  
  --shadow-main: 0 12px 40px rgba(0, 0, 0, 0.4);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  height: 100vh;
  display: flex;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 800px;
  height: 100vh;
  padding: 16px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px 20px;
  background: var(--bg-panel);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-main);
  flex-shrink: 0;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  color: var(--accent-gold);
  font-size: 24px;
}

.app-header h1 {
  font-size: 18px;
}

.security-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.25);
  border-radius: 20px;
}

.security-icon {
  color: var(--accent-green);
  font-size: 14px;
}

.security-text {
  font-size: 10px;
  font-weight: 500;
  color: var(--accent-green);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Chat Main Area */
.chat-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-main);
  padding: 8px 0;
}

/* Chat History */
.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}

/* Message Bubbles */
.message {
  display: flex;
  gap: 14px;
  max-width: 90%;
  animation: messageFadeIn 0.3s ease-out forwards;
}

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

.message.system-message, .message.chef-message {
  align-self: flex-start;
  max-width: 95%;
}

.message.user-message {
  align-self: flex-end;
  flex-direction: row-reverse;
  max-width: 85%;
}

.system-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  transition: var(--transition-smooth);
}

.system-avatar.chef-avatar, .system-message .system-avatar {
  background: rgba(241, 168, 10, 0.1);
  color: var(--accent-gold);
  border: 1px solid rgba(241, 168, 10, 0.25);
  box-shadow: 0 0 10px rgba(241, 168, 10, 0.05);
}

.system-avatar.grocery-avatar {
  background: rgba(76, 175, 80, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(76, 175, 80, 0.25);
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.05);
}

.system-avatar.security-avatar {
  background: rgba(244, 67, 54, 0.1);
  color: var(--accent-red);
  border: 1px solid rgba(244, 67, 54, 0.25);
  box-shadow: 0 0 10px rgba(244, 67, 54, 0.05);
}

.message-body {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-primary);
  word-break: break-word;
}

.message.user-message .message-body {
  background: rgba(241, 168, 10, 0.08);
  border-color: rgba(241, 168, 10, 0.2);
  border-radius: var(--radius-md) 0 var(--radius-md) var(--radius-md);
}

/* Suggestion Pills */
.suggestion-pills {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.pill-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.pill-btn:hover {
  background: rgba(241, 168, 10, 0.08);
  border-color: rgba(241, 168, 10, 0.3);
  color: var(--accent-gold);
  transform: translateX(4px);
}

/* Shielded PII Badges */
.shielded-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(244, 67, 54, 0.12);
  border: 1px solid rgba(244, 67, 54, 0.25);
  color: #ff7961;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  vertical-align: middle;
  margin: 0 2px;
  transition: var(--transition-smooth);
}

.shielded-badge:hover {
  background: rgba(244, 67, 54, 0.2);
  border-color: rgba(244, 67, 54, 0.4);
  transform: scale(1.03);
}

/* Input Area Container */
.input-area-container {
  padding: 12px 20px;
  border-top: 1px solid var(--border-glass);
  background: rgba(0, 0, 0, 0.15);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  flex-shrink: 0;
}

.chat-input-container {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-textarea {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 12px 16px;
  font-size: 14.5px;
  line-height: 1.4;
  font-family: 'Inter', sans-serif;
  resize: none;
  outline: none;
  max-height: 120px;
  transition: var(--transition-smooth);
}

.chat-textarea:focus {
  border-color: rgba(241, 168, 10, 0.4);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(241, 168, 10, 0.1);
}

.send-btn {
  background: var(--accent-gold);
  border: none;
  color: #000;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition-smooth);
}

.send-btn:hover {
  background: hsl(38, 92%, 60%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(241, 168, 10, 0.3);
}

.send-btn:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Spinner Loader */
.loader-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Markdown formatting inside bubbles */
.message-body h1, .message-body h2, .message-body h3 {
  color: var(--accent-gold);
  margin-top: 16px;
  margin-bottom: 8px;
  font-weight: 500;
}

.message-body h2 { font-size: 17px; }
.message-body h3 { font-size: 15.5px; border-bottom: 1px solid rgba(255,255,255,0.04); padding-bottom: 4px; }

.message-body p {
  margin-bottom: 10px;
}

.message-body ul {
  list-style-type: none;
  padding-left: 0;
  margin-bottom: 14px;
}

.message-body li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 6px;
}

.message-body li::before {
  content: "•";
  color: var(--accent-gold);
  position: absolute;
  left: 4px;
  font-weight: bold;
}

/* Embedded Gourmet Card (In-Chat Recipe Board) */
.embedded-gourmet-card {
  margin-top: 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  animation: cardSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

/* Accordion Headers */
.gourmet-accordion {
  border-bottom: 1px solid var(--border-glass);
}

.gourmet-accordion:last-child {
  border-bottom: none;
}

.accordion-trigger {
  width: 100%;
  background: transparent;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-smooth);
}

.accordion-trigger:hover {
  background: rgba(255, 255, 255, 0.02);
  color: var(--accent-gold);
}

.trigger-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trigger-title-group span.material-symbols-outlined {
  color: var(--accent-gold);
  font-size: 20px;
}

.accordion-icon {
  font-size: 18px;
  transition: transform 0.3s ease;
  color: var(--text-secondary);
}

.gourmet-accordion.open .accordion-icon {
  transform: rotate(180deg);
  color: var(--accent-gold);
}

/* Content Area */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease;
  background: rgba(0, 0, 0, 0.1);
  padding: 0 18px;
}

.gourmet-accordion.open .accordion-content {
  max-height: 600px;
  padding: 16px 18px;
  overflow-y: auto;
}

/* 🛒 Smart Department Checklist Styles */
.embedded-checklist-departments {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.checklist-dept-section h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-gold);
  margin-bottom: 8px;
}

.checklist-dept-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checklist-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.checklist-item-row:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-glass-hover);
}

.checklist-item-row input {
  display: none;
}

.check-circle-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

.check-circle-custom::after {
  content: "check";
  font-family: 'Material Symbols Outlined';
  font-size: 12px;
  color: #000;
  display: none;
}

.checklist-item-row input:checked + .check-circle-custom {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

.checklist-item-row input:checked + .check-circle-custom::after {
  display: block;
}

.checklist-item-row-text {
  font-size: 13.5px;
  color: var(--text-primary);
  transition: var(--transition-smooth);
}

.checklist-item-row input:checked ~ .checklist-item-row-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* 📊 Nutrition HUD Styles */
.embedded-nutrition-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.nutrition-pill {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.nutrition-pill::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.cal-pill::before { background: var(--accent-gold); }
.pro-pill::before { background: #2196f3; }
.carb-pill::before { background: #e91e63; }
.fat-pill::before { background: #9c27b0; }

.nutrition-pill .pill-name {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nutrition-pill .pill-val {
  font-size: 18px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
}

.nutrition-pill .pill-val .unit {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Embedded bars */
.pill-track {
  background: rgba(255, 255, 255, 0.04);
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
}

.pill-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 1s ease-out;
}

.cal-pill .pill-bar { background: var(--accent-gold); }
.pro-pill .pill-bar { background: #2196f3; }
.carb-pill .pill-bar { background: #e91e63; }
.fat-pill .pill-bar { background: #9c27b0; }


/* ==========================================================================
   🖼️ Gourmet Dialog Modal System
   ========================================================================== */
.gourmet-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none; /* Controlled by JS */
  align-items: center;
  justify-content: center;
  padding: 24px;
}

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

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  animation: overlayFadeIn 0.3s ease-out forwards;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  position: relative;
  background: hsl(222, 15%, 12%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1001;
  animation: cardSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  border-left: 5px solid var(--accent-gold); /* Dynamic default highlight */
}

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

/* Modal Types styling */
.gourmet-modal.type-security .modal-card {
  border-left-color: var(--accent-red);
}

.gourmet-modal.type-pii .modal-card {
  border-left-color: var(--accent-gold);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px 14px 24px;
  border-bottom: 1px solid var(--border-glass);
}

.modal-header-icon {
  font-size: 28px;
  color: var(--accent-gold);
}

.gourmet-modal.type-security .modal-header-icon {
  color: var(--accent-red);
}

.gourmet-modal.type-pii .modal-header-icon {
  color: var(--accent-gold);
}

.modal-header h3 {
  font-size: 18px;
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  overflow-y: auto;
  max-height: 300px;
}

.modal-body strong {
  color: var(--text-primary);
}

.modal-body code {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 6px;
  border-radius: 4px;
  font-family: monospace;
  color: var(--accent-gold);
  font-size: 13px;
  word-break: break-all;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 14px 24px 20px 24px;
  border-top: 1px solid var(--border-glass);
  background: rgba(0, 0, 0, 0.15);
}

.modal-btn {
  background: var(--border-glass);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.modal-btn:hover {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #000;
}

.gourmet-modal.type-security .modal-btn:hover {
  background: var(--accent-red);
  border-color: var(--accent-red);
  color: #fff;
}
