/* =========================================
   GO PREMIUM — DOENÇAS INTERCORRENTES
   Stylesheet Principal
   ========================================= */

/* --- TOKENS DE COR GLOBAIS --- */
:root {
  /* Neutros */
  --bg-primary: #f4f7f6;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255,255,255,0.75);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: rgba(0,0,0,0.08);
  --border-light: rgba(0,0,0,0.05);

  /* Sidebar */
  --sidebar-bg: rgba(15,23,42,0.98);
  --sidebar-text: #e2e8f0;
  --sidebar-accent: #38bdf8;
  --sidebar-width: 272px;

  /* Header */
  --header-bg: rgba(244,247,246,0.88);
  --header-height: 58px;

  /* Sucesso / Erro */
  --success: #10b981;
  --success-light: rgba(16,185,129,0.12);
  --error: #ef4444;
  --error-light: rgba(239,68,68,0.12);
  --warning: #f59e0b;
  --info: #3b82f6;

  /* Bloco Tireoide */
  --color-tireoide: #0891b2;
  --color-tireoide-light: #e0f2fe;
  --color-tireoide-mid: #7dd3fc;
  --grad-tireoide: linear-gradient(135deg,#e0f7fa 0%,#b2ebf2 35%,#80deea 65%,#4dd0e1 100%);

  /* Bloco Reumato */
  --color-reumato: #9333ea;
  --color-reumato-light: #f3e8ff;
  --color-reumato-mid: #c084fc;
  --grad-reumato: linear-gradient(135deg,#f5f3ff 0%,#ede9fe 35%,#ddd6fe 65%,#c4b5fd 100%);

  /* Bloco SAF */
  --color-saf: #7c3aed;
  --color-saf-light: #ede9fe;
  --grad-saf: linear-gradient(135deg,#fdf4ff 0%,#fae8ff 35%,#e9d5ff 65%,#d8b4fe 100%);

  /* Bloco Cardio */
  --color-cardio: #e11d48;
  --color-cardio-light: #fff1f2;
  --color-cardio-mid: #fda4af;
  --grad-cardio: linear-gradient(135deg,#fff1f2 0%,#ffe4e6 35%,#fecdd3 65%,#fda4af 100%);

  /* Bloco Hepato */
  --color-hepato: #d97706;
  --color-hepato-light: #fffbeb;
  --color-hepato-mid: #fcd34d;
  --grad-hepato: linear-gradient(135deg,#fffde7 0%,#fff9c4 35%,#fff59d 65%,#ffe082 100%);

  /* Bloco ITU */
  --color-itu: #0284c7;
  --color-itu-light: #e0f2fe;
  --color-itu-mid: #7dd3fc;
  --grad-itu: linear-gradient(135deg,#ecfeff 0%,#cffafe 35%,#a5f3fc 65%,#67e8f9 100%);

  /* Bloco Revisão */
  --color-revisao: #0f766e;
  --color-revisao-light: #f0fdfa;
  --grad-revisao: linear-gradient(135deg,#f0fdfa 0%,#ccfbf1 35%,#99f6e4 65%,#5eead4 100%);

  /* Síndromes Febris */
  --color-dengue: #dc2626;
  --color-icterica: #d97706;
  --color-leish: #7c3aed;
  --grad-dengue: linear-gradient(135deg,#fff1f2 0%,#fee2e2 36%,#fecaca 68%,#fca5a5 100%);
  --grad-icterica: linear-gradient(135deg,#fffbeb 0%,#fef3c7 36%,#fde68a 68%,#fbbf24 100%);
  --grad-leish: linear-gradient(135deg,#f5f3ff 0%,#ede9fe 36%,#ddd6fe 68%,#c4b5fd 100%);

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.13), 0 4px 12px rgba(0,0,0,0.08);
  --shadow-xl: 0 24px 60px rgba(0,0,0,0.16);

  /* Bordas arredondadas */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Tipografia */
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  /* Transições */
  --transition-fast: all 0.15s ease;
  --transition-base: all 0.25s cubic-bezier(0.4,0,0.2,1);
  --transition-slow: all 0.4s cubic-bezier(0.4,0,0.2,1);
}

/* --- DARK MODE --- */
[data-theme="dark"] {
  --bg-primary: #0a0f1e;
  --bg-secondary: #111827;
  --bg-card: rgba(17,24,39,0.80);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: rgba(255,255,255,0.08);
  --border-light: rgba(255,255,255,0.05);
  --header-bg: rgba(10,15,30,0.90);

  --grad-tireoide: linear-gradient(135deg,#0c2d3a 0%,#0e3d4a 35%,#0a4a5a 65%,#065670 100%);
  --grad-reumato: linear-gradient(135deg,#1a0a2e 0%,#240e42 35%,#2d1256 65%,#3d1a6e 100%);
  --grad-saf: linear-gradient(135deg,#1e0a30 0%,#2a0e40 35%,#381254 65%,#4a1a6e 100%);
  --grad-cardio: linear-gradient(135deg,#2d0a0e 0%,#3d0e14 35%,#4a121a 65%,#5c1822 100%);
  --grad-hepato: linear-gradient(135deg,#2a1a00 0%,#3a2200 35%,#4a2c00 65%,#5a3800 100%);
  --grad-itu: linear-gradient(135deg,#0a1e2d 0%,#0c2a3d 35%,#0e364a 65%,#104256 100%);
  --grad-revisao: linear-gradient(135deg,#061a18 0%,#082420 35%,#0a2e2a 65%,#0c3a34 100%);
  --grad-dengue: linear-gradient(135deg,#2d0a0a 0%,#3b1111 36%,#4a1515 68%,#5c1a1a 100%);
  --grad-icterica: linear-gradient(135deg,#2a1a00 0%,#3a2200 36%,#4a2c00 68%,#5a3800 100%);
  --grad-leish: linear-gradient(135deg,#1a0a2e 0%,#240e42 36%,#2d1256 68%,#3d1a6e 100%);
}

/* --- RESET E BASE --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* --- SIDEBAR --- */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  backdrop-filter: blur(24px) saturate(200%);
  border-right: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width 0.3s cubic-bezier(0.4,0,0.2,1), transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}

/* --- LOGO --- */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.logo-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(14,165,233,0.35);
}

.logo-go {
  font-size: 1rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.04em;
  line-height: 1;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}

.logo-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: #f1f5f9;
  white-space: nowrap;
  line-height: 1.2;
}

.logo-sub {
  font-size: 0.62rem;
  font-weight: 500;
  color: rgba(255,255,255,0.35);
  white-space: nowrap;
  letter-spacing: 0.04em;
}

/* --- NAV SCROLL AREA --- */
.sidebar-nav {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 10px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* --- BLOCO CARD (group de doença) --- */
.nav-group {
  margin-bottom: 6px;
}

.nav-group-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px 5px;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  user-select: none;
}

.nav-group-header:hover {
  background: rgba(255,255,255,0.05);
}

.nav-group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: var(--transition-base);
}

.nav-group-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.45);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--transition-fast);
}

.nav-group-header:hover .nav-group-title {
  color: rgba(255,255,255,0.7);
}

.nav-group-toggle {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.25);
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.nav-group.open .nav-group-toggle {
  transform: rotate(180deg);
}

/* --- CARDS DAS PÁGINAS DENTRO DO GRUPO --- */
.nav-pages {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 0 4px 0;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1), opacity 0.25s ease;
  opacity: 0;
}

.nav-group.open .nav-pages {
  max-height: 800px;
  opacity: 1;
}

.nav-page-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  overflow: hidden;
}

.nav-page-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: transparent;
  transition: var(--transition-fast);
}

.nav-page-card:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.07);
}

.nav-page-card:hover::before {
  background: rgba(255,255,255,0.2);
}

.nav-page-card.active {
  border-color: rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.08);
}

.nav-page-card.active::before {
  background: var(--nav-accent, #38bdf8);
}

.nav-page-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  background: rgba(255,255,255,0.07);
  transition: var(--transition-fast);
}

.nav-page-card.active .nav-page-icon {
  background: var(--nav-accent-soft, rgba(56,189,248,0.2));
}

.nav-page-info {
  flex: 1;
  overflow: hidden;
}

.nav-page-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  transition: var(--transition-fast);
}

.nav-page-card:hover .nav-page-label,
.nav-page-card.active .nav-page-label {
  color: rgba(255,255,255,0.92);
}

/* --- FOOTER DA SIDEBAR --- */
.sidebar-footer {
  padding: 10px 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-footer-label {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.25);
  font-weight: 500;
}

.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.06);
  cursor: pointer;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition-base);
  color: #e2e8f0;
  flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(255,255,255,0.13); transform: scale(1.08); }

/* --- SIDEBAR OVERLAY (mobile) --- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 190;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* --- HEADER --- */
.header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 0 16px;
  z-index: 150;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), background 0.3s ease;
}

.header.hidden { transform: translateY(-100%); }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}
.hamburger span {
  width: 22px; height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition-base);
  display: block;
}

.header-breadcrumb {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.progress-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  transition: var(--transition-base);
}
.progress-btn:hover { border-color: var(--info); color: var(--info); transform: translateY(-1px); }

/* --- MAIN CONTENT --- */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
  flex: 1;
  transition: var(--transition-base);
}

.page-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* --- PAGE GRADIENT BG --- */
.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-size: 400% 400%;
  animation: gradientFlow 18s ease-in-out infinite;
  transition: background 0.6s ease;
}

@keyframes gradientFlow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Conteúdo acima do bg */
.page-container { position: relative; z-index: 1; }

/* --- GLASS CARD --- */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: var(--transition-base);
}

.glass-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(0,0,0,0.12);
  transform: translateY(-2px);
}

[data-theme="dark"] .glass-card {
  background: rgba(17,24,39,0.75);
  border-color: rgba(255,255,255,0.08);
}

/* --- PAGE SECTIONS --- */
.page-hero {
  margin-bottom: 32px;
  padding: 40px 36px;
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
}

.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad-current, var(--grad-revisao));
  background-size: 400% 400%;
  animation: gradientFlow 16s ease-in-out infinite;
  z-index: 0;
}

.page-hero > * { position: relative; z-index: 1; }

.page-hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.35);
  border: 1px solid rgba(255,255,255,0.4);
  color: rgba(0,0,0,0.65);
  margin-bottom: 14px;
}

[data-theme="dark"] .page-hero-tag {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
}

.page-hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.page-hero .subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 700px;
}

/* --- SECTION HEADER --- */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.section-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.section-header h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
}

.section-header h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

/* --- GRID LAYOUTS --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit,minmax(280px,1fr)); gap: 16px; }

/* --- INFO CARDS --- */
.info-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  border-left: 4px solid transparent;
}

.info-card.primary { background: var(--color-tireoide-light, #e0f2fe); border-color: var(--color-tireoide, #0891b2); }
.info-card.success { background: var(--success-light); border-color: var(--success); }
.info-card.warning { background: #fffbeb; border-color: var(--warning); }
.info-card.danger  { background: var(--error-light); border-color: var(--error); }

[data-theme="dark"] .info-card.primary { background: rgba(8,145,178,0.12); }
[data-theme="dark"] .info-card.success { background: rgba(16,185,129,0.12); }
[data-theme="dark"] .info-card.warning { background: rgba(245,158,11,0.12); }
[data-theme="dark"] .info-card.danger  { background: rgba(239,68,68,0.12); }

.info-card h4 {
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  opacity: 0.75;
}

.info-card p, .info-card li {
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--text-primary);
}

.info-card ul { padding-left: 16px; }
.info-card li { margin-bottom: 4px; }

/* --- TABELAS PREMIUM --- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }

.premium-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
  background: var(--bg-card);
  backdrop-filter: blur(10px);
}

.premium-table th {
  background: rgba(0,0,0,0.04);
  font-weight: 700;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
  color: var(--text-primary);
}

[data-theme="dark"] .premium-table th { background: rgba(255,255,255,0.05); }

.premium-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: top;
  line-height: 1.5;
}

.premium-table tr:last-child td { border-bottom: none; }

.premium-table tbody tr {
  transition: var(--transition-fast);
}

.premium-table tbody tr:hover {
  background: rgba(0,0,0,0.025);
}

[data-theme="dark"] .premium-table tbody tr:hover { background: rgba(255,255,255,0.04); }

.premium-table .cell-highlight {
  font-weight: 600;
  color: var(--color-current, var(--info));
}

.cell-check { color: var(--success); font-weight: 700; }
.cell-cross { color: var(--error); font-weight: 700; }
.cell-neutral { color: var(--text-muted); }

/* --- BADGE / CHIP --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-ok    { background: var(--success-light); color: #065f46; }
.badge-warn  { background: #fef3c7; color: #92400e; }
.badge-no    { background: var(--error-light); color: #991b1b; }
.badge-info  { background: #eff6ff; color: #1e40af; }

[data-theme="dark"] .badge-ok   { background: rgba(16,185,129,0.2); color: #6ee7b7; }
[data-theme="dark"] .badge-warn { background: rgba(245,158,11,0.2); color: #fcd34d; }
[data-theme="dark"] .badge-no   { background: rgba(239,68,68,0.2); color: #fca5a5; }
[data-theme="dark"] .badge-info { background: rgba(59,130,246,0.2); color: #93c5fd; }

/* --- MEDICAMENTOS --- */
.med-group { margin-bottom: 20px; }
.med-group-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}

.med-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  transition: var(--transition-base);
}

.med-card:hover { transform: translateX(4px); box-shadow: var(--shadow-sm); }

.med-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.med-card.can  .med-icon { background: var(--success-light); }
.med-card.warn .med-icon { background: #fef3c7; }
.med-card.no   .med-icon { background: var(--error-light); }

.med-info { flex: 1; }
.med-name { font-weight: 700; font-size: var(--text-sm); margin-bottom: 3px; }
.med-desc { font-size: var(--text-xs); color: var(--text-secondary); line-height: 1.5; }

/* --- ALERTA / PEGADINHA --- */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert-icon { font-size: 1.4rem; flex-shrink: 0; margin-top: 2px; }
.alert-body {}
.alert-title { font-weight: 700; margin-bottom: 6px; font-size: var(--text-sm); }
.alert-text  { font-size: var(--text-sm); line-height: 1.6; color: var(--text-secondary); }

.alert.pegadinha { background: #fff7ed; border-color: #fed7aa; }
.alert.pegadinha .alert-title { color: #c2410c; }
[data-theme="dark"] .alert.pegadinha { background: rgba(249,115,22,0.12); border-color: rgba(249,115,22,0.3); }

.alert.atencao { background: #fefce8; border-color: #fef08a; }
.alert.atencao .alert-title { color: #a16207; }
[data-theme="dark"] .alert.atencao { background: rgba(234,179,8,0.12); border-color: rgba(234,179,8,0.3); }

.alert.info { background: #eff6ff; border-color: #bfdbfe; }
.alert.info .alert-title { color: #1e40af; }
[data-theme="dark"] .alert.info { background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.3); }

.alert.success { background: #f0fdf4; border-color: #bbf7d0; }
.alert.success .alert-title { color: #15803d; }
[data-theme="dark"] .alert.success { background: rgba(16,185,129,0.12); border-color: rgba(16,185,129,0.3); }

.alert.danger { background: #fef2f2; border-color: #fecaca; }
.alert.danger .alert-title { color: #b91c1c; }
[data-theme="dark"] .alert.danger { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.3); }

/* --- QUIZ --- */
.quiz-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 2px dashed var(--border-color);
}

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

.quiz-header h3 {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text-primary);
}

.quiz-tag {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: #fff7ed;
  color: #c2410c;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

[data-theme="dark"] .quiz-tag { background: rgba(249,115,22,0.2); color: #fb923c; }

.quiz-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  backdrop-filter: blur(10px);
}

.quiz-number {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.quiz-stem {
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: 20px;
  font-weight: 400;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: var(--transition-base);
  text-align: left;
  width: 100%;
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--text-primary);
}

.quiz-option:hover {
  border-color: var(--info);
  background: rgba(59,130,246,0.04);
  transform: translateX(4px);
}

.quiz-option.correct {
  border-color: var(--success) !important;
  background: var(--success-light) !important;
  animation: pulseSuccess 0.5s ease;
}

.quiz-option.wrong {
  border-color: var(--error) !important;
  background: var(--error-light) !important;
  animation: shakeError 0.45s ease;
}

.quiz-option .opt-letter {
  font-weight: 800;
  font-size: var(--text-sm);
  min-width: 22px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.quiz-option.correct .opt-letter { color: var(--success); }
.quiz-option.wrong .opt-letter   { color: var(--error); }

.quiz-feedback {
  display: none;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.6;
  margin-top: 12px;
  animation: fadeInUp 0.4s ease;
}

.quiz-feedback.show { display: block; }
.quiz-feedback.correct-feedback { background: var(--success-light); border-left: 4px solid var(--success); }
.quiz-feedback.wrong-feedback   { background: var(--error-light); border-left: 4px solid var(--error); }
.quiz-feedback .fb-title { font-weight: 700; margin-bottom: 6px; }

.quiz-reveal-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  transition: var(--transition-base);
}
.quiz-reveal-btn:hover { border-color: var(--info); color: var(--info); }
.quiz-reveal-btn:disabled { opacity: 0.4; cursor: default; }

/* --- SIMULADORES / INTERATIVOS --- */
.simulator-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  margin-bottom: 16px;
}

.simulator-card h4 {
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.sim-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.sim-select, .sim-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-body);
  outline: none;
  transition: var(--transition-base);
  margin-bottom: 14px;
}

.sim-select:focus, .sim-input:focus {
  border-color: var(--info);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.sim-result {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.6;
  font-weight: 500;
  min-height: 48px;
  display: flex; align-items: center;
  margin-top: 4px;
}

.sim-result.ok      { background: var(--success-light); color: #065f46; border-left: 4px solid var(--success); }
.sim-result.warn    { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning); }
.sim-result.danger  { background: var(--error-light); color: #991b1b; border-left: 4px solid var(--error); }
.sim-result.neutral { background: rgba(0,0,0,0.04); color: var(--text-secondary); border-left: 4px solid var(--border-color); }

[data-theme="dark"] .sim-result.ok      { background: rgba(16,185,129,0.15); color: #6ee7b7; }
[data-theme="dark"] .sim-result.warn    { background: rgba(245,158,11,0.15); color: #fcd34d; }
[data-theme="dark"] .sim-result.danger  { background: rgba(239,68,68,0.15); color: #fca5a5; }
[data-theme="dark"] .sim-result.neutral { background: rgba(255,255,255,0.05); }

.sim-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--info);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-base);
  margin-top: 4px;
}
.sim-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(59,130,246,0.35); }
.sim-btn:active { transform: scale(0.97); }

/* --- HOTSPOTS --- */
.hotspot-container {
  position: relative;
  display: inline-block;
  width: 100%;
}

.hotspot {
  position: absolute;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--info);
  border: 2px solid #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: #fff;
  z-index: 10;
  transition: var(--transition-base);
  animation: hotspotPulse 2.5s ease-in-out infinite;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.hotspot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--info);
  animation: hotspotRipple 2.5s ease-in-out infinite;
  opacity: 0.5;
}

.hotspot:hover {
  transform: scale(1.3);
  animation: none;
  box-shadow: 0 4px 16px rgba(59,130,246,0.45);
}

.hotspot-popup {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15,23,42,0.97);
  border: 1px solid rgba(255,255,255,0.12);
  color: #e2e8f0;
  font-size: var(--text-xs);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  white-space: nowrap;
  max-width: 220px;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  z-index: 20;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-lg);
}

.hotspot:hover + .hotspot-popup,
.hotspot-popup.show { opacity: 1; }

/* --- FLASHCARDS --- */
.flashcard-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); gap: 14px; }

.flashcard {
  height: 160px;
  cursor: pointer;
  perspective: 900px;
}

.flashcard-inner {
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4,0,0.2,1);
  border-radius: var(--radius-lg);
}

.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }

.flashcard-front, .flashcard-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  border: 1px solid var(--border-color);
}

.flashcard-front {
  background: var(--bg-card);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.flashcard-back {
  background: linear-gradient(135deg,#1e40af,#3b82f6);
  color: #fff;
  font-size: var(--text-xs);
  line-height: 1.5;
  transform: rotateY(180deg);
}

/* --- FLUXOGRAMA --- */
.flow-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 20px;
}

.flow-step {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 500;
  max-width: 320px;
  width: 100%;
  position: relative;
  transition: var(--transition-base);
}

.flow-step:hover {
  border-color: var(--info);
  box-shadow: var(--shadow-sm);
  transform: scale(1.02);
}

.flow-step.decision {
  background: #fffbeb;
  border-color: var(--warning);
  clip-path: polygon(50% 0%,100% 50%,50% 100%,0% 50%);
  padding: 24px 40px;
  border-radius: 4px;
}

[data-theme="dark"] .flow-step.decision { background: rgba(245,158,11,0.1); }

.flow-arrow {
  font-size: 1.5rem;
  color: var(--text-muted);
  line-height: 1;
  margin: 4px 0;
}

/* --- MAPA MENTAL --- */
.mind-map {
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.mind-map-center {
  text-align: center;
  font-weight: 800;
  font-size: var(--text-lg);
  padding: 14px 24px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  background: linear-gradient(135deg,var(--info),var(--color-tireoide, var(--info)));
  color: #fff;
  box-shadow: var(--shadow-md);
}

.mind-map-branches {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(200px,1fr));
  gap: 12px;
}

.mind-branch {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.mind-branch-title {
  font-weight: 700;
  margin-bottom: 6px;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* --- VIA DE PARTO CARD --- */
.parto-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.parto-card-header {
  padding: 14px 20px;
  font-weight: 700;
  font-size: var(--text-sm);
  display: flex; align-items: center; gap: 8px;
}

.parto-vaginal .parto-card-header { background: var(--success-light); color: #065f46; }
.parto-cesarea .parto-card-header { background: var(--error-light); color: #991b1b; }

[data-theme="dark"] .parto-vaginal .parto-card-header { background: rgba(16,185,129,0.2); color: #6ee7b7; }
[data-theme="dark"] .parto-cesarea .parto-card-header { background: rgba(239,68,68,0.2); color: #fca5a5; }

.parto-card-body {
  padding: 16px 20px;
  background: var(--bg-card);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.parto-card-body ul { padding-left: 16px; }
.parto-card-body li { margin-bottom: 6px; }

/* --- MODAL --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay[hidden] { display: none; }

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: fadeInUp 0.35s ease;
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.06);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}
.modal-close:hover { background: var(--error-light); color: var(--error); }

.modal-body { padding: 20px 24px 24px; }

/* --- PROGRESS BARS --- */
.progress-bar-wrap {
  height: 8px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 6px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--info), var(--success));
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

/* --- SEPARADOR --- */
.sep { height: 1px; background: var(--border-color); margin: 28px 0; }
.sep-dashed { border: none; border-top: 2px dashed var(--border-color); margin: 28px 0; }

/* --- TIPOGRAFIA --- */
h2.section-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

h3.sub-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

p.body-text {
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

p.body-text strong { color: var(--text-primary); font-weight: 600; }

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

ul.styled-list li {
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--text-secondary);
  padding: 4px 0 4px 22px;
  position: relative;
}

ul.styled-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--info);
  font-weight: 700;
}

ol.styled-ol {
  padding-left: 24px;
  margin-bottom: 14px;
}

ol.styled-ol li {
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: rgba(0,0,0,0.06);
  padding: 1px 6px;
  border-radius: 4px;
}

[data-theme="dark"] code { background: rgba(255,255,255,0.1); }

/* --- NAVEGAÇÃO ENTRE PÁGINAS --- */
.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.page-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  transition: var(--transition-base);
  text-decoration: none;
}

.page-nav-btn:hover {
  border-color: var(--info);
  color: var(--info);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* --- RESPONSIVIDADE --- */
@media (max-width: 900px) {
  :root { --sidebar-width: 0px; }

  .sidebar {
    width: 272px;
    transform: translateX(-100%);
    z-index: 250;
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  .hamburger { display: flex; }

  .header { left: 0; padding: 0 16px; }

  .main-content { margin-left: 0; }

  .page-container { padding: 20px 16px 64px; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  .page-hero { padding: 28px 20px; }

  .premium-table { font-size: 0.8rem; }
  .premium-table th, .premium-table td { padding: 8px 10px; }
}

@media (max-width: 480px) {
  .page-hero h1 { font-size: 1.4rem; }
  .flashcard-grid { grid-template-columns: 1fr 1fr; }
  .quiz-option { font-size: 0.8rem; }
}

/* --- SCROLLBAR --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); }

/* --- UTILITÁRIOS --- */
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.text-sm { font-size: var(--text-sm); }
.text-muted { color: var(--text-muted); }
.hidden { display: none !important; }
