/* Custom Styles for GFR Calculator */

/* App Container Layout */
.app-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 20px;
}

.intro-section {
  margin-bottom: 2rem;
  color: var(--text-muted);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  background: var(--card-bg);
  padding: 2rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.intro-image {
  max-width: 100%;
  height: auto;
  max-height: 250px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  object-fit: contain;
}

.intro-text p {
  line-height: 1.6;
  margin: 0;
  font-size: 1.1rem;
}

.grid-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 992px) {
  .intro-section {
    flex-direction: row;
    text-align: left;
    padding: 2.5rem;
    gap: 3rem;
  }

  .intro-image-wrapper {
    flex: 0 0 240px;
  }

  .intro-image {
    max-height: 240px;
    width: 100%;
  }

  .intro-text p {
    font-size: 1.25rem;
  }

  .grid-layout {
    grid-template-columns: 1fr 1fr;
  }

  .kdigo-card {
    grid-column: 1 / -1;
  }
}

/* Form Elements */
.input-group {
  margin-bottom: 1.25rem;
}

.input-group label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.input-group input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  color: var(--text-main);
  background-color: var(--bg-color);
  transition: all 0.2s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Segments */
.segment-container {
  display: flex;
  background-color: var(--bg-color);
  border-radius: var(--radius-md);
  padding: 0.25rem;
}

.segment-btn {
  flex: 1;
  padding: 0.75rem 0.5rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.segment-btn .sub {
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 2px;
  opacity: 0.8;
}

.segment-btn.active {
  background-color: var(--card-bg);
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.segment-btn.active[data-value="F"] {
  color: #ef4444;
}

/* Toggle switch */
.toggle-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.toggle-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Result Box */
.formula-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  justify-content: center;
}

.formula-btn {
  padding: 0.5rem 1rem;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.formula-btn.active {
  background-color: #eff6ff;
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.score-box {
  background-color: var(--bg-color);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  margin-bottom: 2rem;
  transition: all 0.3s ease;
}

.stage-text {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.score-value-wrapper {
  display: flex;
  justify-content: center;
  align-items: baseline;
}

.score-value {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1;
}

.score-unit {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.5rem;
}

.simple-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 400px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--border-color);
}

.simple-table th, .simple-table td {
  padding: 0.75rem 0.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

.simple-table th {
  background-color: var(--bg-color);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.simple-table td {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.simple-table tr.active {
  background-color: #fef08a; /* active row highlight */
}

.simple-table tr.active td {
  font-weight: 700;
  color: #b45309;
}

/* KDIGO Table */
.kdigo-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
  border: 1px solid var(--border-color);
}

.kdigo-table th, .kdigo-table td {
  border: 1px solid var(--border-color);
  padding: 0;
  text-align: center;
  height: 3rem;
  position: relative;
}

.kdigo-table th {
  background-color: var(--bg-color);
  padding: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-main);
}

.kdigo-table td.cell-color {
  transition: all 0.2s ease;
}

/* Tailwind 300 series vivid backgrounds */
.bg-green { background-color: #86efac !important; }
.bg-yellow { background-color: #fde047 !important; }
.bg-orange { background-color: #fdba74 !important; }
.bg-red { background-color: #fca5a5 !important; }

/* Tailwind 600 series vivid text */
.text-green { color: #16a34a !important; }
.text-yellow { color: #d97706 !important; }
.text-orange { color: #ea580c !important; }
.text-red { color: #dc2626 !important; }

/* Active cells styling */
.active-row-header {
  background-color: #eff6ff !important;
  color: var(--primary-color) !important;
  font-weight: 800 !important;
}
.active-col-header {
  background-color: #eff6ff !important;
  color: var(--primary-color) !important;
}
.kdigo-table td.active-intersection {
  border: 4px solid #1e40af !important;
  z-index: 20 !important;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.kdigo-table tr.active-row td {
  border-top: 2px solid var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
}
.kdigo-table td.active-col {
  border-left: 2px solid var(--primary-color);
  border-right: 2px solid var(--primary-color);
}

/* Risk Display Label */
.risk-display {
  text-align: center;
  margin-bottom: 1.5rem;
}
.risk-text {
  font-size: 1.5rem;
  font-weight: 800;
}

/* Legend */
.legend-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
}

.legend-text {
  font-size: 0.85rem;
  font-weight: 700;
}

/* Links & Buttons */
.link-btn {
  background: none;
  border: none;
  color: var(--primary-color);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.primary-btn {
  width: 100%;
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  padding: 1rem;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.primary-btn:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background-color: var(--card-bg);
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  overflow: hidden;
}

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

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

.lbm-result-box {
  background-color: var(--bg-color);
  padding: 1rem;
  border-radius: var(--radius-md);
  text-align: center;
  margin-top: 1rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Info Section Styles */
.info-section {
  margin-top: 3rem;
  margin-bottom: 2rem;
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.info-section h2 {
  text-align: center;
  color: var(--text-main);
  margin-bottom: 2.5rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 992px) {
  .info-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.info-box {
  background: var(--bg-color);
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  height: 100%;
}

.info-box:hover {
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  transform: translateY(-2px);
  border-color: #bfdbfe;
}

.info-box h3 {
  margin-top: 0;
  margin-bottom: 1.25rem;
  color: var(--primary-color) !important;
  font-weight: 800;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px dashed var(--border-color);
}

.info-box ul, .info-box ol {
  padding-left: 1.5rem;
  margin: 0;
  color: var(--text-main);
}

.info-box li {
  margin-bottom: 0.85rem;
  line-height: 1.7;
  font-size: 0.95rem;
  font-weight: 500;
}
.info-box li:last-child {
  margin-bottom: 0;
}
