/* ═══════════════════════════════════════════════
   NutriSense AI – styles.css
   Design system: dark mode, glassmorphism, premium
═══════════════════════════════════════════════ */

/* ── RESET & TOKENS ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --green: #00d4aa;
  --purple: #7c3aed;
  --blue: #3b82f6;
  --teal: #0ea5e9;
  --bg: #080d14;
  --bg2: #0e1520;
  --bg3: #141e2e;
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(255, 255, 255, 0.07);
  --text: #f0f6ff;
  --text2: #8898aa;
  --text3: #4a5568;
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 240px;
  --topbar-h: 70px;
  --transition: 0.2s ease;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --glow-green: 0 0 30px rgba(0, 212, 170, 0.2);
  --glow-purple: 0 0 30px rgba(124, 58, 237, 0.2);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── GLASS CARD ── */
.glass-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ── GRADIENT TEXT ── */
.gradient-text {
  background: linear-gradient(135deg, var(--green), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── BUTTONS ── */
.btn-primary {
  background: linear-gradient(135deg, var(--green), var(--purple));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  letter-spacing: 0.3px;
}

.btn-primary:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  box-shadow: var(--glow-green);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-ghost:hover {
  background: var(--glass-hover);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.14);
}

.btn-large {
  padding: 16px 32px;
  font-size: 16px;
  border-radius: 12px;
}

.btn-full {
  width: 100%;
}

/* ── BADGES ── */
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.badge-green {
  background: rgba(0, 212, 170, 0.15);
  color: var(--green);
  border: 1px solid rgba(0, 212, 170, 0.25);
}

.badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.badge-purple {
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(124, 58, 237, 0.25);
}

.badge-error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-ai {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

/* ── PAGES ── */
.page {
  display: none;
  width: 100%;
}

.page.active {
  display: block;
  flex: 1;
}

#page-dashboard.active {
  display: flex;
  flex-direction: column;
  padding-top: var(--topbar-h);
}

/* ── TOPBAR ── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(8, 13, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  height: var(--topbar-h);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex !important;
  /* Force flex */
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap !important;
  /* Prevent wrapping into two bars */
  gap: 12px;
}

/* ── LOGO ── */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: auto;
  /* Push others to right */
}

@media (max-width: 768px) {
  .logo {
    margin-right: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
}

.logo-icon svg {
  width: 36px;
  height: 36px;
}

.logo-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}

.logo-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  background: linear-gradient(135deg, var(--green), var(--purple));
  border-radius: 20px;
  color: #fff;
  letter-spacing: 1px;
}

/* ── NAV LINKS ── */
.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.nav-links a {
  text-decoration: none;
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  transition: color var(--transition);
  padding: 6px 12px;
  border-radius: 8px;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-links .nav-btn-ghost {
  border: 1px solid var(--glass-border);
}

.nav-links .nav-btn-ghost:hover {
  background: var(--glass-hover);
}

.nav-links .nav-btn-primary {
  background: linear-gradient(135deg, var(--green), var(--purple));
  color: #fff !important;
  font-weight: 600;
}

.nav-links .nav-btn-primary:hover {
  opacity: 0.85;
}

/* ── LANGUAGE SWITCHER ── */
.lang-switcher {
  position: relative;
  flex-shrink: 0;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}

.lang-btn:hover {
  background: var(--glass-hover);
}

.lang-flag {
  font-size: 16px;
}

.chevron {
  width: 14px;
  height: 14px;
  color: var(--text2);
  transition: transform var(--transition);
}

.lang-switcher {
  position: relative;
  display: inline-block;
  overflow: visible !important;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 6px;
  min-width: 160px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 2000;
  animation: fadeSlideDown 0.15s ease;
}

.lang-menu.open {
  display: block;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 7px;
  transition: all var(--transition);
  font-family: inherit;
  text-align: left;
}

.lang-option:hover {
  background: var(--glass-hover);
  color: var(--text);
}

/* ── HAMBURGER ── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  /* margin-left: auto; -- removed to allow custom positioning */
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}

/* ── MOBILE MENU ── */
.mobile-menu {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 12px 24px 24px;
  background: var(--bg2);
  border-top: 1px solid var(--glass-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  animation: fadeSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-menu-inner {
  display: flex;
  flex-direction: column;
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu a {
  color: var(--text2);
  text-decoration: none;
  padding: 14px 4px;
  font-size: 15px;
  font-weight: 500;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: all var(--transition);
}

.mobile-menu a:hover {
  color: var(--text);
  padding-left: 8px;
}

.mobile-menu a:last-child {
  border-bottom: none;
}

.mobile-extra {
  margin-top: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-extra .lang-switcher-mobile {
  width: 100%;
}

.mobile-extra .lang-btn {
  width: 100%;
  justify-content: space-between;
}

.mobile-extra .theme-toggle {
  width: 100%;
  padding: 12px;
  justify-content: center;
}

/* ══════════════════════════════════════
   LANDING PAGE
══════════════════════════════════════ */
#page-landing.active {
  display: block;
  background: var(--bg);
}

/* ── HERO ── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: var(--topbar-h);
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: var(--green);
  top: -200px;
  left: -150px;
  animation: orbFloat 8s ease-in-out infinite;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: var(--purple);
  bottom: -150px;
  right: -100px;
  animation: orbFloat 10s ease-in-out infinite reverse;
}

.orb-3 {
  width: 350px;
  height: 350px;
  background: var(--blue);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: orbFloat 12s ease-in-out infinite 2s;
}

@keyframes orbFloat {

  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-30px) scale(1.05);
  }
}

.orb-3 {
  animation-name: orb3Float;
}

@keyframes orb3Float {

  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }

  50% {
    transform: translate(-50%, -50%) scale(1.08);
  }
}

.hero-content {
  text-align: center;
  position: relative;
  z-index: 1;
  padding-top: 60px;
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 212, 170, 0.1);
  border: 1px solid rgba(0, 212, 170, 0.25);
  color: var(--green);
  padding: 6px 18px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 28px;
  letter-spacing: 0.3px;
  animation: fadeUp 0.6s ease both;
}

.hero-title {
  font-size: clamp(40px, 6vw, 80px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -2px;
  margin-bottom: 24px;
  animation: fadeUp 0.6s ease 0.1s both;
}

.hero-sub {
  font-size: clamp(15px, 2vw, 18px);
  color: var(--text2);
  max-width: 560px;
  margin: 0 auto 40px;
  animation: fadeUp 0.6s ease 0.2s both;
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 60px;
  animation: fadeUp 0.6s ease 0.3s both;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 32px;
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeUp 0.6s ease 0.4s both;
}

.stat {
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--green), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: var(--glass-border);
}

/* ── HERO MOCKUP CARD ── */
.hero-card-mockup {
  position: relative;
  z-index: 1;
  padding-bottom: 80px;
  display: flex;
  justify-content: center;
  animation: fadeUp 0.8s ease 0.5s both;
}

.mockup-card {
  max-width: 460px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), var(--glow-green);
}

.mockup-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.mockup-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--green), var(--purple));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.mockup-name {
  font-size: 14px;
  font-weight: 600;
}

.mockup-plan {
  font-size: 11px;
  color: var(--text2);
}

.mockup-credits {
  margin-left: auto;
  text-align: right;
}

.credits-left {
  font-size: 24px;
  font-weight: 800;
  color: var(--green);
  display: block;
}

.credits-label {
  font-size: 10px;
  color: var(--text2);
}

.mockup-diet {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 16px;
}

.diet-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.diet-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
}

.diet-meals {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.meal-item {
  font-size: 13px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.diet-badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── FEATURES SECTION ── */
.features-section {
  padding: 100px 0;
  background: linear-gradient(to bottom, var(--bg), var(--bg2));
}

.section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 16px;
}

.section-title {
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 16px;
}

.section-sub {
  font-size: 16px;
  color: var(--text2);
  margin-bottom: 60px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 60px;
}

.feature-card {
  padding: 32px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.feature-icon {
  font-size: 40px;
  margin-bottom: 20px;
  display: inline-block;
  padding: 14px;
  border-radius: 14px;
}

.feat-icon-1 {
  background: rgba(0, 212, 170, 0.1);
}

.feat-icon-2 {
  background: rgba(124, 58, 237, 0.1);
}

.feat-icon-3 {
  background: rgba(59, 130, 246, 0.1);
}

.feature-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.feature-card p {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.7;
}

/* ── PRICING ── */
.pricing-section {
  padding: 100px 0;
  background: var(--bg2);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 60px;
  align-items: start;
}

.pricing-card {
  padding: 32px;
  position: relative;
  transition: transform var(--transition);
}

.pricing-card:hover {
  transform: translateY(-4px);
}

.pricing-card.featured {
  border-color: rgba(0, 212, 170, 0.35);
  background: rgba(0, 212, 170, 0.06);
  box-shadow: var(--glow-green);
  transform: scale(1.02);
}

.pricing-card.featured:hover {
  transform: scale(1.02) translateY(-4px);
}

.plan-badge {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--green), var(--purple));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 16px;
  border-radius: 50px;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.plan-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text2);
}

.plan-price {
  margin-bottom: 8px;
}

.price-amount {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: -2px;
}

.price-period {
  font-size: 14px;
  color: var(--text2);
}

.plan-diets {
  font-size: 14px;
  color: var(--green);
  font-weight: 600;
  margin-bottom: 24px;
}

.diet-count {
  font-size: 24px;
  font-weight: 800;
}

.plan-features {
  list-style: none;
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-features li {
  font-size: 14px;
  color: var(--text2);
  padding-left: 24px;
  position: relative;
}

.plan-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--green);
  font-weight: 700;
}

.plan-features li.disabled {
  opacity: 0.35;
}

.plan-features li.disabled::before {
  content: '×';
  color: var(--text3);
}

.plan-btn {
  width: 100%;
}

/* ── FOOTER ── */
.footer {
  background: var(--bg);
  border-top: 1px solid var(--glass-border);
  padding: 60px 0 40px;
  position: relative;
  z-index: 10;
}

.footer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 32px;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-logo {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--green), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.footer-copy {
  font-size: 14px;
  color: var(--text2);
}

.footer-attribution {
  font-size: 13px;
  color: var(--text3);
}

.qora-link {
  color: var(--green);
  text-decoration: none;
  font-weight: 600;
  transition: opacity var(--transition);
}

.qora-link:hover {
  opacity: 0.8;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  font-size: 13px;
  color: var(--text3);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--text2);
}

/* ── DIET RESULT: MEAL CARDS ── */
.meal-cards-grid {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.meal-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
}

.meal-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

.meal-card-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}

.meal-card-emoji {
  font-size: 20px;
}

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

.meal-card-chevron {
  width: 16px;
  height: 16px;
  color: var(--text3);
  transition: transform 0.3s ease;
}

.meal-card.open .meal-card-chevron {
  transform: rotate(180deg);
}

.meal-card-body {
  padding: 0 20px 20px 52px;
  display: none;
  animation: slideDown 0.3s ease;
}

.meal-card.open .meal-card-body {
  display: block;
}

.meal-food-item {
  padding: 6px 0;
  font-size: 14px;
  color: var(--text2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.meal-warning-block {
  background: rgba(255, 100, 100, 0.05);
  border: 1px solid rgba(255, 100, 100, 0.15);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  font-size: 14px;
  color: #fda4af;
  margin-top: 24px;
}

/* ── DIET RESULT: MACROS ── */
.macros-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.macro-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  transition: transform var(--transition);
}

.macro-card:hover {
  transform: translateY(-2px);
  background: var(--glass-hover);
}

.macro-icon {
  font-size: 20px;
  margin-bottom: 8px;
}

.macro-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}

.macro-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text3);
  letter-spacing: 0.5px;
}

.macro-calories {
  border-bottom: 3px solid var(--green);
}

.macro-protein {
  border-bottom: 3px solid var(--blue);
}

.macro-carbs {
  border-bottom: 3px solid var(--teal);
}

.macro-fat {
  border-bottom: 3px solid var(--purple);
}

/* ── VALIDATION ERRORS ── */
.input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 1px #ef4444 !important;
}

.field-error {
  display: block;
  font-size: 11px;
  color: #ef4444;
  margin-top: 4px;
  font-weight: 600;
  animation: shake 0.4s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-4px);
  }

  75% {
    transform: translateX(4px);
  }
}

/* ══════════════════════════════════════
   AUTH PAGE
══════════════════════════════════════ */
#page-auth.active {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: calc(var(--topbar-h) + 24px) 24px 24px;
}

.auth-container {
  width: 100%;
  max-width: 420px;
}

.auth-card {
  padding: 40px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 32px;
}

.auth-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 28px;
}

.auth-tab {
  flex: 1;
  padding: 9px;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 7px;
  transition: all var(--transition);
  font-family: inherit;
}

.auth-tab.active {
  background: var(--glass-border);
  color: var(--text);
  font-weight: 600;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
}

.form-group input,
.form-group select,
.form-group textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%238898aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

.form-group select option {
  background: var(--bg2);
  color: var(--text);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: rgba(0, 212, 170, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.08);
}

.form-group input::placeholder {
  color: var(--text3);
}

.auth-hint,
.auth-back {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text2);
}

.auth-hint a,
.auth-back a {
  color: var(--green);
  text-decoration: none;
}

.hidden {
  display: none !important;
}

/* ══════════════════════════════════════
   DASHBOARD / APP
══════════════════════════════════════ */

/* ── LAYOUT ── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: visible !important;
  /* Ensure child menus are seen */
  overflow-y: auto;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 20px 20px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--glass-border);
}

@media (max-width: 768px) {
  .sidebar-logo {
    display: none;
    /* Hide in mobile since we have unified topbar logo */
  }
}

.sidebar-nav {
  padding: 12px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}

.sidebar-item:hover {
  background: var(--glass-hover);
  color: var(--text);
}

.sidebar-item.active {
  background: rgba(0, 212, 170, 0.12);
  color: var(--green);
  font-weight: 600;
}

.sicon {
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--glass-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

.user-plan-badge {
  font-size: 11px;
  color: var(--green);
  font-weight: 600;
}

.logout-btn {
  width: 100%;
  padding: 9px;
  background: none;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text3);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}

.logout-btn:hover {
  background: rgba(255, 50, 50, 0.08);
  border-color: rgba(255, 50, 50, 0.2);
  color: #ff6b6b;
}

/* ── APP MAIN ── */
.app-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-width: 0;
  /* Previene desbordamiento del flex child */
}

/* ── APP TOPBAR (mobile) ── */
.app-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo-mobile {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  margin-right: auto;
}

.app-logo-mobile .logo-text {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.app-logo-mobile .logo-badge {
  font-size: 9px;
  padding: 1px 6px;
}

/* Sidebar Settings (Mobile only) */
.sidebar-settings {
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--glass-border);
  margin-top: auto;
  margin-bottom: 8px;
  position: relative;
  z-index: 1000;
  overflow: visible !important;
  /* Critical for dropdowns */
}

.sidebar-settings .lang-switcher,
.sidebar-settings .lang-btn {
  width: 100%;
}

.sidebar-settings .lang-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  top: auto;
  left: 0;
  right: auto;
  z-index: 99999 !important;
  display: none;
  min-width: 140px;
  background: var(--bg2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}

.sidebar-settings .lang-menu.open {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.sidebar-settings .theme-toggle {
  width: 100%;
  justify-content: center;
  padding: 10px;
}

/* ── APP TABS ── */
.app-tab {
  display: none;
  padding: 32px;
  flex: 1;
  min-width: 0;
  /* Previene desbordamiento de hijos como la tabla */
}

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

/* ── TAB HEADER ── */
.tab-header {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tab-header h2 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.tab-sub {
  font-size: 14px;
  color: var(--text2);
}

/* ── CREDITS CARD ── */
.credits-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  margin-bottom: 24px;
  align-items: start;
}

.credits-card {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.credits-title {
  font-size: 13px;
  color: var(--text2);
  font-weight: 500;
  margin-bottom: 8px;
}

.credits-num {
  font-size: 56px;
  font-weight: 900;
  color: var(--green);
  line-height: 1;
  margin-bottom: 4px;
}

.credits-sub {
  font-size: 13px;
  color: var(--text2);
}

/* Ring chart */
.credits-ring {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.ring-svg {
  width: 80px;
  height: 80px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 6;
}

.ring-fill {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}

.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
}

/* Quick actions */
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--glass) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: all var(--transition);
  text-align: left;
  white-space: nowrap;
}

.quick-action-btn:hover {
  background: var(--glass-hover) !important;
  transform: translateX(2px);
}

.qa-icon {
  font-size: 18px;
}

/* Section card */
.section-card {
  padding: 24px;
}

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

@media (max-width: 768px) {
  .sc-header {
    display: none;
    /* Hide redundant headers causing double bar look */
  }
}

.sc-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.sc-header a {
  font-size: 13px;
  color: var(--green);
  text-decoration: none;
}

/* Diet list item */
.diet-list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--glass-border);
  cursor: pointer;
  transition: opacity var(--transition);
}

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

.diet-list-item:hover {
  opacity: 0.8;
}

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

.dli-icon.green {
  background: rgba(0, 212, 170, 0.1);
}

.dli-icon.purple {
  background: rgba(124, 58, 237, 0.1);
}

.dli-icon.blue {
  background: rgba(59, 130, 246, 0.1);
}

.dli-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.dli-date {
  font-size: 12px;
  color: var(--text2);
}

.dli-badge {
  margin-left: auto;
  flex-shrink: 0;
}

/* ── MEDICAL FORM ── */
.medical-form {
  padding: 32px;
  max-width: 720px;
}

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 16px;
  margin-top: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--glass-border);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.form-actions {
  margin-top: 24px;
}

.btn-generate {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  font-size: 18px;
}

/* Warning banner */
.warning-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 14px;
  color: #fca5a5;
  flex-wrap: wrap;
}

.loading-state,
.result-state {
  margin: 40px auto;
  max-width: 900px;
  width: 100%;
}

.loading-card,
.result-card {
  padding: 40px;
  text-align: center;
}

.loading-spinner {
  width: 56px;
  height: 56px;
  border: 3px solid rgba(255, 255, 255, 0.06);
  border-top-color: var(--green);
  border-radius: 50%;
  margin: 0 auto 24px;
  animation: spin 1s linear infinite;
}

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

.loading-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
}

.loading-card p {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.6;
  margin-bottom: 24px;
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.lstep {
  font-size: 13px;
  color: var(--text3);
  padding: 8px 12px;
  border-radius: 8px;
  transition: all var(--transition);
}

.lstep.active {
  background: rgba(0, 212, 170, 0.1);
  color: var(--green);
  font-weight: 600;
}

.lstep.done {
  color: var(--text2);
}

/* ── RESULT STATE ── */
.result-header {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.result-icon {
  font-size: 32px;
}

.result-card h3 {
  font-size: 20px;
  font-weight: 700;
}

.result-content {
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 20px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text2);
  margin-bottom: 20px;
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── HISTORY ── */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.history-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow);
}

/* ── PLAN TAB ── */
.current-plan-card {
  padding: 28px;
  margin-bottom: 32px;
}

.cp-row {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.cp-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  background: rgba(0, 212, 170, 0.15);
  color: var(--green);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.cp-price {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -1px;
}

.cp-price span {
  font-size: 14px;
  color: var(--text2);
  font-weight: 400;
}

.cp-reset {
  font-size: 12px;
  color: var(--text2);
  margin-top: 6px;
}

.cp-usage {
  flex: 1;
  min-width: 200px;
}

.cp-usage-label {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 10px;
  font-weight: 500;
}

.cp-bar-wrap {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50px;
  height: 8px;
  margin-bottom: 8px;
}

.cp-bar {
  height: 8px;
  border-radius: 50px;
  background: linear-gradient(90deg, var(--green), var(--purple));
  transition: width 1s ease;
}

.cp-usage-nums {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
}

.upgrade-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.mini-pricing {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.mini-plan {
  padding: 22px;
  text-align: center;
  position: relative;
  transition: transform var(--transition);
}

.mini-plan.active-plan {
  border-color: rgba(0, 212, 170, 0.35);
  background: rgba(0, 212, 170, 0.06);
}

.mini-plan:hover {
  transform: translateY(-2px);
}

.mp-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.mp-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text2);
}

.mp-price {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
}

.mp-price span {
  font-size: 12px;
  color: var(--text2);
  font-weight: 400;
}

.mp-diets {
  font-size: 13px;
  color: var(--green);
  font-weight: 600;
  margin-bottom: 16px;
}

.mini-plan button {
  width: 100%;
  padding: 10px;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  max-width: 600px;
  width: 100%;
  padding: 32px;
  max-height: 80vh;
  overflow-y: auto;
  animation: scaleIn 0.2s ease;
}

.modal-close {
  background: none;
  border: 1px solid var(--glass-border);
  color: var(--text2);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  margin-bottom: 20px;
  display: block;
  transition: all var(--transition);
}

.modal-close:hover {
  background: rgba(255, 50, 50, 0.1);
  color: #ff6b6b;
  border-color: rgba(255, 50, 50, 0.2);
}

/* ── SIDEBAR OVERLAY (mobile) ── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 500;
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ══════════════════════════════════════
   RESPONSIVE – TABLET & MOBILE
══════════════════════════════════════ */
@media (max-width: 900px) {
  .nav-links {
    display: none;
  }

  /* Force only one topbar with these settings */
  .topbar {
    height: 64px !important;
  }

  .topbar-inner {
    padding: 0 16px;
  }

  .hamburger {
    display: flex !important;
    order: -1;
  }

  .lang-switcher {
    display: block !important;
    order: 1;
  }

  .theme-toggle {
    display: none !important;
    /* Hide on small bars to avoid double row */
  }

  .sidebar-settings {
    display: flex;
  }

  .lang-switcher-mobile {
    display: none;
    /* Already in topbar */
  }
}

@media (max-width: 768px) {
  .topbar-inner {
    padding: 0 12px;
    height: 100%;
    overflow: visible;
    /* Allow language dropdown to be seen */
  }

  /* Sidebar becomes overlay on mobile */
  .app-layout {
    flex-direction: column;
    height: auto;
    overflow: auto;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 600;
    transform: translateX(-100%);
    height: 100vh;
    overflow: visible !important;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .app-main {
    overflow: visible;
    height: auto;
  }

  /* Ocultar topbar principal cuando estamos en el dashboard (evita doble barra) */
  .topbar.dashboard-mode {
    display: none !important;
  }

  /* Quitar el padding-top que compensaba el topbar */
  #page-dashboard.active {
    padding-top: 0 !important;
  }

  /* Mostrar el app-topbar del dashboard */
  .app-topbar {
    display: flex;
  }

  .app-tab {
    padding: 20px 16px;
  }

  .hero-title {
    letter-spacing: -1px;
  }

  .hero-cta {
    flex-direction: column;
    align-items: center;
  }

  .hero-stats {
    gap: 20px;
  }

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

  .pricing-card.featured {
    transform: none;
  }

  .pricing-card.featured:hover {
    transform: translateY(-4px);
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .cp-row {
    flex-direction: column;
    gap: 16px;
  }

  .mini-pricing {
    grid-template-columns: 1fr;
  }

  .modal-card {
    padding: 20px;
  }

  .quick-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .credits-card {
    flex-direction: column;
    text-align: center;
  }

  .credits-ring {
    margin: 0 auto;
  }

  .auth-card {
    padding: 24px 20px;
  }

  .medical-form {
    padding: 20px 16px;
  }
}

/* ══════════════════════════════════════
   TOAST NOTIFICATIONS
══════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 28px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-radius: 12px;
  background: var(--bg2);
  border: 1px solid var(--glass-border);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: auto;
  min-width: 220px;
  max-width: 340px;
}

.toast.toast-show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-success {
  border-color: rgba(0, 212, 170, 0.3);
  background: rgba(0, 212, 170, 0.08);
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
}

.toast-warning {
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.08);
}

.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.toast-msg {
  flex: 1;
}

/* ══════════════════════════════════════
   PROFILE MODAL
══════════════════════════════════════ */
.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(0, 212, 170, 0.25);
}

/* ══════════════════════════════════════
   RICH DIET CONTENT FORMAT
══════════════════════════════════════ */
.diet-line-header {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  padding: 10px 0 4px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.diet-line-item {
  font-size: 13px;
  color: var(--text2);
  padding: 3px 0 3px 12px;
  border-left: 2px solid rgba(0, 212, 170, 0.25);
  margin: 2px 0;
}

.diet-line {
  font-size: 13px;
  color: var(--text2);
  padding: 2px 0;
}

.diet-line-spacer {
  height: 10px;
}

/* lstep done check */
.lstep.done::before {
  content: '✓ ';
  color: var(--green);
}

/* ══════════════════════════════════════
   MACROS PANEL
══════════════════════════════════════ */
.macros-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.macro-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
  transition: transform var(--transition);
}

.macro-card:hover {
  transform: translateY(-2px);
}

.macro-icon {
  font-size: 20px;
  margin-bottom: 6px;
}

.macro-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.macro-label {
  font-size: 11px;
  color: var(--text2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.macro-calories .macro-value {
  color: #f59e0b;
}

.macro-protein .macro-value {
  color: var(--teal);
}

.macro-carbs .macro-value {
  color: var(--purple);
}

.macro-fat .macro-value {
  color: var(--green);
}

/* ── Meal Cards ── */
.meal-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.meal-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition);
}

.meal-card:hover {
  border-color: rgba(0, 212, 170, 0.2);
}

.meal-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}

.meal-card-emoji {
  font-size: 20px;
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.meal-card-title {
  font-size: 14px;
  font-weight: 700;
  flex: 1;
}

.meal-card-chevron {
  width: 16px;
  height: 16px;
  color: var(--text2);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.meal-card.open .meal-card-chevron {
  transform: rotate(180deg);
}

.meal-card-body {
  padding: 0 16px 14px 58px;
  display: none;
}

.meal-card.open .meal-card-body {
  display: block;
}

.meal-food-item {
  font-size: 13px;
  color: var(--text2);
  padding: 3px 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.meal-food-item::before {
  content: '•';
  color: var(--green);
  flex-shrink: 0;
  margin-top: 1px;
}

.meal-warning-block {
  background: rgba(251, 191, 36, 0.06);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 13px;
  color: #fbbf24;
  line-height: 1.6;
}

/* ══════════════════════════════════════
   HISTORY FILTER BAR
══════════════════════════════════════ */
.history-filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.history-search {
  flex: 1;
  min-width: 180px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition);
  outline: none;
}

.history-search::placeholder {
  color: var(--text3);
}

.history-search:focus {
  border-color: var(--green);
}

.history-filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-chip {
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text2);
  transition: all var(--transition);
  font-family: inherit;
}

.filter-chip:hover,
.filter-chip.active {
  background: rgba(0, 212, 170, 0.12);
  border-color: rgba(0, 212, 170, 0.35);
  color: var(--green);
}

.history-empty {
  text-align: center;
  padding: 40px;
  color: var(--text2);
  font-size: 14px;
}

/* ══════════════════════════════════════
   DARK / LIGHT MODE TOGGLE
══════════════════════════════════════ */
.theme-toggle {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text2);
  font-size: 14px;
  font-family: inherit;
  transition: all var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--glass-hover);
  color: var(--text);
}

/* Light mode overrides */
html[data-theme="light"] {
  --bg: #f0f4f8;
  --bg2: #e1e8f0;
  --bg3: #d6e0eb;
  --glass: rgba(0, 0, 0, 0.04);
  --glass-border: rgba(0, 0, 0, 0.09);
  --glass-hover: rgba(0, 0, 0, 0.08);
  --text: #0d1a2a;
  --text2: #4a6070;
  --text3: #8fa4b5;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  --glow-green: 0 0 20px rgba(0, 180, 140, 0.12);
}

html[data-theme="light"] .topbar {
  background: rgba(240, 244, 248, 0.9);
}

html[data-theme="light"] .sidebar {
  background: var(--bg2);
  border-right-color: var(--glass-border);
}

html[data-theme="light"] .app-main {
  background: var(--bg);
}

html[data-theme="light"] .app-topbar {
  background: var(--bg2);
  border-bottom-color: var(--glass-border);
}

html[data-theme="light"] .lang-menu {
  background: var(--bg2);
}

/* ══════════════════════════════════════
   RESULT CARD HEADER
══════════════════════════════════════ */
.result-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.result-date-chip {
  font-size: 12px;
  color: var(--text2);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}

@media (max-width: 600px) {
  .macros-panel {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ══════════════════════════════════════
   CHECKBOX GRID (formulario ampliado)
══════════════════════════════════════ */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text2);
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  position: relative;
  overflow: hidden;
}

.check-item:hover {
  background: var(--bg3);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 4px;
}

/* Estado SELECCIONADO (Premium) */
.check-item:has(input:checked) {
  background: rgba(0, 212, 170, 0.08);
  border-color: var(--green);
  color: var(--text);
  box-shadow: 0 0 20px rgba(0, 212, 170, 0.15);
}

.check-item:has(input:checked)::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--green);
  animation: popIn 0.3s ease;
}

@keyframes popIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }

  70% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ══════════════════════════════════════
   ADMIN PANEL – KPI CARDS
══════════════════════════════════════ */
.admin-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 4px;
}

.kpi-card {
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition);
}

.kpi-card:hover {
  transform: translateY(-3px);
}

.kpi-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.06;
  border-radius: inherit;
}

.kpi-green::before {
  background: var(--green);
}

.kpi-red::before {
  background: #ef4444;
}

.kpi-blue::before {
  background: var(--blue);
}

.kpi-purple::before {
  background: var(--purple);
}

.kpi-icon {
  font-size: 28px;
  margin-bottom: 10px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 6px;
  letter-spacing: -1px;
}

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

.kpi-red .kpi-value {
  color: #f87171;
}

.kpi-blue .kpi-value {
  color: var(--teal);
}

.kpi-purple .kpi-value {
  color: #a78bfa;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text3);
}

/* ── Plan Usage Bars ── */
.plan-usage-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.pub-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pub-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  width: 150px;
  flex-shrink: 0;
}

.pub-bar-wrap {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.pub-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease;
}

.pub-bar-green {
  background: linear-gradient(90deg, var(--green), var(--teal));
}

.pub-bar-blue {
  background: linear-gradient(90deg, var(--blue), var(--teal));
}

.pub-bar-purple {
  background: linear-gradient(90deg, var(--purple), #a78bfa);
}

.pub-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  width: 70px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Analytics Table ── */
.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 600px;
}

.analytics-table thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--glass-border);
}

.analytics-table tbody td {
  padding: 11px 14px;
  color: var(--text2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.analytics-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.analytics-table .ev-purchase {
  color: var(--green);
  font-weight: 600;
}

.analytics-table .ev-diet {
  color: var(--teal);
  font-weight: 600;
}

.analytics-info {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text3);
  border-top: 1px solid var(--glass-border);
  margin-top: 4px;
}

@media (max-width: 900px) {
  .admin-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* ══════════════════════════════════════
   FORM VALIDATION STYLES
══════════════════════════════════════ */
.input-error {
  border-color: #f87171 !important;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.2) !important;
  animation: shake 0.35s ease;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-4px);
  }

  40% {
    transform: translateX(4px);
  }

  60% {
    transform: translateX(-4px);
  }

  80% {
    transform: translateX(4px);
  }
}

.field-error {
  display: block;
  font-size: 11px;
  color: #f87171;
  margin-top: 4px;
  font-weight: 500;
  animation: fadeUp 0.2s ease;
}

/* Required note */
.form-required-note {
  font-size: 11px;
  color: var(--text3);
  text-align: center;
  margin-top: 8px;
}

/* ══════════════════════════════════════
   FORGOT PASSWORD MODAL MESSAGES
══════════════════════════════════════ */
.forgot-msg {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeUp 0.3s ease;
}

.forgot-msg.hidden {
  display: none;
}

.forgot-msg-success {
  background: rgba(0, 212, 170, 0.1);
  border: 1px solid rgba(0, 212, 170, 0.3);
  color: var(--green);
}

.forgot-msg-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: #f87171;
}

/* Forgot modal anchor styling */
#forgotModal a {
  color: var(--green);
  text-decoration: none;
  font-weight: 500;
}

#forgotModal a:hover {
  text-decoration: underline;
}

/* ══════════════════════════════════════
   LIGHT MODE: forgot modal override
══════════════════════════════════════ */
[data-theme="light"] .forgot-msg-success {
  background: rgba(0, 180, 140, 0.08);
}

/* ══════════════════════════════════════
   DIET WEEKLY TABLE
══════════════════════════════════════ */
.diet-table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 24px 0;
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
}

.diet-weekly-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 900px;
}

.dtc-th {
  background: linear-gradient(135deg, rgba(0, 212, 170, 0.15), rgba(124, 58, 237, 0.15));
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
  padding: 12px 10px;
  text-align: left;
  border-bottom: 2px solid rgba(0, 212, 170, 0.3);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.dtc-th-day {
  width: 80px;
  text-align: center;
}

.dtc-day {
  font-weight: 700;
  font-size: 13px;
  color: var(--green);
  text-align: center;
  padding: 14px 8px;
  vertical-align: top;
  white-space: nowrap;
  border-right: 1px solid var(--glass-border);
  background: rgba(0, 212, 170, 0.04);
}

.dtc-cell {
  padding: 12px 10px;
  vertical-align: top;
  border-right: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  line-height: 1.5;
}

.dtc-cell:last-child {
  border-right: none;
}

.dtc-row-even {
  background: rgba(255, 255, 255, 0.02);
}

.dtc-row-odd {
  background: transparent;
}

.dtc-row-even:hover,
.dtc-row-odd:hover {
  background: rgba(0, 212, 170, 0.05);
  transition: background 0.15s ease;
}

.dtc-item {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 3px;
  line-height: 1.5;
}

.dtc-item:last-child {
  margin-bottom: 0;
}

.dtc-empty {
  color: var(--text3);
  font-size: 12px;
}

/* ── RESULT ACTION BAR ── */
.result-action-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 24px 0 8px;
  padding: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
}

.result-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 212, 170, 0.1);
  border: 1px solid rgba(0, 212, 170, 0.25);
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
  white-space: nowrap;
}

.result-action-btn:hover {
  background: rgba(0, 212, 170, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 212, 170, 0.2);
}

.result-action-btn-secondary {
  background: linear-gradient(135deg, rgba(0, 212, 170, 0.15), rgba(124, 58, 237, 0.15));
  border-color: rgba(124, 58, 237, 0.3);
  color: #a78bfa;
}

.result-action-btn-secondary:hover {
  background: linear-gradient(135deg, rgba(0, 212, 170, 0.25), rgba(124, 58, 237, 0.25));
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.2);
}

/* ── LIGHT MODE TABLE ── */
[data-theme="light"] .dtc-th {
  background: linear-gradient(135deg, rgba(0, 180, 140, 0.1), rgba(100, 40, 200, 0.1));
}

[data-theme="light"] .dtc-day {
  background: rgba(0, 180, 140, 0.06);
}

[data-theme="light"] .dtc-row-even {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .dtc-item {
  color: var(--text2);
}

/* ══ FIX MOBILE DOUBLE HEADER ══ */
@media (max-width: 768px) {
  .topbar.dashboard-mode {
    display: none !important;
  }

  #page-dashboard.active {
    padding-top: 0 !important;
  }
}

/* ══ FIX LANG MENU SIDEBAR MOBILE ══ */
@media (max-width: 768px) {
  #langMenuSidebar {
    position: fixed !important;
    bottom: 80px !important;
    left: 10px !important;
    z-index: 99999 !important;
    display: none;
  }

  #langMenuSidebar.open {
    display: block !important;
  }
}