/* =============================================
   IOTA Simple Rules Risk — Calculator CSS
   ============================================= */

/* -- Badge medico -- */
.badge-medico {
  background: #ecfeff;
  color: #155e75;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 12px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* -- Field group (Centro oncologico) -- */
.iota-field-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.iota-field-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.iota-field-name {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

/* -- Tooltip -- */
.iota-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
  color: #94a3b8;
  transition: color 0.15s;
}

.iota-tooltip:hover,
.iota-tooltip:focus {
  color: #0e7490;
  outline: none;
}

.iota-tooltip-text {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}

.iota-tooltip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e293b;
}

.iota-tooltip:hover .iota-tooltip-text,
.iota-tooltip:focus .iota-tooltip-text {
  opacity: 1;
}

/* -- Toggle buttons (Presente/Ausente, Sim/Nao) -- */
.iota-toggle-row {
  display: flex;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.iota-toggle-btn {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}

.iota-toggle-btn:not(:last-child) {
  border-right: 1px solid #e2e8f0;
}

.iota-toggle-btn:hover {
  background: #f1f5f9;
}

.iota-toggle-btn.iota-toggle-active {
  background: #0e7490;
  color: #fff;
  font-weight: 600;
}

.iota-toggle-btn:focus-visible {
  outline: 2px solid #0e7490;
  outline-offset: -2px;
  z-index: 1;
}

/* -- Rules sections -- */
.iota-rules-section {
  border-radius: 12px;
  overflow: hidden;
  margin: 20px 24px;
  border: 1px solid #e2e8f0;
}

.iota-rules-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.iota-rules-header-b {
  background: #ecfdf5;
  color: #065f46;
  border-bottom: 1px solid #d1fae5;
}

.iota-rules-header-m {
  background: #fef2f2;
  color: #991b1b;
  border-bottom: 1px solid #fecaca;
}

/* -- Rule rows -- */
.iota-rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.15s;
}

.iota-rule-row:last-child {
  border-bottom: none;
}

.iota-rule-row:hover {
  background: #f8fafc;
}

.iota-rule-row.iota-rule-active-b {
  background: #f0fdf4;
}

.iota-rule-row.iota-rule-active-m {
  background: #fef2f2;
}

.iota-rule-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.iota-rule-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.iota-rule-tag-b {
  background: #d1fae5;
  color: #065f46;
}

.iota-rule-tag-m {
  background: #fecaca;
  color: #991b1b;
}

.iota-rule-name {
  font-size: 13px;
  font-weight: 400;
  color: #334155;
  line-height: 1.4;
}

/* -- Error message -- */
.erro-msg {
  margin: 0 24px;
  padding: 0;
  font-size: 13px;
  font-weight: 500;
  color: #dc2626;
  min-height: 0;
  transition: all 0.2s;
}

.erro-msg:not(:empty) {
  padding: 10px 14px;
  margin: 12px 24px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
}

/* -- Button row -- */
.btn-row {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  align-items: stretch;
}

.btn-calcular {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  background: #0e7490;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}

.btn-calcular:hover {
  background: #0c6379;
}

.btn-calcular:active {
  transform: scale(0.98);
}

.btn-calcular:focus-visible {
  outline: 2px solid #0e7490;
  outline-offset: 2px;
}

.btn-limpar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.btn-limpar:hover {
  background: #e2e8f0;
  color: #475569;
}

.btn-limpar:focus-visible {
  outline: 2px solid #64748b;
  outline-offset: 2px;
}

/* =============================================
   RESULT CARD
   ============================================= */

.iota-result-card {
  overflow: hidden;
}

.iota-result-header {
  background: #0e7490;
  padding: 16px 24px;
}

.iota-result-header h2 {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

/* -- Risk display -- */
.iota-risk-display {
  text-align: center;
  padding: 28px 24px 8px;
}

.iota-risk-value {
  font-size: 48px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1;
  margin-bottom: 4px;
}

.iota-risk-label {
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* -- Classification -- */
.iota-classification {
  text-align: center;
  padding: 16px 24px 24px;
}

.iota-classification-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.iota-classification-badge.risk-very-low {
  background: #d1fae5;
  color: #065f46;
}

.iota-classification-badge.risk-low {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.iota-classification-badge.risk-intermediate {
  background: #fef3c7;
  color: #92400e;
}

.iota-classification-badge.risk-high {
  background: #fed7aa;
  color: #9a3412;
}

.iota-classification-badge.risk-very-high {
  background: #fecaca;
  color: #991b1b;
}

.iota-classification-text {
  font-size: 14px;
  font-weight: 400;
  color: #475569;
  line-height: 1.6;
  max-width: 480px;
  margin: 0 auto;
}

/* -- Visual bars -- */
.iota-bars-wrap {
  padding: 0 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.iota-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.iota-bar-label-text {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.iota-bar-label-pct {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

.iota-bar {
  height: 14px;
  background: #f1f5f9;
  border-radius: 7px;
  overflow: hidden;
}

.iota-bar-fill {
  height: 100%;
  border-radius: 7px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}

.iota-bar-fill-malig {
  background: linear-gradient(90deg, #f87171, #dc2626);
}

.iota-bar-fill-benig {
  background: linear-gradient(90deg, #6ee7b7, #10b981);
}

/* -- Summary -- */
.iota-summary {
  margin: 0 24px 24px;
  padding: 20px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.iota-summary-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 14px;
}

.iota-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.iota-summary-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
}

.iota-summary-item .iota-rule-tag {
  font-size: 10px;
  min-width: 24px;
  height: 20px;
}

.iota-summary-item-present {
  font-weight: 600;
  color: #1e293b;
}

.iota-summary-item-present.iota-summary-b {
  background: #f0fdf4;
}

.iota-summary-item-present.iota-summary-m {
  background: #fef2f2;
}

.iota-summary-oncologia {
  grid-column: 1 / -1;
  background: #f1f5f9;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
}

.iota-summary-oncologia strong {
  color: #1e293b;
}

/* -- Recalculate -- */
.iota-recalc-row {
  display: flex;
  justify-content: center;
  padding: 0 24px 24px;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 640px) {
  .iota-field-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
  }

  .iota-rules-section {
    margin: 16px 16px;
  }

  .iota-rule-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
  }

  .iota-toggle-row {
    width: 100%;
  }

  .iota-toggle-btn {
    flex: 1;
    text-align: center;
    padding: 9px 12px;
  }

  .btn-row {
    padding: 16px;
  }

  .iota-risk-value {
    font-size: 40px;
  }

  .iota-summary-grid {
    grid-template-columns: 1fr;
  }

  .iota-bars-wrap {
    padding: 0 16px 20px;
  }

  .iota-summary {
    margin: 0 16px 20px;
  }

  .iota-classification {
    padding: 12px 16px 20px;
  }

  .iota-risk-display {
    padding: 20px 16px 8px;
  }

  .iota-result-header {
    padding: 14px 16px;
  }

  .iota-recalc-row {
    padding: 0 16px 20px;
  }

  .iota-tooltip-text {
    white-space: normal;
    min-width: 200px;
    left: 0;
    transform: none;
  }

  .iota-tooltip-text::after {
    left: 12px;
    transform: none;
  }

  .erro-msg:not(:empty) {
    margin: 12px 16px;
  }
}

/* ── Image tooltip button ── */
.iota-img-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #0e7490;
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-left: 6px;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
}
.iota-img-btn:hover {
  background: #155e75;
  transform: scale(1.1);
}

/* ── Image modal overlay ── */
.iota-img-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.iota-img-modal.active {
  display: flex;
}
.iota-img-modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  position: relative;
}
.iota-img-modal-content img {
  width: 100%;
  border-radius: 8px;
  display: block;
}
.iota-img-modal-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #0f172a;
  color: #fff;
  border: 2px solid #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.iota-img-modal-alt {
  font-size: 12px;
  color: #64748b;
  text-align: center;
  margin-top: 8px;
}

/* ── Card padding fix ── */
#iota-card {
  padding: 28px;
}
#iota-card .card-header {
  margin-bottom: 20px;
}
#iota-card .card-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px;
}
#iota-card .card-header-sub {
  font-size: 13px;
  color: #64748b;
  margin: 0;
  line-height: 1.5;
}
.iota-result-card {
  padding: 28px;
}

/* ── Disclaimer (yellow, like Barcelona) ── */
.iota-disclaimer {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 12px;
  color: #92400e;
  margin: 16px 0 24px;
  line-height: 1.6;
}
.iota-disclaimer strong {
  font-weight: 700;
}
