/**
 * Body Fat Calculator — Frontend Styles v2
 *
 * Premium, modern UI with glassmorphism, animated gauge,
 * custom radio cards, and smooth transitions.
 *
 * @package BodyFatCalculator
 * @version 2.0.0
 */

/* =========================================================
   Custom Properties
   ========================================================= */
.bfc-calculator {
    --bfc-primary: #4a7c59;
    --bfc-primary-hover: #3d6a4b;
    --bfc-accent: #1a2332;
    --bfc-slider: #4a90d9;
    --bfc-link: #4a7c59;
    --bfc-card-radius: 20px;
    --bfc-btn-radius: 14px;

    --bfc-bg: #ffffff;
    --bfc-bg-page: #f3f4f6;
    --bfc-bg-glass: rgba(255, 255, 255, 0.72);
    --bfc-border: rgba(0, 0, 0, 0.06);
    --bfc-text: #1e293b;
    --bfc-text-muted: #64748b;
    --bfc-error: #ef4444;
    --bfc-success: #10b981;
    --bfc-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    --bfc-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
    --bfc-shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    --bfc-ease: cubic-bezier(0.4, 0, 0.2, 1);

    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--bfc-text);
    -webkit-font-smoothing: antialiased;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
}

/* =========================================================
   Progress Indicator
   ========================================================= */
.bfc-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 36px;
    padding: 0 20px;
}

.bfc-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.bfc-progress-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    background: var(--bfc-bg);
    color: var(--bfc-text-muted);
    border: 2px solid #e2e8f0;
    transition: all 0.4s var(--bfc-ease);
    position: relative;
    z-index: 1;
}

.bfc-progress-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--bfc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.4s var(--bfc-ease);
    white-space: nowrap;
}

.bfc-progress-step.bfc-progress-active .bfc-progress-num {
    background: var(--bfc-primary);
    color: #fff;
    border-color: var(--bfc-primary);
    box-shadow: 0 0 0 4px rgba(74, 124, 89, 0.18);
}

.bfc-progress-step.bfc-progress-active .bfc-progress-label {
    color: var(--bfc-primary);
}

.bfc-progress-step.bfc-progress-done .bfc-progress-num {
    background: var(--bfc-primary);
    color: #fff;
    border-color: var(--bfc-primary);
}

.bfc-progress-step.bfc-progress-done .bfc-progress-label {
    color: var(--bfc-primary);
}

.bfc-progress-line {
    flex: 1;
    height: 2px;
    background: #e2e8f0;
    margin: 0 8px;
    margin-bottom: 24px;
    border-radius: 1px;
    overflow: hidden;
    min-width: 40px;
}

.bfc-progress-line-fill {
    width: 0%;
    height: 100%;
    background: var(--bfc-primary);
    border-radius: 1px;
    transition: width 0.6s var(--bfc-ease);
}

/* =========================================================
   Steps & Transitions
   ========================================================= */
.bfc-step {
    display: none;
}

.bfc-step.bfc-active {
    display: block;
    animation: bfcSlideUp 0.5s var(--bfc-ease);
}

@keyframes bfcSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================
   Layout
   ========================================================= */
.bfc-layout {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 28px;
    align-items: start;
}

@media (max-width: 768px) {
    .bfc-layout {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Cards
   ========================================================= */
.bfc-card {
    background: var(--bfc-bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--bfc-card-radius);
    border: 1px solid var(--bfc-border);
    padding: 36px;
    box-shadow: var(--bfc-shadow);
    transition: box-shadow 0.35s var(--bfc-ease), transform 0.35s var(--bfc-ease);
}

.bfc-card:hover {
    box-shadow: var(--bfc-shadow-lg);
}

.bfc-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--bfc-accent);
    margin: 0 0 16px;
    letter-spacing: -0.2px;
}

.bfc-mt-lg {
    margin-top: 32px;
}

.bfc-inputs-card {
    max-width: 620px;
    margin: 0 auto;
}

.bfc-results-card {
    max-width: 680px;
    margin: 0 auto;
}

/* =========================================================
   Radio Cards (Sex & Method)
   ========================================================= */
.bfc-radio-group {
    display: flex;
    gap: 12px;
}

.bfc-radio-group-vertical {
    flex-direction: column;
}

.bfc-radio-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-radius: 14px;
    border: 2px solid #e2e8f0;
    background: var(--bfc-bg);
    cursor: pointer;
    transition: all 0.25s var(--bfc-ease);
    flex: 1;
    position: relative;
    user-select: none;
}

.bfc-radio-card:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.bfc-radio-card.bfc-selected {
    border-color: var(--bfc-primary);
    background: linear-gradient(135deg, rgba(74, 124, 89, 0.04) 0%, rgba(74, 124, 89, 0.08) 100%);
}

.bfc-radio-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.bfc-radio-indicator {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    flex-shrink: 0;
    position: relative;
    transition: all 0.25s var(--bfc-ease);
}

.bfc-radio-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bfc-primary);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.25s var(--bfc-ease);
}

.bfc-selected .bfc-radio-indicator {
    border-color: var(--bfc-primary);
}

.bfc-selected .bfc-radio-indicator::after {
    transform: translate(-50%, -50%) scale(1);
}

.bfc-radio-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--bfc-text);
    line-height: 1.3;
}

.bfc-radio-text-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.bfc-radio-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 2px 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.bfc-badge-popular {
    color: var(--bfc-primary);
}

.bfc-badge-precise {
    color: #6366f1;
}

.bfc-badge-simple {
    color: var(--bfc-text-muted);
}

/* Focus for a11y */
.bfc-radio-card:focus-visible {
    outline: 3px solid var(--bfc-primary);
    outline-offset: 2px;
}

/* =========================================================
   Slider Groups
   ========================================================= */
.bfc-slider-group {
    margin-bottom: 26px;
    transition: opacity 0.3s var(--bfc-ease), max-height 0.4s var(--bfc-ease);
    overflow: hidden;
}

.bfc-slider-group.bfc-hidden {
    opacity: 0;
    max-height: 0 !important;
    margin-bottom: 0;
    pointer-events: none;
}

.bfc-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}

.bfc-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--bfc-accent);
    letter-spacing: -0.1px;
}

.bfc-slider-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--bfc-primary);
    font-variant-numeric: tabular-nums;
    min-width: 50px;
    text-align: right;
}

/* =========================================================
   Range Slider
   ========================================================= */
.bfc-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: linear-gradient(to right, var(--bfc-slider), var(--bfc-slider)) no-repeat, #e2e8f0;
    background-size: 0% 100%;
    border-radius: 3px;
    outline: none;
    transition: background-size 0.08s ease;
    cursor: pointer;
}

.bfc-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bfc-slider);
    cursor: pointer;
    border: 3px solid var(--bfc-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bfc-slider::-webkit-slider-thumb:hover {
    transform: scale(1.18);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.bfc-slider::-webkit-slider-thumb:active {
    transform: scale(1.08);
}

.bfc-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bfc-slider);
    cursor: pointer;
    border: 3px solid var(--bfc-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.bfc-slider::-moz-range-track {
    background: #e2e8f0;
    height: 6px;
    border-radius: 3px;
    border: none;
}

.bfc-slider::-moz-range-progress {
    background: var(--bfc-slider);
    height: 6px;
    border-radius: 3px;
}

.bfc-slider:focus-visible {
    outline: 2px solid var(--bfc-slider);
    outline-offset: 4px;
}

/* =========================================================
   Buttons
   ========================================================= */
.bfc-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 32px;
    gap: 16px;
}

.bfc-buttons-end {
    justify-content: flex-end;
}

.bfc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 28px;
    border-radius: var(--bfc-btn-radius);
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.28s var(--bfc-ease);
    text-decoration: none;
    letter-spacing: 0.1px;
    min-width: 120px;
    position: relative;
}

.bfc-btn svg {
    flex-shrink: 0;
}

.bfc-btn-primary {
    background: linear-gradient(135deg, var(--bfc-primary), var(--bfc-primary-hover));
    color: #fff;
    box-shadow: 0 2px 12px rgba(74, 124, 89, 0.3);
}

.bfc-btn-primary:hover {
    box-shadow: 0 6px 20px rgba(74, 124, 89, 0.4);
    transform: translateY(-2px);
}

.bfc-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(74, 124, 89, 0.3);
}

.bfc-btn-ghost {
    background: transparent;
    color: var(--bfc-text-muted);
    border: 2px solid #e2e8f0;
    padding: 11px 24px;
}

.bfc-btn-ghost:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--bfc-text);
    transform: translateY(-1px);
}

.bfc-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
}

.bfc-btn:focus-visible {
    outline: 3px solid var(--bfc-primary);
    outline-offset: 2px;
}

/* Loading */
.bfc-btn.bfc-loading {
    pointer-events: none;
    opacity: 0.7;
}

.bfc-btn.bfc-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bfcSpin 0.6s linear infinite;
}

@keyframes bfcSpin {
    to {
        transform: rotate(360deg);
    }
}

/* =========================================================
   Gauge Visualization
   ========================================================= */
.bfc-gauge-container {
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
}

.bfc-gauge {
    position: relative;
    width: 220px;
    text-align: center;
}

.bfc-gauge-svg {
    width: 100%;
    height: auto;
}

.bfc-gauge-arc {
    transition: stroke-dashoffset 1s var(--bfc-ease);
}

.bfc-gauge-value {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 32px;
    font-weight: 900;
    color: var(--bfc-accent);
    letter-spacing: -1px;
    font-variant-numeric: tabular-nums;
}

.bfc-gauge-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--bfc-text-muted);
    margin-top: -6px;
}

/* =========================================================
   Results Grid
   ========================================================= */
.bfc-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.bfc-result-tile {
    background: #f8fafc;
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    border: 1px solid var(--bfc-border);
    transition: transform 0.25s var(--bfc-ease), box-shadow 0.25s var(--bfc-ease);
}

.bfc-result-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--bfc-shadow-sm);
}

.bfc-tile-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--bfc-text-muted);
    margin-bottom: 8px;
}

.bfc-tile-value {
    display: block;
    font-size: 28px;
    font-weight: 900;
    color: var(--bfc-accent);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
}

.bfc-tile-unit {
    font-size: 13px;
    font-weight: 600;
    color: var(--bfc-text-muted);
    margin-top: 4px;
    display: block;
}

.bfc-tile-highlight {
    background: linear-gradient(135deg, rgba(74, 124, 89, 0.06) 0%, rgba(74, 124, 89, 0.12) 100%);
    border-color: rgba(74, 124, 89, 0.15);
}

.bfc-tile-category {
    font-size: 20px !important;
    color: var(--bfc-primary) !important;
}

/* Method badge */
.bfc-method-badge {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--bfc-text-muted);
    margin-bottom: 20px;
    padding: 8px 16px;
    background: #f1f5f9;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    margin-right: auto;
    width: fit-content;
}

.bfc-results-card>.bfc-method-badge {
    display: flex;
    justify-content: center;
}

/* =========================================================
   Email Section
   ========================================================= */
.bfc-email-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--bfc-border);
}

.bfc-email-section .bfc-label {
    margin-bottom: 10px;
    display: block;
}

.bfc-email-required-mark {
    color: var(--bfc-error);
    font-weight: 700;
}

.bfc-email-row {
    position: relative;
}

.bfc-email-input {
    display: block;
    width: 100%;
    padding: 14px 18px;
    font-size: 15px;
    font-family: inherit;
    color: var(--bfc-text);
    background: var(--bfc-bg);
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    outline: none;
    transition: border-color 0.25s var(--bfc-ease), box-shadow 0.25s var(--bfc-ease);
    box-sizing: border-box;
}

.bfc-email-input::placeholder {
    color: #94a3b8;
}

.bfc-email-input:focus {
    border-color: var(--bfc-primary);
    box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.1);
}

.bfc-email-input.bfc-input-error {
    border-color: var(--bfc-error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* =========================================================
   Messages
   ========================================================= */
.bfc-validation-error,
.bfc-email-error {
    color: var(--bfc-error);
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
    min-height: 0;
}

.bfc-success-message {
    color: var(--bfc-success);
    font-size: 14px;
    font-weight: 700;
    margin-top: 20px;
    text-align: center;
    padding: 16px 24px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.06), rgba(16, 185, 129, 0.12));
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 14px;
    display: none;
    animation: bfcSlideUp 0.4s var(--bfc-ease);
}

.bfc-success-message.bfc-visible {
    display: block;
}

/* =========================================================
   Info Card
   ========================================================= */
.bfc-info-card {
    border-left: none;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.bfc-info-content {
    font-size: 15px;
    line-height: 1.8;
    color: var(--bfc-text);
}

.bfc-info-content p {
    margin-bottom: 16px;
}

.bfc-info-content p:last-child {
    margin-bottom: 0;
}

.bfc-link {
    color: var(--bfc-link);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1.5px;
    font-weight: 600;
    transition: color 0.2s var(--bfc-ease);
}

.bfc-link:hover {
    color: var(--bfc-primary-hover);
    text-decoration-color: transparent;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 768px) {
    .bfc-calculator {
        padding: 0 8px;
    }

    .bfc-card {
        padding: 24px 20px;
    }

    .bfc-progress-label {
        font-size: 10px;
    }

    .bfc-progress-num {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .bfc-results-grid {
        grid-template-columns: 1fr;
    }

    .bfc-radio-group:not(.bfc-radio-group-vertical) {
        flex-direction: column;
    }

    .bfc-buttons {
        flex-direction: column-reverse;
        gap: 12px;
    }

    .bfc-btn {
        width: 100%;
        min-width: unset;
    }

    .bfc-buttons-end {
        align-items: stretch;
    }

    .bfc-info-card {
        order: -1;
    }

    .bfc-tile-value {
        font-size: 24px;
    }

    .bfc-gauge {
        width: 180px;
    }

    .bfc-gauge-value {
        font-size: 26px;
    }
}

@media (max-width: 480px) {
    .bfc-card {
        padding: 20px 16px;
        border-radius: 16px;
    }

    .bfc-slider-group {
        margin-bottom: 22px;
    }

    .bfc-radio-card {
        padding: 12px 16px;
    }
}

/* =========================================================
   Print
   ========================================================= */
@media print {

    .bfc-btn,
    .bfc-email-section,
    .bfc-progress {
        display: none !important;
    }

    .bfc-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* =========================================================
   Reduced Motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {

    .bfc-calculator *,
    .bfc-calculator *::before,
    .bfc-calculator *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}