/**
 * Premium Design System - Saúde Inteligente AI
 * Focado em excelência visual, clareza e autoridade técnica.
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Paleta de Cores Curada */
  --navy: #0B1D35;
  --blue-primary: #1E88E5;
  --blue-grad: linear-gradient(135deg, #1565C0, #1E88E5);
  --teal-primary: #26A69A;
  --teal-grad: linear-gradient(135deg, #00897B, #26A69A);
  --green-soft: #E8F5E9;
  --green-dark: #2E7D32;
  --amber-soft: #FFF8E1;
  --amber-dark: #F57C00;
  --red-soft: #FFEBEE;
  --red-dark: #C62828;
  
  /* Backgrounds & Borders */
  --bg-primary: #F8FAFC;
  --bg-card: #FFFFFF;
  --border-light: #E2E8F0;
  
  /* Tipografia */
  --font-headings: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --text-main: #1E293B;
  --text-muted: #64748B;
  
  /* Efeitos */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 20px rgba(11, 29, 53, 0.08);
  --shadow-lg: 0 10px 30px rgba(11, 29, 53, 0.12);
  --radius-lg: 20px;
  --radius-md: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-headings); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }

/* ── LOADING ── */
#loading-screen { display: none; text-align: center; padding: 60px 24px; animation: fadeIn 0.4s ease; }
#loading-screen.show { display: flex; flex-direction: column; align-items: center; }

/* ── LOADING ANIMATIONS ── */
.pulse-ring {
  width: 60px; height: 60px; border: 4px solid var(--border-light);
  border-top-color: var(--blue-primary); border-radius: 50%;
  animation: spin 1s linear infinite; margin: 0 auto 24px;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

.loading-steps { margin-top: 32px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; max-width: 300px; margin-inline: auto; text-align: left; }
.loading-step { font-size: 15px; color: var(--text-muted); opacity: 0.5; transition: var(--transition); display: flex; align-items: center; gap: 12px; }
.loading-step.active { opacity: 1; color: var(--blue-primary); font-weight: 600; transform: scale(1.05); }
.loading-step.done { opacity: 0.8; color: var(--teal-primary); }


/* ── HEADER ── */
header {
  background: var(--navy);
  padding: 0 40px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.logo { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.logo-icon {
  width: 40px; height: 40px; background: var(--blue-grad);
  border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px;
  box-shadow: 0 4px 12px rgba(30, 136, 229, 0.3);
}
.logo-text { font-size: 18px; color: white; }
.logo-text span { color: #4FC3F7; }

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

.user-greeting {
  color: white;
  font-size: 13px;
  font-weight: 500;
  opacity: 0.9;
  margin-right: 8px;
}

.btn-nav {
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font-headings);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-nav:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(79, 195, 247, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.btn-nav.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #FDA4AF;
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-nav.btn-danger:hover {
  background: #E11D48;
  color: white;
  border-color: #E11D48;
}

.badge-header {
  background: linear-gradient(135deg, rgba(79, 195, 247, 0.15), rgba(30, 136, 229, 0.15));
  color: #4FC3F7;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid rgba(79, 195, 247, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: default;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
}

.badge-header:hover {
  background: rgba(79, 195, 247, 0.25);
  border-color: rgba(79, 195, 247, 0.5);
}

/* ── MAIN LAYOUT ── */
main { max-width: 940px; margin: 0 auto; padding: 60px 24px 100px; }

/* ── HERO SECTION ── */
.hero { text-align: center; margin-bottom: 54px; animation: fadeIn 0.8s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.hero h1 { font-size: clamp(32px, 5vw, 48px); margin-bottom: 16px; color: var(--navy); }
.hero h1 span { background: var(--blue-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { font-size: 18px; color: var(--text-muted); max-width: 640px; margin: 0 auto 32px; }

.disclaimer-banner {
  background: var(--amber-soft); border: 1px solid rgba(245, 124, 0, 0.2);
  border-left: 5px solid var(--amber-dark); border-radius: var(--radius-md);
  padding: 18px 24px; font-size: 14px; color: #784100; text-align: left;
  max-width: 720px; margin: 0 auto; box-shadow: var(--shadow-sm);
}

/* ── ETAPAS (STEPS) ── */
.steps { display: flex; justify-content: center; align-items: center; margin-bottom: 48px; gap: 0; }
.step { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--text-muted); font-family: var(--font-headings); }
.step.active { color: var(--blue-primary); }
.step.done { color: var(--teal-primary); }
.step-num {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--border-light);
  display: flex; align-items: center; justify-content: center; transition: var(--transition);
}
.step.active .step-num { background: var(--blue-primary); border-color: var(--blue-primary); color: white; box-shadow: 0 4px 10px rgba(30, 136, 229, 0.3); }
.step.done .step-num { background: var(--teal-primary); border-color: var(--teal-primary); color: white; }
.step-div { width: 60px; height: 2px; background: var(--border-light); margin: 0 10px; border-radius: 2px; }
.step-div.done { background: var(--teal-primary); }

/* ── CARDS & UPLOAD ── */
.card {
  background: var(--bg-card); border-radius: var(--radius-lg); 
  box-shadow: var(--shadow-lg); border: 1px solid var(--border-light);
  overflow: hidden; margin-bottom: 40px;
}
.card-header { background: var(--navy); padding: 24px 32px; display: flex; align-items: center; gap: 16px; color: white; }
.card-body { padding: 40px; }

.upload-zone {
  border: 2px dashed var(--blue-primary); border-radius: 20px; padding: 60px 24px;
  background: linear-gradient(135deg, #F8FAFC, #EFF6FF); transition: var(--transition); 
  cursor: pointer; text-align: center; position: relative;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
.upload-zone:hover { border-color: var(--teal-primary); background: #F0F9FF; transform: scale(1.01); }
.upload-icon { font-size: 64px; margin-bottom: 20px; filter: drop-shadow(0 4px 10px rgba(30, 136, 229, 0.2)); }
.upload-zone h3 { font-size: 20px; color: var(--navy); margin-bottom: 8px; }

.btn-primary {
  width: 100%; padding: 18px; background: var(--blue-grad);
  color: white; border: none; border-radius: 14px; font-family: var(--font-headings);
  font-size: 17px; font-weight: 700; cursor: pointer; margin-top: 24px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  box-shadow: 0 6px 15px rgba(21, 101, 192, 0.25); transition: var(--transition);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(21, 101, 192, 0.4); }

/* ── SEÇÃO DE ARTIGOS ── */
.articles-section { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 60px; }
.article-card {
  background: white; padding: 32px; border-radius: var(--radius-md);
  border: 1px solid var(--border-light); transition: var(--transition);
}
.article-card:hover { border-color: var(--blue-primary); box-shadow: var(--shadow-md); }
.article-card h3 { font-size: 18px; color: var(--navy); margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.article-card p { font-size: 14.5px; color: var(--text-muted); line-height: 1.7; }

/* ── FOOTER MODERNIZADO (Reduzido em 1/3) ── */
footer {
  background: var(--navy); padding: 54px 40px 32px; color: white;
  margin-top: 60px; border-top: 3px solid var(--blue-primary);
}
.footer-grid {
  max-width: 1200px; margin: 0 auto; display: grid;
  grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 40px;
}
.footer-col h4 { font-family: var(--font-headings); margin-bottom: 16px; color: #4FC3F7; font-size: 14px; text-transform: uppercase; letter-spacing: 0.1em; }
.footer-col p { font-size: 13px; color: #94A3B8; line-height: 1.6; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a { color: #94A3B8; text-decoration: none; font-size: 13px; transition: var(--transition); }

.footer-bottom {
  max-width: 1200px; margin: 0 auto; padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.08); text-align: center;
}
.footer-bottom p { font-size: 11px; color: #64748B; }

/* ── BANNER DE CONSENTIMENTO LGPD ── */
.lgpd-banner {
  position: fixed; bottom: 24px; left: 24px; right: 24px;
  background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(12px);
  border: 1px solid rgba(30, 136, 229, 0.2); border-radius: 20px;
  padding: 20px 32px; z-index: 9999; display: none;
  align-items: center; justify-content: space-between; gap: 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15); animation: bannerUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes bannerUp { from { opacity: 0; transform: translateY(50px); } to { opacity: 1; transform: translateY(0); } }

.lgpd-content { flex: 1; font-size: 14px; color: var(--navy); line-height: 1.5; }
.lgpd-content b { color: var(--blue-primary); }
.lgpd-content a { color: var(--blue-primary); font-weight: 700; text-decoration: none; }
.lgpd-content a:hover { text-decoration: underline; }

.lgpd-actions { display: flex; gap: 12px; }
.btn-accept {
  background: var(--blue-grad); color: white; border: none; padding: 10px 24px;
  border-radius: 12px; font-weight: 700; font-size: 13px; cursor: pointer; transition: var(--transition);
}
.btn-accept:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(30, 136, 229, 0.3); }

@media (max-width: 768px) {
  .lgpd-banner { flex-direction: column; text-align: center; bottom: 16px; left: 16px; right: 16px; padding: 24px; }
  .lgpd-actions { width: 100%; }
  .btn-accept { width: 100%; }
}

/* ── RESULTADOS (Prototype V1.0 Style) ── */
#result-section { display: none; margin-top: 48px; animation: fadeIn 0.6s ease both; max-width: 1000px; margin-inline: auto; }
#result-section.show { display: block; }

.result-header-bar {
  background: #1A2B50; color: white; border-radius: 16px; padding: 40px;
  display: flex; align-items: center; justify-content: center; gap: 24px;
  text-align: center; margin-bottom: 32px; box-shadow: var(--shadow-lg);
}
.result-header-icon {
  width: 72px; height: 72px; background: rgba(255,255,255,0.1);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 32px; border: 2px solid rgba(255,255,255,0.2);
}
.result-title { font-size: 22px; font-weight: 700; max-width: 600px; line-height: 1.3; }

/* Navegação por Abas */
.tabs {
  background: white; border-radius: 12px; display: flex; padding: 6px;
  gap: 8px; border: 1px solid var(--border-light); margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
}
.tab-btn {
  flex: 1; padding: 12px; border: none; background: none; border-radius: 8px;
  font-family: var(--font-headings); font-weight: 600; font-size: 14px;
  color: var(--text-muted); cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.tab-btn:hover { background: #F1F5F9; color: var(--navy); }
.tab-btn.active { background: var(--navy); color: white; box-shadow: var(--shadow-md); }

/* Grade de Marcadores (3 Colunas Fixas no Desktop) */
.markers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

/* Tab visibility management */
.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }

.marker-card {
  background: white; border-radius: 16px; padding: 24px;
  border: 1px solid var(--border-light); transition: var(--transition);
  display: flex; flex-direction: column; gap: 12px;
}
.marker-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--blue-primary); }

.marker-top { display: flex; justify-content: space-between; align-items: center; }
.marker-name { font-size: 13px; font-weight: 800; color: var(--navy); text-transform: uppercase; letter-spacing: 0.05em; }
.marker-badge {
  font-size: 10px; font-weight: 900; padding: 4px 8px; border-radius: 6px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-normal { background: #E8F5E9; color: #2E7D32; }
.badge-baixo { background: #FFF3E0; color: #EF6C00; }
.badge-alto, .badge-elevado { background: #FFEBEE; color: #C62828; }
.badge-critico { background: #C62828; color: white; }

.marker-value { font-size: 24px; font-weight: 800; color: var(--text-main); }
.marker-unit { font-size: 14px; font-weight: 500; color: var(--text-muted); margin-left: 4px; }
.marker-ref { font-size: 12px; font-weight: 600; color: var(--text-muted); background: #F8FAFC; padding: 4px 10px; border-radius: 6px; align-self: flex-start; }
.marker-explain { font-size: 13px; color: var(--text-muted); line-height: 1.5; border-top: 1px solid #F1F5F9; pt: 12px; }

/* Dieta e Consultas */
.dieta-card, .recom-item {
  background: white; border-radius: 16px; border: 1px solid var(--border-light);
  overflow: hidden; margin-bottom: 20px; transition: var(--transition);
}
.recom-item { display: flex; align-items: flex-start; gap: 0; }
.recom-prio-bar { width: 8px; align-self: stretch; }
.prio-urgente { background: var(--red-dark); }
.prio-recomendado { background: var(--amber-dark); }
.prio-preventivo { background: var(--teal-primary); }

.recom-body { padding: 24px; flex: 1; }
.recom-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.prio-tag {
  font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 4px;
  text-transform: uppercase;
}

.recom-content h4 { font-size: 18px; color: var(--navy); margin-bottom: 10px; }
.recom-content p { font-size: 14px; color: var(--text-muted); line-height: 1.6; }

/* Cards de Resumo */
.summary-card-pos, .summary-card-neg, .summary-card-legal {
    padding: 24px; border-radius: 16px; margin-bottom: 20px;
    border: 1px solid rgba(0,0,0,0.05); animation: fadeIn 0.5s ease both;
}
.summary-card-pos { background: #E8F5E9; border-left: 6px solid #2E7D32; }
.summary-card-pos h4 { color: #2E7D32; margin-bottom: 10px; }
.summary-card-neg { background: #FFF3E0; border-left: 6px solid #EF6C00; }
.summary-card-neg h4 { color: #EF6C00; margin-bottom: 10px; }
.summary-card-legal { background: #F8FAFC; border-left: 6px solid var(--navy); border: 1px solid var(--border-light); }
.summary-card-pos p, .summary-card-neg p, .summary-card-legal p { font-size: 14px; color: var(--text-main); line-height: 1.7; }

.nova-analise-bar {
  display: flex; gap: 16px; justify-content: center; margin-top: 40px; padding-top: 32px;
  border-top: 1px solid var(--border-light);
}
.btn-action-outline {
  padding: 12px 24px; border: 2px solid var(--blue-primary); border-radius: 12px;
  background: white; color: var(--blue-primary); font-weight: 700; cursor: pointer;
  display: flex; align-items: center; gap: 10px; transition: var(--transition);
}
.btn-action-outline:hover { background: var(--blue-primary); color: white; }

/* ── MODAIS & FORMULÁRIOS ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(8px); z-index: 2000; display: flex;
  align-items: center; justify-content: center; padding: 24px;
}
.modal-content {
  background: white; border-radius: 24px; width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: modalSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border-light); overflow: hidden;
  position: relative;
}
@keyframes modalSlide { from { opacity: 0; transform: translateY(30px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }

.modal-header {
  padding: 24px 32px; background: #F8FAFC; border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h2 { font-size: 20px; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); transition: var(--transition); }
.modal-close:hover { color: var(--red-dark); transform: rotate(90deg); }

.modal-body { padding: 32px; }

.form-section-title {
  font-size: 13px; font-weight: 800; color: var(--blue-primary);
  text-transform: uppercase; letter-spacing: 0.1em; margin: 24px 0 16px;
  display: flex; align-items: center; gap: 8px;
}
.form-section-title::after { content: ''; flex: 1; height: 1px; background: var(--border-light); }

.form-grid { display: grid; gap: 20px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 600; color: var(--navy);
  margin-bottom: 8px;
}
.form-group input, .form-group select {
  width: 100%; padding: 12px 16px; border: 1.5px solid #E2E8F0;
  border-radius: 12px; font-size: 14px; font-family: var(--font-body);
  transition: var(--transition); background: #FDFDFF;
}
.form-group input:focus, .form-group select:focus {
  outline: none; border-color: var(--blue-primary); background: white;
  box-shadow: 0 0 0 4px rgba(30, 136, 229, 0.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Auth Modals Specific */
.auth-card { max-width: 420px; }
.auth-card .modal-header {
  flex-direction: column;
  gap: 16px;
  padding: 48px 32px 24px;
  text-align: center;
  justify-content: center;
}
.auth-card .modal-header h2 {
  font-size: 24px;
}
.auth-card input { margin-bottom: 0; } 

/* RESPONSIVO */
@media (max-width: 768px) {
  main { padding: 40px 16px; }
  .markers-grid { grid-template-columns: 1fr; }
  .articles-section { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 30px; }
  .hero h1 { font-size: 32px; }
  .logo-text { font-size: 16px; }
  .result-header-bar { flex-direction: column; padding: 30px 20px; }
  .tabs { overflow-x: auto; white-space: nowrap; }
  .tab-btn { min-width: 120px; }
}
