/* ============================================================
   FML Utility – Frontend Styles
   Version: 1.0.0
   ============================================================ */

/* ── CSS Custom Properties ─────────────────────────────────── */
.fml-calculator {
    --fml-accent:      #e8463a;
    --fml-accent-dark: color-mix(in srgb, var(--fml-accent) 80%, black);
    --fml-bg:          #f9f9f9;
    --fml-border:      #e0e0e0;
    --fml-text:        #1a1a1a;
    --fml-text-light:  #555555;
    --fml-radius:      8px;
    --fml-shadow:      0 2px 12px rgba(0,0,0,.08);

    box-sizing:    border-box;
    font-family:   inherit;
    max-width:     680px;
    margin:        0 auto 2rem;
    padding:       2rem;
    background:    var(--fml-bg);
    border:        1px solid var(--fml-border);
    border-radius: var(--fml-radius);
    box-shadow:    var(--fml-shadow);
    color:         var(--fml-text);
}

.fml-calculator *, .fml-calculator *::before, .fml-calculator *::after {
    box-sizing: inherit;
}

/* ── Titel & Beschreibung ─────────────────────────────────── */
.fml-calc-title {
    margin:      0 0 .5rem;
    font-size:   1.4rem;
    font-weight: 700;
    color:       var(--fml-text);
    border-left: 4px solid var(--fml-accent);
    padding-left: .75rem;
}

.fml-calc-description {
    margin:    0 0 1.5rem;
    color:     var(--fml-text-light);
    font-size: .95rem;
}

/* ── Formular ────────────────────────────────────────────── */
.fml-form {
    display:        flex;
    flex-direction: column;
    gap:            1rem;
}

.fml-form-row {
    display:        flex;
    flex-direction: column;
    gap:            .35rem;
}

.fml-form-row label,
.fml-form-label {
    font-weight: 600;
    font-size:   .9rem;
    color:       var(--fml-text);
}

.fml-input {
    padding:       .55rem .75rem;
    border:        1px solid var(--fml-border);
    border-radius: calc(var(--fml-radius) / 2);
    font-size:     1rem;
    width:         100%;
    background:    #fff;
    color:         var(--fml-text);
    transition:    border-color .2s;
}

.fml-input:focus {
    outline:      none;
    border-color: var(--fml-accent);
    box-shadow:   0 0 0 3px color-mix(in srgb, var(--fml-accent) 20%, transparent);
}

select.fml-input {
    cursor: pointer;
}

/* Radio-Gruppe */
.fml-form-row--radio {
    flex-direction: row;
    align-items:    center;
    flex-wrap:      wrap;
    gap:            .75rem;
}

.fml-form-row--radio .fml-form-label {
    flex-basis: 100%;
}

.fml-form-row--radio label {
    display:     flex;
    align-items: center;
    gap:         .35rem;
    font-weight: normal;
    cursor:      pointer;
}

/* ── Button ──────────────────────────────────────────────── */
.fml-btn {
    display:       inline-block;
    padding:       .7rem 1.75rem;
    background:    var(--fml-accent);
    color:         #fff;
    font-weight:   700;
    font-size:     1rem;
    border:        none;
    border-radius: calc(var(--fml-radius) / 2);
    cursor:        pointer;
    transition:    background .2s, transform .1s;
    align-self:    flex-start;
    margin-top:    .5rem;
}

.fml-btn:hover  { background: var(--fml-accent-dark); }
.fml-btn:active { transform: scale(.97); }

/* ── Ergebnis-Bereich ────────────────────────────────────── */
.fml-result {
    margin-top:    1.5rem;
    padding-top:   1.5rem;
    border-top:    2px solid var(--fml-border);
    animation:     fmlFadeIn .3s ease;
}

@keyframes fmlFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fml-result-primary {
    display:        flex;
    flex-direction: column;
    align-items:    flex-start;
    gap:            .2rem;
    margin-bottom:  1rem;
}

.fml-result-label {
    font-size:   .85rem;
    font-weight: 600;
    color:       var(--fml-text-light);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.fml-result-value {
    font-size:   2.2rem;
    font-weight: 800;
    color:       var(--fml-accent);
    line-height: 1;
}

/* ── Tabelle ─────────────────────────────────────────────── */
.fml-table {
    width:           100%;
    border-collapse: collapse;
    font-size:       .9rem;
    margin-top:      .75rem;
}

.fml-table th,
.fml-table td {
    padding:     .5rem .75rem;
    border:      1px solid var(--fml-border);
    text-align:  left;
}

.fml-table thead th {
    background:  var(--fml-accent);
    color:       #fff;
    font-weight: 700;
}

.fml-table tbody tr:nth-child(even) {
    background: rgba(0,0,0,.03);
}

/* ── Disclaimer ──────────────────────────────────────────── */
.fml-disclaimer {
    margin-top: 1rem;
    font-size:  .8rem;
    color:      var(--fml-text-light);
    font-style: italic;
}

/* ============================================================
   Modul: Kalorienrechner – Ziel-Grid
   ============================================================ */
.fml-cal-bmr-row {
    margin-bottom: .75rem;
    color:         var(--fml-text-light);
    font-size:     .9rem;
}

.fml-cal-goals h3 {
    margin:    0 0 .75rem;
    font-size: 1rem;
    font-weight: 700;
}

.fml-goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .75rem;
}

.fml-goal {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    gap:            .3rem;
    padding:        1rem .75rem;
    border:         1px solid var(--fml-border);
    border-radius:  var(--fml-radius);
    background:     #fff;
    text-align:     center;
}

.fml-goal-icon   { font-size: 1.5rem; }
.fml-goal-label  { font-weight: 600; font-size: .85rem; color: var(--fml-text-light); }
.fml-goal-value  { font-size: 1.25rem; font-weight: 800; color: var(--fml-accent); }
.fml-goal-note   { font-size: .75rem; color: var(--fml-text-light); }

/* ============================================================
   Modul: BMI – Kategorie-Badge & Skala
   ============================================================ */
.fml-bmi-category-badge {
    display:       inline-block;
    padding:       .3rem .9rem;
    border-radius: 999px;
    font-weight:   700;
    font-size:     .95rem;
    margin-bottom: 1rem;
    background:    var(--fml-bmi-cat-color, #43a047);
    color:         #fff;
}

/* Skala */
.fml-bmi-scale {
    margin: 1rem 0;
}

.fml-bmi-scale-bar {
    position:      relative;
    border-radius: 999px;
    overflow:      visible;
    height:        16px;
}

.fml-bmi-scale-segments {
    display:       flex;
    height:        100%;
    border-radius: 999px;
    overflow:      hidden;
}

.fml-bmi-seg { height: 100%; }

.fml-bmi-scale-needle {
    position:   absolute;
    top:        -6px;
    width:      4px;
    height:     28px;
    background: #1a1a1a;
    border-radius: 2px;
    transform:  translateX(-50%);
    transition: left .4s ease;
}

.fml-bmi-scale-labels {
    display:         flex;
    justify-content: space-between;
    font-size:       .75rem;
    color:           var(--fml-text-light);
    margin-top:      .3rem;
}

/* Tabelle – Farbpunkt */
.fml-bmi-color-dot {
    display:       inline-block;
    width:         10px;
    height:        10px;
    border-radius: 50%;
    margin-right:  .4rem;
    vertical-align: middle;
}

/* aktive Zeile in der BMI-Tabelle */
.fml-bmi-table-row.fml-active {
    font-weight: 700;
    background:  color-mix(in srgb, var(--fml-accent) 10%, transparent) !important;
}

/* Geschlechts-Hinweis */
.fml-bmi-gender-note {
    font-size:  .82rem;
    color:      var(--fml-text-light);
    background: #fff8e1;
    border-left: 3px solid #fbc02d;
    padding:    .5rem .75rem;
    border-radius: 0 4px 4px 0;
    margin:     .75rem 0;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 540px) {
    .fml-calculator {
        padding: 1.25rem 1rem;
    }

    .fml-result-value {
        font-size: 1.75rem;
    }

    .fml-goals-grid {
        grid-template-columns: 1fr;
    }
}
