* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #8BA495;
    --primary-dark: #6d8277;
    --primary-light: #a3bab0;
    --secondary: #6366f1;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #242424;
    --text-secondary: #4a4a4a;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: rgba(36, 36, 36, 0.08);
    --shadow-lg: rgba(36, 36, 36, 0.12);
    --ft3-color: #e74c3c;
    --ft4-color: #95a5a6;
    --estradiol-color: #e74c3c;
    --progesteron-color: #f1c40f;
}

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #e8f0ed 0%, #f8fafc 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 1rem;
}

.container {
    max-width: 100%;
    margin: 0 auto;
}

.header {
    margin-bottom: 2rem;
    animation: fadeInDown 0.6s ease-out;
	display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    max-width: 220px;
    height: auto;
    display: block;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding: 0.5rem;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow);
    animation: fadeIn 0.6s ease-out 0.1s both;
}

.tab {
    flex: 1;
    min-width: fit-content;
    padding: 1rem;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    text-align: center;
	text-decoration: none;
}

.tab:hover {
    background: var(--bg-main);
    color: var(--primary);
}

.tab.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border-color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(139, 164, 149, 0.3);
}

.calculator-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    animation: fadeIn 0.6s ease-out 0.2s both;
}

.calculator {
    display: none;
}

.calculator.active {
    display: contents;
}

/* Special layout for Schilddrüsen-Rechner */
#calc-schilddruese.active {
    display: block;
}

.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 16px var(--shadow-lg);
    border: 1px solid var(--border);
	margin-bottom: 2rem;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

/* Label Icons */
.label-icon {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

.estradiol-icon {
    color: var(--estradiol-color);
}

.progesteron-icon {
    color: var(--progesteron-color);
}

.ft3-icon {
    color: var(--ft3-color);
}

.ft4-icon {
    color: var(--ft4-color);
}

.input-group {
    margin-bottom: 1.5rem;
    animation: slideInLeft 0.4s ease-out;
}

.input-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.input-sublabel {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.input-wrapper {
    position: relative;
}

.input-field {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-family: 'JetBrains Mono', monospace;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg-main);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(139, 164, 149, 0.1);
}

.input-unit {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    pointer-events: none;
}

/* Input with dropdown select */
.input-with-select {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.input-field-with-select {
    flex: 1;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-family: 'JetBrains Mono', monospace;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg-main);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.input-field-with-select:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(139, 164, 149, 0.1);
}

.unit-select {
    min-width: 120px;
    padding: 0.875rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.unit-select:hover {
    border-color: var(--primary);
}

.unit-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 164, 149, 0.1);
}

.radio-group {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-main);
    border-radius: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.radio-label:hover {
    background: rgba(139, 164, 149, 0.1);
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.radio-label span {
    font-weight: 600;
    color: var(--text-primary);
}

.reference-range-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.range-input-small {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-family: 'JetBrains Mono', monospace;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: white;
    color: var(--text-primary);
}

.range-input-small:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(139, 164, 149, 0.1);
}

.info-box {
    background: #e0f2fe;
    border-left: 4px solid #0284c7;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
	margin-top: 1rem;
}

.warning-box {
    background: #fff3cd;
    border-color: #ffc107;
}

.calculate-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(139, 164, 149, 0.3);
    margin-top: 1rem;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 164, 149, 0.4);
}

.calculate-btn:active {
    transform: translateY(0);
}

/* fT3 und fT4 Button Styles */
.ft3-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #f39c9c 100%);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.ft3-btn:hover {
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.4);
}

.ft4-btn {
    background: linear-gradient(135deg, #95a5a6 0%, #bdc3c7 100%);
    box-shadow: 0 4px 12px rgba(149, 165, 166, 0.3);
}

.ft4-btn:hover {
    box-shadow: 0 6px 16px rgba(149, 165, 166, 0.4);
}

.results-card {
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.results-content {
    flex: 1;
}

.result-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 3rem 1rem;
}

.result-empty svg {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.result-box {
    background: linear-gradient(135deg, var(--bg-main) 0%, white 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border);
    animation: scaleIn 0.4s ease-out;
	margin-top: 2rem;
}

.result-value {
    font-size: 3rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--primary);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.result-label {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.result-interpretation {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid;
    animation: slideInRight 0.4s ease-out 0.1s both;
}

.result-interpretation.normal {
    background: #f0fdf4;
    border-color: var(--success);
}

.result-interpretation.warning {
    background: #fffbeb;
    border-color: var(--warning);
}

.result-interpretation.danger {
    background: #fef2f2;
    border-color: var(--danger);
}

/* ── E2:P Ergebnis-Detail-Zeilen ───────────────────────────────── */

/* Container für die beiden Einzel-Wert-Zeilen */
.result-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

/* Eine Zeile: Icon + Text */
.result-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 8px;
    border-left: 4px solid transparent;
    animation: slideInRight 0.4s ease-out 0.2s both;
}

.result-detail-row.normal {
    background: #f0fdf4;
    border-left-color: var(--success);
}

.result-detail-row.warning {
    background: #fffbeb;
    border-left-color: var(--warning);
}

.result-detail-row.danger {
    background: #fef2f2;
    border-left-color: var(--danger);
}

/* Emoji-Icon */
.detail-icon {
    font-size: 1.2rem;
    line-height: 1.4;
    flex-shrink: 0;
}

/* Text-Block: fett + Beschreibung untereinander */
.detail-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.detail-text strong {
    font-size: 0.95rem;
}

.detail-text span {
    opacity: 0.85;
    color: var(--text-secondary);
}

/* ────────────────────────────────────────────────────────────────── */

.interpretation-grid {
	display: flex;
    flex-direction: column;
    gap: 1rem;
	margin-top: 1rem;
}

.interpretation-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.interpretation-title svg {
    width: 20px;
    height: 20px;
}

.interpretation-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.reference-ranges {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-main);
    border-radius: 8px;
    font-size: 0.9rem;
}

.reference-ranges h4 {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.range-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.range-item:last-child {
    border-bottom: none;
}

.range-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    color: var(--text-primary);
}

.range-meaning {
    color: var(--text-secondary);
}

/* Schilddrüsen-Rechner Styles */
.schilddruese-header {
    background: var(--bg-card);
    border-radius: 16px 16px 0 0;
    padding: 2rem 2rem 1.5rem;
    box-shadow: 0 4px 16px var(--shadow-lg);
    border: 1px solid var(--border);
    border-bottom: none;
    margin-bottom: 0;
}

.schilddruese-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    animation: fadeIn 0.6s ease-out 0.2s both;
}

.schilddruese-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 16px var(--shadow-lg);
    border: 1px solid var(--border);
}

.schilddruese-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.schilddruese-norm-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.schilddruese-norm-row .input-group {
    margin-bottom: 1rem;
}

/* Inline Results for Schilddrüsen-Rechner */
.results-content-inline {
    margin-top: 1.5rem;
}

.result-box-inline {
    background: #fff8e1;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    animation: scaleIn 0.4s ease-out;
}

.result-value-inline {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.result-value-inline.ft3-color {
    color: var(--ft3-color);
}

.result-value-inline.ft4-color {
    color: var(--ft4-color);
}

.result-value-inline.warning-color {
    color: var(--warning);
}

.result-value-inline.danger-color {
    color: var(--danger);
}

.result-value-inline.success-color {
    color: var(--success);
}

.result-label-inline {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

#vitd-dosage-result {
	margin-bottom: 2rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 1024px) {
    .calculator-wrapper {
        grid-template-columns: 1fr;
    }
    
    .schilddruese-wrapper {
        grid-template-columns: 1fr;
    }
}

/* ================= MOBILE FIXES ================= */
@media (max-width: 640px) {

  /* Header */
  .logo {
    max-width: 200px;
  }
  
  .header {
    margin-bottom: 2rem;
	flex-direction: column;
	gap: 2rem;
  }

  .header h1 {
    font-size: 1.25rem;
  }
  
  .header p {
    font-size: 1rem;
  }

  /* Tabs: bleiben Grid (2er), NICHT column */
  .tabs {
    display: grid; /* wichtig */
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .tab {
    min-width: unset;
    padding: 0.85rem;
    font-size: 0.9rem;
  }

  /* Cards */
  .card {
    padding: 1.5rem;
  }

  /* Result */
  .result-value {
    font-size: 2rem;
  }

  /* Input + Select untereinander */
  .input-with-select {
    flex-direction: column;
    align-items: stretch;
  }

  .unit-select {
    min-width: unset;
  }

  /* Zwei-Spalten-Layouts auf 1 Spalte */
  .input-group.two-columns,
  .schilddruese-norm-row {
    grid-template-columns: 1fr;
  }
}