/* =============================================
   CalcMed - Cetoacidose Diabética - Styles
   ============================================= */

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f0f2f5; color: #1a1a2e; }

/* Header */
.app-header { background: #1a2a4a; color: white; padding: 16px 20px; font-size: 18px; font-weight: 700; }

/* Container */
.container { max-width: 700px; margin: 20px auto; padding: 0 12px; }

/* Section Card */
.section-card { background: white; border-radius: 12px; margin-bottom: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); overflow: hidden; }

.section-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; cursor: pointer; user-select: none; border-bottom: 1px solid transparent; transition: background 0.2s; }
.section-header:hover { background: #f7f9fc; }
.section-header.open { border-bottom: 1px solid #eee; }

.star-btn { background: none; border: none; cursor: pointer; color: #1a2a4a; font-size: 18px; padding: 0; }
.section-title { font-size: 15px; font-weight: 700; color: #1a2a4a; flex: 1; }
.chevron { font-size: 13px; color: #888; transition: transform 0.2s; }
.chevron.open { transform: rotate(180deg); }

.section-body { padding: 20px; display: none; }
.section-body.open { display: block; }

/* Subtítulo dentro das seções */
.section-subtitle { font-size: 14px; font-weight: 700; margin-bottom: 16px; color: #1a2a4a; }

/* Critérios */
.criteria-list { list-style: none; }
.criteria-list li { padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 14px; line-height: 1.5; display: flex; gap: 8px; }
.criteria-list li:last-child { border-bottom: none; }
.criteria-list li::before { content: "•"; color: #1a2a4a; font-weight: bold; flex-shrink: 0; }

/* Manejo */
.manejo-hour { font-weight: 700; font-size: 14px; margin-bottom: 10px; color: #1a2a4a; }
.manejo-list { list-style: none; margin-bottom: 16px; }
.manejo-list li { font-size: 13.5px; padding: 6px 0; border-bottom: 1px solid #f0f0f0; display: flex; gap: 8px; line-height: 1.5; }
.manejo-list li:last-child { border-bottom: none; }
.manejo-list li::before { content: "•"; color: #1a2a4a; font-weight: bold; flex-shrink: 0; }

/* Inputs */
.calc-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: #1a2a4a; }
.input-group { margin-bottom: 16px; }
.input-label { font-size: 13px; font-weight: 600; margin-bottom: 6px; display: block; color: #333; }
.input-row { display: flex; align-items: center; border: 1px solid #ddd; border-radius: 8px; overflow: hidden; }
.input-row input { flex: 1; border: none; outline: none; padding: 12px 14px; font-size: 15px; background: white; }
.input-unit { padding: 12px 14px; background: #f7f7f7; font-size: 13px; color: #666; border-left: 1px solid #eee; }

/* Resultado Sódio */
.result-sodio { font-size: 17px; font-weight: 600; margin: 18px 0 14px; color: #1a2a4a; }
.result-sodio span { font-weight: 700; }
.result-sodio span.alto { color: #e74c3c; }
.result-sodio span.normal { color: #2ecc71; }
.result-sodio span.baixo { color: #e67e22; }

/* Toggle buttons */
.toggle-group { margin-bottom: 14px; }
.toggle-label { font-size: 13px; font-weight: 700; margin-bottom: 8px; color: #1a2a4a; }
.toggle-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.toggle-btn { padding: 9px 22px; border-radius: 20px; border: none; cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.2s; background: #e8edf3; color: #555; }
.toggle-btn.active { background: #1a2a4a; color: white; }

/* Info box */
.info-box { background: #f0f4fb; border-radius: 8px; padding: 12px 14px; margin-top: 10px; font-size: 13px; line-height: 1.7; }
.info-box ul { list-style: none; }
.info-box ul li::before { content: "• "; }
.info-box a { color: #e74c3c; text-decoration: underline; }

/* Accordion K+ */
.k-accordion { margin-bottom: 10px; border-radius: 8px; overflow: hidden; }
.k-accordion-header {
  background: #dde3ee;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #1a2a4a;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.k-accordion-header:hover { background: #cdd5e8; }
.k-accordion-body { background: #f7f9fc; padding: 14px 16px; font-size: 13.5px; line-height: 1.8; display: none; }
.k-accordion-body.open { display: block; }
.k-accordion-body p { margin-bottom: 6px; }
.k-accordion-body ul { list-style: none; margin-top: 4px; }
.k-accordion-body ul li::before { content: "• "; color: #1a2a4a; }
.k-chevron { font-size: 13px; color: #555; transition: transform 0.2s; }

/* Insulina */
.alerta-k { font-size: 14px; font-weight: 700; color: #1a2a4a; margin-bottom: 16px; }
.hgt-buttons { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.hgt-btn { padding: 10px 24px; border-radius: 20px; border: none; cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.2s; background: #e8edf3; color: #555; }
.hgt-btn.active { background: #1a2a4a; color: white; }
.result-insulina { background: #f0f4fb; border-radius: 8px; padding: 14px 16px; font-size: 13.5px; line-height: 1.9; }
.result-insulina strong { color: #1a2a4a; }

/* ==========================================================
   ✅ BOTÃO TUTORIAL
   ========================================================== */
.tutorial-btn{
  border: none;
  background: rgba(255,255,255,0.16);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform .15s, background .15s;
  white-space: nowrap;
}
.tutorial-btn:hover{
  background: rgba(255,255,255,0.22);
  transform: translateY(-1px);
}
.tutorial-btn:active{
  transform: translateY(0px);
}

/* ==========================================================
   ✅ MODAL CENTRAL (janela no meio)
   ========================================================== */
body.modal-open { overflow: hidden; }

.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9999;
}

.modal{
  width: min(880px, 96vw);
  max-height: 90vh;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  overflow: hidden;
}

.modal-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #1a2a4a;
  color: #fff;
}

.modal-title{
  font-size: 14.5px;
  font-weight: 900;
}

.modal-close{
  border: none;
  background: rgba(255,255,255,0.18);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
}
.modal-close:hover{ background: rgba(255,255,255,0.25); }

.modal-body{
  padding: 16px;
  overflow: auto;
  max-height: calc(90vh - 56px);
  background: #f7f9fc;
}

/* ==========================================================
   ✅ ESTILO DO TEXTO DO TUTORIAL
   ========================================================== */
.tutorial-content{
  background: transparent;
  color: #1a1a2e;
}

.tutorial-content h2{
  font-size: 15px;
  font-weight: 900;
  color: #1a2a4a;
  margin: 6px 0 10px;
}

.tutorial-content .sub{
  font-size: 13px;
  font-weight: 800;
  color: #1a2a4a;
  margin: 6px 0 8px;
}

.tutorial-content ul{
  list-style: none;
  font-size: 13.5px;
  line-height: 1.75;
  margin-bottom: 10px;
}

.tutorial-content ul li::before{
  content: "• ";
  color: #1a2a4a;
  font-weight: 900;
}

.tutorial-content ul.check li::before{
  content: "";
}
.tutorial-content ul.check li{
  padding-left: 0;
}

.tutorial-content .highlight{
  background: #f0f4fb;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.7;
  margin: 8px 0;
  border: 1px solid #e8edf3;
}

.tutorial-content .quote{
  background: #ffffff;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.2px;
  line-height: 1.7;
  border-left: 4px solid #1a2a4a;
  margin: 8px 0 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.tutorial-content .gold{
  font-size: 13px;
  font-weight: 900;
  color: #b45309;
  margin: 8px 0 6px;
}

.tutorial-content .cardline{
  background: #ffffff;
  border: 1px solid #e8edf3;
  border-radius: 12px;
  padding: 12px;
  font-size: 13.2px;
  line-height: 1.7;
  margin: 10px 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.tutorial-content .mini{
  font-size: 12.4px;
  color: #444;
  margin-top: 6px;
}

.tutorial-content .formula{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: #0f172a;
  color: #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.8px;
  margin: 10px 0;
  overflow-x: auto;
}

.tutorial-content .warn{
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 12px;
  padding: 12px;
  font-size: 13.2px;
  line-height: 1.7;
  margin: 10px 0;
}

.tutorial-content .ok{
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 12px;
  font-size: 13.2px;
  line-height: 1.7;
  margin: 10px 0;
}

.tutorial-content hr{
  border: none;
  border-top: 1px solid #e8edf3;
  margin: 14px 0;
}