/* ==========================================================================
   MELD SCORE CALCULATOR DEDICATED STYLESHEET
   Heart Score Calculator - Liver Disease Severity & Organ Allocation
   Matches Wells, TIMI & GRACE design language (.wells-*, .timi-*)
   ========================================================================== */

/* Reading Progress Bar */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #1d3557, #e63946, #10b981);
  width: 0%;
  z-index: 9999;
  transition: width 0.1s ease;
}

/* Breadcrumb Navigation */
.meld-breadcrumb {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
  color: #64748b;
  font: 500 13px/1.4 'Inter', sans-serif;
}
.meld-breadcrumb a {
  color: #1d3557;
  text-decoration: none;
  transition: color 0.15s ease;
}
.meld-breadcrumb a:hover {
  color: #e63946;
  text-decoration: underline;
}

/* Hero Section */
.meld-hero-grid {
  align-items: start;
}
.meld-hero .update-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 9999px;
  background: #f1f5f9;
  color: #334155;
  font: 600 12px 'Inter', sans-serif;
  margin-bottom: 12px;
}
.meld-hero .update-badge i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
  animation: meldPulse 2s infinite ease-in-out;
}
@keyframes meldPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.15); }
}

.meld-lead {
  font-size: 16px;
  line-height: 1.75;
  color: #334155;
  margin-bottom: 16px;
}
.meld-direct {
  margin: 20px 0;
  padding: 16px 18px;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #1d4ed8;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e3a8a;
  font: 13.5px/1.65 'Inter', sans-serif;
}
.meld-stats {
  margin-bottom: 20px;
}

/* Calculator Card (.meld-card) */
.meld-card {
  padding: 24px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}
.meld-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 15px;
}
.meld-card-head span {
  color: #e63946;
  font: 700 10px 'Inter', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.meld-card-head h2 {
  margin: 3px 0 0;
  font-size: 20px;
  font-family: 'Lexend', sans-serif;
  color: #1d3557;
}
.meld-card-head > b {
  padding: 5px 10px;
  border-radius: 99px;
  background: #dcfce7;
  color: #166534;
  font: 700 10px 'Lexend', sans-serif;
  white-space: nowrap;
}

/* Presets Bar */
.meld-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.meld-presets > span {
  color: #64748b;
  font: 700 10.5px 'Lexend', sans-serif;
  text-transform: uppercase;
}
.meld-preset-btn {
  padding: 4px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 99px;
  background: #ffffff;
  color: #1d3557;
  cursor: pointer;
  font: 600 10.5px 'Lexend', sans-serif;
  transition: all 0.15s ease;
}
.meld-preset-btn:hover {
  border-color: #1d3557;
  background: #f1f5f9;
}
.meld-preset-btn.is-active,
.meld-preset-btn.active {
  background: #1d3557;
  color: #ffffff;
  border-color: #1d3557;
}

/* Form Grid */
.meld-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 580px) {
  .meld-form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.meld-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.meld-field-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.meld-field-label {
  font-size: 12px;
  font-weight: 700;
  color: #1d3557;
  font-family: 'Lexend', sans-serif;
}
.meld-field-sub {
  font-size: 10.5px;
  color: #64748b;
  font-family: 'Inter', sans-serif;
}

/* Unit Pill Switcher */
.meld-unit-pills {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 5px;
  padding: 1.5px;
}
.unit-pill {
  border: none;
  background: transparent;
  padding: 2px 6px;
  border-radius: 3.5px;
  font: 700 9.5px 'Lexend', sans-serif;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}
.unit-pill.is-active,
.unit-pill.active {
  background: #ffffff;
  color: #1d3557;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Input Wrappers */
.meld-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.meld-field {
  width: 100%;
  padding: 9px 12px;
  background: #f8fafc;
  border: 1.5px solid #dbe3ed;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 600;
  color: #0f172a;
  outline: none;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
  box-sizing: border-box;
}
.meld-field:focus {
  background: #ffffff;
  border-color: #1d3557;
  box-shadow: 0 0 0 3px rgba(29, 53, 87, 0.1);
}
.meld-field-unit {
  position: absolute;
  right: 10px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  pointer-events: none;
}
.meld-hint {
  font-size: 10px;
  color: #64748b;
}

/* Sex Segmented Pill */
.meld-seg-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.meld-seg-opt {
  display: block;
  cursor: pointer;
}
.meld-seg-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.meld-seg-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 36px;
  border: 1.5px solid #dbe3ed;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font: 700 11.5px 'Lexend', sans-serif;
  transition: all 0.15s ease;
  user-select: none;
}
.meld-seg-opt input:checked + .meld-seg-pill {
  border-color: #1d3557;
  background: #1d3557;
  color: #ffffff;
}

/* Dialysis Card */
.meld-check-card {
  grid-column: 1 / -1;
  background: #fffbeb;
  border: 1.5px solid #fef08a;
  border-radius: 9px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.meld-check-card:hover {
  border-color: #fde047;
}
.meld-check-card.is-active,
.meld-check-card.active {
  background: #fef08a;
  border-color: #ca8a04;
}
.meld-check-card input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: #ca8a04;
  cursor: pointer;
}
.meld-check-info strong {
  display: block;
  font-size: 12px;
  color: #854d0e;
  font-family: 'Lexend', sans-serif;
}
.meld-check-info small {
  display: block;
  font-size: 10.5px;
  color: #92400e;
  line-height: 1.35;
  margin-top: 2px;
}

/* ==========================================================================
   Clean Result Assessment Box (Light, Matching Wells & TIMI)
   ========================================================================== */
.meld-result-card {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}
.meld-result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.meld-result-head span {
  display: block;
  color: #e63946;
  font: 700 9.5px 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.meld-result-head h2 {
  margin: 2px 0 0;
  font-size: 17px;
  font-family: 'Lexend', sans-serif;
  color: #1d3557;
}
.meld-result-head > b {
  padding: 5px 10px;
  border-radius: 99px;
  font: 700 10.5px 'Lexend', sans-serif;
}
.meld-result-head > b.is-low { background: #dcfce7; color: #166534; }
.meld-result-head > b.is-mod { background: #fef3c7; color: #92400e; }
.meld-result-head > b.is-high { background: #ffedd5; color: #9a3412; }
.meld-result-head > b.is-severe { background: #fee2e2; color: #991b1b; }

/* Large Score Value */
.meld-score-display {
  padding: 14px 0 10px;
  text-align: center;
}
.meld-score-display strong {
  font: 800 46px 'Lexend', sans-serif;
  color: #15803d;
  line-height: 1;
  transition: color 0.3s ease;
}
.meld-score-display span {
  font: 700 18px 'Lexend', sans-serif;
  color: #64748b;
  margin-left: 4px;
}
.meld-score-display p {
  margin: 6px 0 0;
  color: #334155;
  font: 600 12.5px 'Inter', sans-serif;
}

/* Gauge Bar */
.meld-gauge-wrap {
  margin: 10px 0 16px;
}
.meld-gauge-bar {
  height: 8px;
  border-radius: 99px;
  background: #e2e8f0;
  overflow: hidden;
  position: relative;
}
.meld-gauge-fill {
  height: 100%;
  width: 10%;
  border-radius: 99px;
  background: #10b981;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s ease;
}
.meld-gauge-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font: 600 9px 'Inter', sans-serif;
  color: #64748b;
}

/* 4 Multi-Model Outcome Grid */
.meld-models-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
@media (min-width: 480px) {
  .meld-models-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.meld-model-box {
  padding: 10px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  text-align: center;
  transition: all 0.2s ease;
}
.meld-model-box.is-active {
  border-color: #10b981;
  background: #f0fdf4;
}
.meld-model-box span {
  display: block;
  font: 700 8.5px 'Inter', sans-serif;
  color: #64748b;
  text-transform: uppercase;
}
.meld-model-box strong {
  display: block;
  margin: 3px 0 1px;
  font: 800 16px 'Lexend', sans-serif;
  color: #1d3557;
}
.meld-model-box small {
  display: block;
  font: 500 9px 'Inter', sans-serif;
  color: #64748b;
}

/* Pathway Card */
.meld-pathway-card {
  margin: 10px 0 14px;
  padding: 12px 14px;
  border-left: 4px solid #166534;
  border-radius: 8px;
  background: #f0fdf4;
  color: #166534;
  font: 12px/1.6 'Inter', sans-serif;
}
.meld-pathway-card.is-low { border-color: #166534; background: #f0fdf4; color: #166534; }
.meld-pathway-card.is-mod { border-color: #d97706; background: #fffbeb; color: #92400e; }
.meld-pathway-card.is-high { border-color: #ea580c; background: #fff7ed; color: #9a3412; }
.meld-pathway-card.is-severe { border-color: #dc2626; background: #fef2f2; color: #991b1b; }

/* Action Buttons */
.meld-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  margin-top: 14px;
}
.meld-btn-calc {
  padding: 11px 16px;
  border: 0;
  border-radius: 8px;
  background: #1d3557;
  color: #ffffff;
  cursor: pointer;
  font: 700 12.5px 'Lexend', sans-serif;
  transition: background 0.15s ease;
  text-align: center;
}
.meld-btn-calc:hover {
  background: #0f172a;
}
.meld-btn-sec {
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  font: 600 11.5px 'Lexend', sans-serif;
  transition: all 0.15s ease;
}
.meld-btn-sec:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

/* ==========================================================================
   Article & Editorial Detail Layout (.meld-detail)
   ========================================================================== */
.meld-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 36px;
  align-items: start;
}
@media (max-width: 991px) {
  .meld-layout {
    grid-template-columns: 1fr;
  }
}
.meld-layout .main-article {
  min-width: 0;
}
.main-article h2 {
  font-family: 'Lexend', sans-serif;
  color: #1d3557;
  font-size: 22px;
  margin: 32px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid #e2e8f0;
}
.main-article h3 {
  font-family: 'Lexend', sans-serif;
  color: #1d3557;
  font-size: 17px;
  margin: 22px 0 10px;
}
.main-article p {
  font-size: 15px;
  line-height: 1.75;
  color: #334155;
  margin-bottom: 16px;
}
.main-article ul,
.main-article ol {
  margin: 0 0 20px 20px;
  color: #334155;
  font-size: 14.5px;
  line-height: 1.7;
}
.main-article li {
  margin-bottom: 8px;
}

/* Mandatory Brand Link Styling */
a.text-link {
  color: #E63946 !important;
  font-weight: 600;
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
  text-decoration-color: rgba(230, 57, 70, 0.45) !important;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
a.text-link:hover {
  color: #c0303c !important;
  text-decoration-color: #c0303c !important;
}

/* Infographic Card */
.meld-infographic-card {
  margin: 24px 0 32px;
  text-align: center;
}
.meld-infographic-card img {
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}
.meld-infographic-card figcaption {
  margin-top: 10px;
  color: #64748b;
  font: 500 12.5px 'Inter', sans-serif;
}

/* Math & Equation Cards */
.meld-math-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-left: 5px solid #1d3557;
  border-radius: 12px;
  padding: 18px 20px;
  margin: 20px 0;
  font-family: 'Inter', monospace;
  font-size: 14px;
  line-height: 1.6;
  color: #0f172a;
  overflow-x: auto;
}

/* Tables */
.meld-table-wrap {
  overflow-x: auto;
  margin: 24px 0;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}
.meld-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}
.meld-table-wrap th {
  background: #f8fafc;
  color: #1e293b;
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 2px solid #e2e8f0;
}
.meld-table-wrap td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: top;
}
.meld-table-wrap tr:hover td {
  background: #fafafa;
}

/* Callouts */
.meld-callout {
  border-radius: 12px;
  padding: 18px 20px;
  margin: 22px 0;
  border: 1px solid transparent;
}
.meld-callout.is-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}
.meld-callout.is-info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}
.meld-callout h4 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.meld-callout p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
}

/* Case Study Boxes */
.meld-case-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 5px solid #1d3557;
  border-radius: 12px;
  padding: 20px;
  margin: 22px 0;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}
.meld-case-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.meld-case-tag {
  background: #f1f5f9;
  color: #334155;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

/* FAQs Accordion */
.meld-faq-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}
.meld-faq-item summary {
  padding: 14px 18px;
  font-weight: 700;
  color: #1e293b;
  font-size: 14.5px;
  cursor: pointer;
  background: #ffffff;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.meld-faq-item summary::-webkit-details-marker {
  display: none;
}
.meld-faq-item summary::after {
  content: "+";
  font-size: 18px;
  font-weight: 600;
  color: #64748b;
}
.meld-faq-item[open] summary::after {
  content: "−";
  color: #e63946;
}
.meld-faq-content {
  padding: 14px 18px 18px;
  background: #f8fafc;
  font-size: 14px;
  line-height: 1.65;
  color: #475569;
  border-top: 1px solid #e2e8f0;
}

/* Author Badge */
.meld-author {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px;
  margin-top: 32px;
}
.meld-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #1d3557;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
  flex-shrink: 0;
}
.meld-author-text span {
  display: block;
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.meld-author-text h2 {
  font-size: 15.5px;
  font-weight: 700;
  color: #1e293b;
  margin: 2px 0 4px;
  border: none;
  padding: 0;
}

/* Print Styles */
@media print {
  .meld-breadcrumb, .meld-presets, .meld-actions, .sidebar, #progress-bar, header, footer {
    display: none !important;
  }
  .grid-2, .meld-layout {
    display: block !important;
  }
  .meld-card, .meld-result-card {
    box-shadow: none !important;
    border: 1px solid #000000 !important;
    background: #ffffff !important;
    color: #000000 !important;
  }
}
