/**
 * EndoBora Modern Theme
 * Same colors as original, modern layout
 */

/* ========================================
   BASE
   ======================================== */

body.theme-modern {
  font-family: 'Inter', 'Source Sans Pro', -apple-system, sans-serif;
  background: #e6f0fa;
  -webkit-font-smoothing: antialiased;
}

/* ========================================
   TOP BAR
   ======================================== */

body.theme-modern .top-bar {
  background: #2c3e50;
  padding: 14px 24px;
  padding-left: 64px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: 36px; /* Content height, total ~64px with padding */
}

/* Push content below fixed topbar */
body.theme-modern .container {
  margin-top: 64px;
}

body.theme-modern .theme-toggle-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}

body.theme-modern .theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

body.theme-modern .language-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
}

body.theme-modern .language-toggle button {
  padding: 8px 12px;
  font-weight: 600;
  font-size: 13px;
  margin: 0;
}

body.theme-modern .language-toggle button.active-language {
  background: #2980b9;
  border-radius: 6px;
}

/* ========================================
   HAMBURGER
   ======================================== */

body.theme-modern .hamburger-menu {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 250;
}

body.theme-modern .hamburger-menu button {
  background: rgba(255, 255, 255, 0.1);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  font-size: 18px;
  color: #e6f0fa;
}

/* ========================================
   SIDEBAR
   ======================================== */

body.theme-modern .sidebar {
  background: #ffffff;
  width: 240px;
  padding: 16px 10px;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.06);
  border-right: none;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Ensure nav doesn't create its own scrollbar */
body.theme-modern .sidebar nav {
  overflow: visible;
  height: 100%;
}

body.theme-modern .sidebar nav ul li {
  padding: 11px 14px;
  border-radius: 10px;
  margin: 2px 0;
  font-size: 14px;
  font-weight: 450;
  color: #2c3e50;
  transition: all 0.15s ease;
}

body.theme-modern .sidebar nav ul li:hover {
  background: #e6f0fa;
}

body.theme-modern .sidebar nav ul li.active-calculator {
  background: #2980b9;
  color: #fff;
  font-weight: 500;
}

body.theme-modern .sidebar li.sublist-title {
  font-size: 11px;
  font-weight: 700;
  color: #8e9aaf;
  padding: 10px 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

body.theme-modern .sidebar li.sublist-title span.sublist-title {
  color: inherit;
  padding: 0;
}

body.theme-modern .sidebar li.sublist-title:hover {
  background: #f0f4f8;
  color: #475569;
}

/* Remove the inner darker hover on the span from forms-buttons.css */
body.theme-modern .sidebar li.sublist-title span.sublist-title:hover {
  background-color: transparent !important;
}

body.theme-modern .sidebar .separator-bar {
  border-color: #e2e8f0;
  margin: 16px 12px;
}

/* ========================================
   CONTENT
   ======================================== */

body.theme-modern .content {
  background: #e6f0fa;
  padding: 24px 32px;
  flex: 1;
  transition: margin-left 0.3s ease-in-out;
}

/* When sidebar is hidden, content extends into sidebar space */
body.theme-modern .sidebar.hidden ~ .content {
  margin-left: -216px; /* Pull content left into sidebar's space (240px - 24px sliver) */
}

/* ========================================
   WIDTH CONSTRAINT SYSTEM
   All calculator content is constrained to 600px max-width
   to maintain readability and consistent appearance
   ======================================== */

/* Base rule: All direct children of .content get max-width */
body.theme-modern .content > *:not(.welcome-content) {
  max-width: 600px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Explicit selectors for calculator elements - descendant and child selectors */
body.theme-modern .content .calculator-header,
body.theme-modern .content .info-bubble,
body.theme-modern .content .calculator-form,
body.theme-modern .content .result,
body.theme-modern .content > .form-group,
body.theme-modern .content > button,
body.theme-modern .content > h4,
body.theme-modern .content > hr,
body.theme-modern .content > p {
  max-width: 600px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Form elements inside forms should fill their container */
body.theme-modern .content .calculator-form .form-group,
body.theme-modern .content form .form-group {
  max-width: 100%;
  width: 100%;
}

body.theme-modern .calculator-header {
  margin-bottom: 20px;
  padding-top: 0;
  min-height: 44px; /* Consistent height whether info button exists or not */
  display: flex;
  align-items: center;
}

/* ========================================
   UNIFORM SPACING SYSTEM
   All form elements use consistent gaps:
   - 16px between form-groups
   - 6px between label and input
   - 8px gap within toggle/mode buttons
   - 20px before/after major sections
   ======================================== */

body.theme-modern .calculator-header h3 {
  font-size: 26px;
  font-weight: 700;
  color: #2c3e50;
  margin: 0;
  letter-spacing: -0.02em;
}

/* ========================================
   INFO BUTTON
   ======================================== */

body.theme-modern .info-button {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #2980b9;
  color: white;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}

body.theme-modern .info-button:hover {
  transform: scale(1.1);
}

body.theme-modern .info-bubble {
  background: #ffffff;
  border-radius: 12px;
  padding: 16px 20px;
  margin-top: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  font-size: 14px;
  line-height: 1.6;
  color: #475569;
  border-left: 4px solid #2980b9;
}

/* ========================================
   CARDS
   ======================================== */

/* No extra card wrapper for forms - display directly on background */

/* ========================================
   FORM ELEMENTS
   ======================================== */

body.theme-modern .form-group {
  margin-bottom: 16px;
}

body.theme-modern .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}

/* Mode selectors (toggle groups) have same spacing as form-groups */
body.theme-modern .mode-selector {
  margin-bottom: 16px;
}

/* Mode hints below toggle buttons */
body.theme-modern .mode-hints {
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
}

/* Helper text below inputs */
body.theme-modern .helper-text {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
}

/* Section headers within forms (h4) */
body.theme-modern form h4,
body.theme-modern .calculator-form h4 {
  margin-top: 20px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
  border-bottom: 1px solid #d1d9e6;
  padding-bottom: 6px;
}

/* First h4 after form start doesn't need extra top margin */
body.theme-modern form h4:first-child,
body.theme-modern .form-group + h4 {
  margin-top: 16px;
}

/* Checkbox/radio form-groups are slightly tighter */
body.theme-modern .form-group:has(input[type="checkbox"]),
body.theme-modern .form-group:has(input[type="radio"]) {
  margin-bottom: 10px;
}

/* But consecutive checkbox groups can be tighter still */
body.theme-modern .form-group:has(input[type="checkbox"]) + .form-group:has(input[type="checkbox"]),
body.theme-modern .form-group:has(input[type="radio"]) + .form-group:has(input[type="radio"]) {
  margin-bottom: 10px;
}

body.theme-modern .form-group input[type="number"],
body.theme-modern .form-group input[type="text"],
body.theme-modern .form-group input[type="date"],
body.theme-modern .form-group select,
body.theme-modern .form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d1d9e6;
  border-radius: 10px;
}

/* All select dropdowns get chevron indicator */
body.theme-modern .form-group select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background: #ffffff;
  color: #2c3e50;
  font-size: 15px;
  font-family: inherit;
  box-sizing: border-box;
  height: 46px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Date inputs - ensure proper sizing within container */
body.theme-modern .form-group input[type="date"] {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

body.theme-modern .form-group input:focus,
body.theme-modern .form-group select:focus {
  outline: none;
  border-color: #2980b9;
  box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.15);
}

body.theme-modern .form-group input::placeholder {
  color: #94a3b8;
}

/* Input with unit */
body.theme-modern .input-with-unit .unit-label,
body.theme-modern .input-with-unit .unit {
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
}

body.theme-modern .input-with-unit input {
  padding-right: 40px !important;
}

/* Unit select dropdowns with chevron indicator */
body.theme-modern .input-with-unit select.unit-select,
body.theme-modern select.unit-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #fff;
  border: 1px solid #d1d9e6;
  border-radius: 10px;
  padding: 10px 32px 10px 12px;
  font-size: 14px;
  color: #1e293b;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

body.theme-modern .input-with-unit select.unit-select:focus,
body.theme-modern select.unit-select:focus {
  outline: none;
  border-color: #2980b9;
  box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.15);
}

/* ========================================
   BUTTONS
   ======================================== */

body.theme-modern .btn,
body.theme-modern .btn2 {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid #d1d9e6;
  background: #f8fafc;
  color: #475569;
  transition: all 0.15s ease;
}

body.theme-modern .btn:hover,
body.theme-modern .btn2:hover {
  background: #e6f0fa;
  border-color: #2980b9;
}

body.theme-modern .submit-button {
  background: #2980b9;
  color: white;
  padding: 12px 24px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  transition: background 0.15s ease;
  margin-top: 16px;
}

body.theme-modern .submit-button:hover {
  background: #1f6a9a;
}

/* Form rows (used in some calculators like Diabetes Prescription) */
body.theme-modern .form-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  margin-bottom: 12px;
  gap: 8px;
  align-items: stretch;
}

body.theme-modern .form-row .cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #d1d9e6;
  border-radius: 10px;
  background-color: #fff;
  font-size: 14px;
  color: #1e293b;
  box-sizing: border-box;
}

body.theme-modern .form-row .cell.label {
  justify-content: flex-start;
  background-color: #f8fafc;
  font-weight: 500;
}

body.theme-modern .form-row.titles .cell {
  background-color: #e8eef4;
  font-weight: 600;
  color: #475569;
  border-color: #cbd5e1;
}

body.theme-modern .form-row .dose-input {
  background-color: #fff;
  border: 1px solid #3b82f6;
  color: #1e293b;
  font-size: 14px;
  text-align: center;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  box-sizing: border-box;
}

body.theme-modern .form-row .dose-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

body.theme-modern .form-row .box-output {
  background-color: #f0f9ff;
  border-color: #93c5fd;
  font-weight: 600;
  color: #1d4ed8;
}

body.theme-modern .form-row .insulin-type-select {
  background-color: #fff;
  border: 1px solid #d1d9e6;
  border-radius: 10px;
  padding: 8px 28px 8px 12px;
  font-size: 14px;
  color: #1e293b;
  min-height: 44px;
  min-width: 0;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

body.theme-modern .form-row .insulin-type-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Source reference links */
body.theme-modern .source-reference {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: #64748b;
}

/* Output fields (read-only result displays) */
body.theme-modern .output-field {
  background-color: #f8fafc;
  padding: 12px 14px;
  margin-top: 16px;
  border: 1px solid #d1d9e6;
  border-radius: 10px;
}

/* Patch container (visual diagrams) */
body.theme-modern .patch-container {
  margin-top: 16px;
  margin-bottom: 16px;
}

/* Graph containers */
body.theme-modern #lt4DoseGraph,
body.theme-modern .binder-chart,
body.theme-modern .chart-container,
body.theme-modern canvas {
  margin-top: 16px;
}

/* Toggle Buttons */
body.theme-modern .toggle-buttons {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 0;
}

body.theme-modern .toggle-buttons .toggle-btn {
  flex: 1;
}

/* Mode Switch (similar to toggle-buttons) */
body.theme-modern .mode-switch {
  display: flex;
  gap: 8px;
  width: 100%;
}

body.theme-modern .mode-switch .mode-btn {
  flex: 1;
}

/* Button Group - for generic button groups */
body.theme-modern .button-group {
  display: flex;
  gap: 8px;
  width: 100%;
}

body.theme-modern .button-group .btn,
body.theme-modern .button-group .btn2 {
  flex: 1;
  text-align: center;
}

/* Buttons with subtitles */
body.theme-modern .button-group .btn .btn-title,
body.theme-modern .button-group .btn .btn-subtitle {
  display: block;
}

body.theme-modern .button-group .btn .btn-title {
  font-weight: 600;
  font-size: 14px;
}

body.theme-modern .button-group .btn .btn-subtitle {
  font-weight: 400;
  font-size: 11px;
  opacity: 0.8;
  margin-top: 2px;
}

body.theme-modern .toggle-btn,
body.theme-modern .btn,
body.theme-modern .btn2 {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  background: #f8fafc;
  border: 1px solid #d1d9e6;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

body.theme-modern .toggle-btn:hover,
body.theme-modern .btn:hover,
body.theme-modern .btn2:hover {
  background: #e6f0fa;
  border-color: #2980b9;
}

body.theme-modern .toggle-btn.active,
body.theme-modern .btn.active,
body.theme-modern .btn2.active {
  background: #2980b9;
  border-color: #2980b9;
  color: #fff;
}

/* Mode selector buttons ONLY - light blue unselected state */
/* Only for calculation/dosing mode selectors, NOT type/option selectors */
body.theme-modern .calc-mode-btn:not(.active),
body.theme-modern .dosing-mode-btn:not(.active),
body.theme-modern .mode-switch .btn:not(.active),
body.theme-modern .btn.mode-btn:not(.active),
body.theme-modern .toggle-btn[data-mode]:not(.active),
body.theme-modern .toggle-btn[data-calc-mode]:not(.active) {
  background: #e6f3fb;
  border-color: #b8d4e8;
  color: #2980b9;
}

body.theme-modern .calc-mode-btn:not(.active):hover,
body.theme-modern .dosing-mode-btn:not(.active):hover,
body.theme-modern .mode-switch .btn:not(.active):hover,
body.theme-modern .btn.mode-btn:not(.active):hover,
body.theme-modern .toggle-btn[data-mode]:not(.active):hover,
body.theme-modern .toggle-btn[data-calc-mode]:not(.active):hover {
  background: #d0e8f5;
  border-color: #2980b9;
}

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

body.theme-modern .result {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px 24px;
  margin-top: 20px;
  margin-bottom: 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border-left: 4px solid #2980b9;
}

body.theme-modern .result:empty {
  display: none;
}

/* Result Sections - for grouping related items */
body.theme-modern .result-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e8eef4;
}

body.theme-modern .result-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* Result Section Headers */
body.theme-modern .result h5,
body.theme-modern .result-section h5 {
  margin: 0 0 12px 0;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  border: none;
}

/* Result Rows */
body.theme-modern .result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}

body.theme-modern .result-row:last-child,
body.theme-modern .result-section .result-row:last-child {
  border-bottom: none;
}

body.theme-modern .result-row:first-child {
  padding-top: 0;
}

/* Result Label */
body.theme-modern .result-label {
  color: #475569;
  font-size: 14px;
  font-weight: 500;
}

/* Result Value */
body.theme-modern .result-value {
  font-weight: 600;
  color: #1e293b;
  font-size: 15px;
  text-align: right;
}

/* Highlighted Result Row */
body.theme-modern .result-row.highlight {
  background: #e6f3fb;
  padding: 12px 14px;
  border-radius: 8px;
  margin: 8px -14px;
  border-bottom: none;
}

body.theme-modern .result-row.highlight .result-value {
  color: #2980b9;
  font-size: 16px;
}

/* Result Helper Text */
body.theme-modern .result-helper {
  color: #94a3b8;
  font-size: 12px;
  padding: 4px 0 8px 0;
  margin-top: -4px;
}

/* Result Separators */
body.theme-modern .result hr {
  border: none;
  border-top: 1px solid #e8eef4;
  margin: 16px 0;
}

/* Warning Messages in Results */
body.theme-modern .warning-message {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  margin: 8px 0;
  font-size: 13px;
  font-weight: 500;
}

body.theme-modern .warning-message::before {
  margin-right: 8px;
  font-size: 16px;
}

body.theme-modern .warning-message.warning {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
}

body.theme-modern .warning-message.warning::before {
  content: '⚠️';
}

body.theme-modern .warning-message.error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

body.theme-modern .warning-message.error::before {
  content: '🚫';
}

body.theme-modern .warning-message.info {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e40af;
}

body.theme-modern .warning-message.info::before {
  content: 'ℹ️';
}

body.theme-modern .warning-message.success {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
}

body.theme-modern .warning-message.success::before {
  content: '✓';
}

/* ========================================
   SCALE IMAGES
   ======================================== */

body.theme-modern .scale-images-container {
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 16px 0;
  box-shadow: none;
}

body.theme-modern .score-img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  transition: all 0.15s ease;
}

body.theme-modern .score-img:hover {
  border-color: #94a3b8;
  transform: translateY(-2px);
}

body.theme-modern .score-img.selected {
  border-color: #2980b9;
  box-shadow: 0 4px 12px rgba(41, 128, 185, 0.25);
}

body.theme-modern .scale-label {
  color: #64748b;
  font-weight: 600;
  font-size: 12px;
}

/* ========================================
   WELCOME
   ======================================== */

body.theme-modern .welcome-content {
  max-width: none;
  margin: 0;
  text-align: left;
}

body.theme-modern .welcome-content h2 {
  font-size: 32px;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

body.theme-modern .welcome-content p {
  color: #64748b;
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 12px;
}

body.theme-modern .calculatorCount-button {
  background: #EE3523;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  padding: 2px 8px;
}

/* About page tool list */
body.theme-modern .about-categories h4 {
  margin-top: 28px;
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #1e3a5f;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
}

body.theme-modern .about-categories h4:first-child {
  margin-top: 0;
}

body.theme-modern .about-tool-list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px 0;
}

body.theme-modern .about-tool-list li {
  padding: 6px 0;
  font-size: 14px;
  color: #475569;
  line-height: 1.5;
  border-bottom: 1px solid #f1f5f9;
}

body.theme-modern .about-tool-list li:last-child {
  border-bottom: none;
}

body.theme-modern .about-tool-list li a {
  color: #2980b9;
  text-decoration: none;
  transition: color 0.15s ease;
}

body.theme-modern .about-tool-list li a:hover {
  color: #1e5f8a;
  text-decoration: underline;
}

body.theme-modern .about-tool-list li a strong {
  font-weight: 600;
}

/* ========================================
   CHECKBOX & RADIO
   ======================================== */

body.theme-modern input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  flex-shrink: 0;
  border: 2px solid #d1d9e6;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  margin: 0;
  margin-right: 10px;
}

/* Ensure checkbox labels are properly aligned */
body.theme-modern .form-group label:has(input[type="checkbox"]),
body.theme-modern .form-group label:has(input[type="radio"]) {
  display: flex;
  align-items: center;
  line-height: 1.4;
}

body.theme-modern input[type="checkbox"]:hover {
  border-color: #2980b9;
}

body.theme-modern input[type="checkbox"]:checked {
  background: #2980b9;
  border-color: #2980b9;
}

body.theme-modern input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: 700;
}

body.theme-modern input[type="radio"] {
  appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  flex-shrink: 0;
  border: 2px solid #d1d9e6;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
}

body.theme-modern input[type="radio"]:hover {
  border-color: #2980b9;
}

body.theme-modern input[type="radio"]:checked {
  border-color: #2980b9;
  background: #2980b9;
  box-shadow: inset 0 0 0 4px #fff;
}

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

@media (max-width: 768px) {
  /* Ensure modern theme styles override base.css on mobile */
  body.theme-modern {
    font-family: 'Inter', 'Source Sans Pro', -apple-system, sans-serif;
    background: #e6f0fa;
  }
  
  body.theme-modern .top-bar {
    background: #2c3e50;
    padding: 14px 16px;
    padding-left: 64px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: 36px;
  }
  
  body.theme-modern .container {
    margin-top: 64px;
  }
  
  body.theme-modern .hamburger-menu button {
    background: rgba(255, 255, 255, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    font-size: 18px;
    color: #e6f0fa;
  }
  
  body.theme-modern .language-toggle {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
  }
  
  body.theme-modern .language-toggle button {
    padding: 8px 12px;
    font-weight: 600;
    font-size: 13px;
    background: none;
    border: none;
    color: #fff;
  }
  
  body.theme-modern .language-toggle button.active-language {
    background: #2980b9;
    border-radius: 6px;
  }
  
  /* Sidebar: positioned below topbar with indicator bar when collapsed */
  body.theme-modern .sidebar {
    width: 260px;
    max-width: 75vw;
    position: fixed;
    top: 64px; /* Below topbar */
    left: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(calc(-100% + 24px)); /* Default: show 24px indicator */
    transition: transform 0.25s ease;
    background: #ffffff;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
  }
  
  /* Open: fully visible */
  body.theme-modern .sidebar.active {
    transform: translateX(0);
  }
  
  /* Frosted glass overlay when sidebar is open */
  body.theme-modern .sidebar-overlay {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(46, 62, 80, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  
  body.theme-modern .sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
  }
  
  /* Content: full width with left padding for indicator bar */
  body.theme-modern .content {
    width: 100% !important;
    max-width: 100vw;
    padding: 20px 16px 20px 40px; /* 40px left for indicator bar */
    background: #e6f0fa;
    margin-left: 0;
    min-height: calc(100vh - 64px);
    box-sizing: border-box;
  }
  
  body.theme-modern .calculator-header h3 {
    font-size: 22px;
    font-weight: 700;
    color: #2c3e50;
  }
  
  body.theme-modern .welcome-content {
    max-width: none;
    margin: 0;
    padding: 0;
    text-align: left;
  }
  
  body.theme-modern .welcome-content h2 {
    font-size: 28px;
  }
  
  body.theme-modern .welcome-content p {
    font-size: 15px;
  }
}

/* ========================================
   SCROLLBAR
   ======================================== */

body.theme-modern ::-webkit-scrollbar {
  width: 8px;
}

body.theme-modern ::-webkit-scrollbar-track {
  background: transparent;
}

body.theme-modern ::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

body.theme-modern ::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ========================================
   SIDEBAR ABOUT & LINKS (Modern Theme)
   ======================================== */

body.theme-modern .sidebar-separator {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  margin: 16px 0;
}

body.theme-modern .sidebar-links {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
}

body.theme-modern .sidebar-links li {
  padding: 10px 10px;
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.2s;
}

body.theme-modern .sidebar-links li:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

body.theme-modern .sidebar-links li a,
body.theme-modern .sidebar-links li span {
  color: #475569;
  text-decoration: none;
  font-size: 13px;
  display: block;
  width: 100%;
}

body.theme-modern .sidebar-links li a.growth-chart-link {
  display: inline-block;
}

body.theme-modern .external-link-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
  opacity: 0.85;
  transition: opacity 0.2s ease;
  margin-left: -4px;
}

body.theme-modern .external-link-logo:hover {
  opacity: 1;
}

body.theme-modern .sidebar-links li:hover a,
body.theme-modern .sidebar-links li:hover span {
  color: #2980b9;
}

body.theme-modern .sidebar-about {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  margin-top: 12px;
}

body.theme-modern .about-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.theme-modern .about-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

body.theme-modern .about-name {
  font-size: 12px;
  font-weight: 600;
  color: #2c3e50;
}

body.theme-modern .about-title,
body.theme-modern .about-hospital {
  font-size: 10px;
  color: #64748b;
  line-height: 1.3;
}

/* Custom IV Fluid Mode Selector (card-style with switch button) */
body.theme-modern .mode-selector:has(.mode-switch-btn) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

/* Form-group mode selectors (toggle button style) - no card wrapper */
body.theme-modern .form-group.mode-selector {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  display: block;
}

body.theme-modern .mode-option {
  flex: 1;
  text-align: center;
  opacity: 0.5;
  transition: opacity 0.2s;
}

body.theme-modern .mode-option.active {
  opacity: 1;
}

body.theme-modern .mode-title {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: #1e293b;
}

body.theme-modern .mode-subtitle {
  display: block;
  font-size: 11px;
  color: #64748b;
}

body.theme-modern .mode-switch-btn {
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 8px;
}

body.theme-modern .mode-switch-btn .arrow {
  font-size: 16px;
  color: #64748b;
  transition: transform 0.3s;
}

body.theme-modern .mode-switch-btn .arrow.reversed {
  transform: rotate(180deg);
}

/* SF Selector */
body.theme-modern .sf-selector {
  display: flex;
  background: #f1f5f9;
  border-radius: 8px;
  overflow: hidden;
}

body.theme-modern .sf-btn {
  flex: 1;
  padding: 10px 4px;
  border: none;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
  color: #475569;
  transition: all 0.2s;
}

body.theme-modern .sf-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

body.theme-modern .sf-btn.active {
  background: #3498db;
  color: #fff;
}

/* Dextrose Row */
body.theme-modern .dextrose-row,
body.theme-modern .nacl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

body.theme-modern .dextrose-row select,
body.theme-modern .nacl-row select {
  width: auto;
  min-width: 80px;
}

body.theme-modern .add-dextrose-btn,
body.theme-modern .remove-dextrose-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.theme-modern .add-dextrose-btn {
  background: #3498db;
  color: #fff;
}

body.theme-modern .add-dextrose-btn:disabled {
  background: #e2e8f0;
  color: #94a3b8;
  cursor: not-allowed;
}

body.theme-modern .remove-dextrose-btn {
  background: #ef4444;
  color: #fff;
}
