/* ═══════════════════════════════════════════════════════════════════
   HORMORA FOOD TRACKER — PREMIUM DARK MODE DESIGN
   Design System: Dark (#080b18), Gradient (#2d366f → #7b3d8c → #a25392)
   Font: DM Sans
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

/* ─── DESIGN TOKENS ─── */
:root {
  /* Primary Gradient */
  --p1: #2d366f;
  --p2: #7b3d8c;
  --p3: #a25392;
  --grad: linear-gradient(135deg, #2d366f 0%, #7b3d8c 55%, #a25392 100%);

  /* Background */
  --bg: #080b18;
  --bg-elevated: #0f1020;
  --card: rgba(255,255,255,0.045);
  --card-border: rgba(255,255,255,0.075);
  --card-hover: rgba(255,255,255,0.06);

  /* Text */
  --text: #f0f0ff;
  --text-secondary: #c8c8de;
  --text-tertiary: #9898b4;

  /* Status Colors */
  --green: #34d399;
  --green-dim: rgba(52,211,153,0.15);
  --green-bg: rgba(52,211,153,0.06);
  --green-border: rgba(52,211,153,0.15);

  --amber: #fbbf24;
  --amber-dim: rgba(251,191,36,0.15);
  --amber-bg: rgba(251,191,36,0.06);
  --amber-border: rgba(251,191,36,0.15);

  --red: #f87171;
  --red-dim: rgba(248,113,113,0.15);
  --red-bg: rgba(248,113,113,0.06);
  --red-border: rgba(248,113,113,0.15);

  /* Border Radius */
  --r: 18px;
  --r-sm: 12px;
  --r-lg: 24px;

  /* Shadows */
  --shadow-sm: 0 4px 16px rgba(0,0,0,0.2);
  --shadow-md: 0 8px 28px rgba(0,0,0,0.3);
  --shadow-lg: 0 16px 48px rgba(45,54,111,0.4);
  --shadow-glow: 0 0 24px rgba(162,83,146,0.3);
}

/* ─── GLOBAL RESET ─── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── APP CONTAINER ─── */
.app-container {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ─── HEADER ─── */
.header {
  padding: 16px 20px 0;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.greeting {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 0;
}

.header-name {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 2px 0 0;
}

.header-date {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 2px 0 0;
}

.header-avatar {
  width: 40px;
  height: 40px;
  background: var(--grad);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(162,83,146,0.3);
  flex-shrink: 0;
}

.dark-mode-toggle {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.dark-mode-toggle:hover {
  background: rgba(255,255,255,0.1);
}

/* ─── MAIN CONTENT ─── */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 90px;
}

/* ─── CARDS ─── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r);
  padding: 20px;
  margin-bottom: 12px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.card-body {
  color: var(--text-secondary);
}

/* ─── SCORE CARD ─── */
.score-card {
  margin: 20px 20px;
  background: var(--grad);
  border-radius: var(--r-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.1);
  border: none;
}

.score-card::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.score-card-content {
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.score-ring-container {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.score-ring {
  transform: rotate(-90deg);
}

.score-ring-bg {
  fill: none;
  stroke: rgba(255,255,255,0.12);
  stroke-width: 8;
}

.score-ring-fill {
  fill: none;
  stroke: white;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.2s cubic-bezier(.4,0,.2,1);
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.35));
}

.score-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
}

.score-max {
  font-size: 9px;
  font-weight: 500;
  opacity: 0.65;
  margin-top: 1px;
}

.score-details {
  flex: 1;
}

.score-label {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
}

.score-status {
  font-size: 13px;
  opacity: 0.8;
  line-height: 1.5;
  margin: 4px 0 0;
}

.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 10px;
}

.score-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

/* ─── SECTION LABELS ─── */
.section-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 0 20px;
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.section-action {
  font-size: 12px;
  font-weight: 500;
  color: var(--p3);
  cursor: pointer;
}

/* ─── MACROS GRID ─── */
.macros-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 20px;
  margin-bottom: 20px;
}

.macro-item {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r-sm);
  padding: 14px;
}

.macro-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.macro-name {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.macro-value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
}

.macro-value span {
  font-size: 13px;
  color: var(--text-tertiary);
}

.macro-target {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: 'DM Mono', monospace;
  margin: 2px 0 0;
}

.progress-bar {
  height: 3px;
  background: rgba(255,255,255,0.07);
  border-radius: 99px;
  margin-top: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--grad);
  border-radius: 99px;
  transition: width 0.8s cubic-bezier(.4,0,.2,1);
}

/* ─── MEALS LIST ─── */
.meals-list {
  padding: 0 20px;
  margin-bottom: 20px;
}

.meal-item {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.meal-item.empty {
  background: transparent;
  border: 1px dashed var(--card-border);
  opacity: 0.5;
}

.meal-item:hover {
  background: var(--card-hover);
}

.meal-icon {
  width: 38px;
  height: 38px;
  background: rgba(162,83,146,0.12);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.meal-icon.empty {
  background: rgba(152,152,180,0.08);
}

.meal-content {
  flex: 1;
}

.meal-name {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.meal-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin: 1px 0 0;
}

.meal-calories {
  font-size: 13px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  color: var(--text-secondary);
}

.add-meal-btn {
  width: 100%;
  background: rgba(162,83,146,0.08);
  border: 1px dashed rgba(162,83,146,0.3);
  border-radius: var(--r-sm);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--p3);
  cursor: pointer;
  margin-top: 8px;
  font-family: inherit;
  transition: all 0.15s;
}

.add-meal-btn:hover {
  background: rgba(162,83,146,0.12);
}

/* ─── HORMONE PROFILE GRID ─── */
.hormone-grid {
  padding: 0 20px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.hormone-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r-sm);
  padding: 14px;
}

.hormone-card.primary {
  border: 1px solid rgba(162,83,146,0.3);
}

.hormone-name {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  margin-bottom: 4px;
}

.hormone-score-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.hormone-score {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.hormone-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.hormone-progress {
  height: 3px;
  background: rgba(255,255,255,0.07);
  border-radius: 99px;
  margin-top: 8px;
  overflow: hidden;
}

.hormone-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.8s ease;
  opacity: 0.7;
}

.hormone-focus-badge {
  font-size: 9px;
  font-weight: 700;
  color: var(--p3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 6px;
}

/* ─── OMEGA-6 TRACKER ─── */
.omega-tracker {
  margin: 0 20px 20px;
  border-radius: var(--r);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.omega-tracker.safe {
  background: var(--green-bg);
  border: 1px solid var(--green-border);
}

.omega-tracker.warning {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
}

.omega-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.omega-icon.safe {
  background: var(--green-dim);
}

.omega-icon.warning {
  background: var(--red-dim);
}

.omega-details {
  flex: 1;
}

.omega-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
}

.omega-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  margin: 2px 0 0;
}

.omega-value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-family: 'DM Mono', monospace;
}

.omega-value.safe {
  color: var(--green);
}

.omega-value.warning {
  color: var(--red);
}

/* ─── KEY INSIGHT CARD ─── */
.insight-card {
  margin: 0 20px 20px;
  background: linear-gradient(135deg, rgba(45,54,111,0.4) 0%, rgba(162,83,146,0.3) 100%);
  border: 1px solid rgba(162,83,146,0.25);
  border-radius: var(--r);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.insight-card::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(162,83,146,0.2) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.insight-content {
  position: relative;
  z-index: 1;
}

.insight-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.insight-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--p3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.insight-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 14px;
}

.insight-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--grad);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(162,83,146,0.3);
  font-family: inherit;
}

/* ─── SUPPLEMENTS ─── */
.supplement-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.supplement-item:first-child {
  border-top: none;
}

.supplement-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.15);
  transition: all 0.15s;
}

.supplement-checkbox.checked {
  background: var(--grad);
  border: none;
}

.supplement-content {
  flex: 1;
}

.supplement-name {
  font-size: 13px;
  font-weight: 500;
  margin: 0;
}

.supplement-dose {
  font-size: 11px;
  color: var(--text-tertiary);
  margin: 1px 0 0;
}

.supplement-timing {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(255,255,255,0.06);
  color: var(--text-tertiary);
}

/* ─── FAB (FLOATING ACTION BUTTON) ─── */
.fab {
  position: fixed;
  bottom: 86px;
  right: 20px;
  width: 52px;
  height: 52px;
  background: var(--grad);
  border: none;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(162,83,146,0.4), 0 0 0 1px rgba(255,255,255,0.1);
  cursor: pointer;
  z-index: 40;
  font-size: 28px;
  color: white;
  font-weight: 300;
  line-height: 1;
}

/* ─── BOTTOM NAV ─── */
.bottom-nav {
  height: 82px;
  background: rgba(8,11,24,0.92);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: flex-start;
  padding-top: 12px;
  flex-shrink: 0;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: none;
  color: var(--text-tertiary);
  position: relative;
}

.nav-item.active {
  color: #c472a8;
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
  position: relative;
}

.nav-item.active .nav-icon {
  filter: drop-shadow(0 0 6px rgba(162,83,146,0.6));
}

.nav-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ─── CHAT ─── */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.chat-header {
  padding: 16px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(8,11,24,0.8);
  backdrop-filter: blur(20px);
  flex-shrink: 0;
}

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

.chat-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}

.chat-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 1px 0 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.online-dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px rgba(52,211,153,0.6);
}

.chat-avatar {
  width: 32px;
  height: 32px;
  background: var(--grad);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.message-avatar {
  width: 28px;
  height: 28px;
  background: var(--grad);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.message-bubble {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px 18px 18px 4px;
  padding: 12px 14px;
  max-width: 78%;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.message-bubble.user {
  background: var(--grad);
  border: none;
  color: white;
  border-radius: 18px 18px 4px 18px;
  margin-left: auto;
}

.chat-chips {
  padding: 8px 16px;
  display: flex;
  gap: 7px;
  overflow-x: auto;
}

.chat-chip {
  padding: 7px 13px;
  border-radius: 99px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
}

.chat-input-container {
  padding: 10px 16px 14px;
  background: rgba(8,11,24,0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 10px 14px;
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.chat-send-btn {
  width: 32px;
  height: 32px;
  background: var(--grad);
  border: none;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(162,83,146,0.3);
}

/* ─── ANIMATIONS ─── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

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

/* ─── UTILITIES ─── */
.mono {
  font-family: 'DM Mono', monospace;
}

.gradient-text {
  background: linear-gradient(135deg, #7b3d8c, #a25392, #c472a8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

.pill {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.15);
}

/* ═══════════════════════════════════════════════════════════════════
   DESKTOP CONTAINMENT (screens wider than 480px)
   ═══════════════════════════════════════════════════════════════════ */

@media (min-width: 481px) {
  /* Container: max-width 480px, centered, with subtle borders */
  .app-container {
    max-width: 480px;
    margin: 0 auto;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06),
                0 0 48px rgba(45,54,111,0.2);
  }

  /* Bottom nav: also contained and centered */
  .bottom-nav {
    max-width: 480px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-left: 1px solid rgba(255,255,255,0.06);
    border-right: 1px solid rgba(255,255,255,0.06);
  }
}
