/*
* Fitness Age Calculator Styles
* Designed for Kadence Theme compatibility (avoids hardcoded colors/fonts)
*/

/* Main Container */
.fac-container {
    max-width: 1290px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: var(--global-palette-white, #ffffff); /* Use theme variable or fallback */
    border: 1px solid var(--global-palette-8, #e0e0e0);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.07);
    overflow: hidden;
}

/* Progress Bar */
.fac-progress-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2.5rem;
    text-align: center;
}
.fac-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 60px;
    transition: all 0.3s ease;
}
.fac-step-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--global-palette-7, #cccccc);
    color: var(--global-palette-7, #cccccc);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    background-color: var(--global-palette-white, #ffffff);
    transition: all 0.3s ease;
}
.fac-step-label {
    margin-top: 0.5rem;
    font-size: 0.8em;
    color: var(--global-palette-6, #999999);
}
.fac-progress-line {
    flex-grow: 1;
    height: 2px;
    background-color: var(--global-palette-8, #e0e0e0);
    position: relative;
    top: 18px; /* Vertically center with icon */
}
/* Active / Completed Step Styles */
.fac-progress-step.active .fac-step-icon {
    border-color: var(--global-palette-1, #0073e6); /* Use theme primary color */
    color: var(--global-palette-1, #0073e6);
}
.fac-progress-step.active .fac-step-label {
    color: var(--global-palette-4, #333333);
    font-weight: bold;
}
.fac-progress-step.completed .fac-step-icon {
    background-color: var(--global-palette-1, #0073e6);
    border-color: var(--global-palette-1, #0073e6);
    color: var(--global-palette-white, #ffffff);
}
.fac-progress-step.completed .fac-step-label {
    color: var(--global-palette-4, #333333);
}

/* Form Steps */
.fac-form-body {
    position: relative;
    min-height: 250px; /* Prevent layout jump */
}
.fac-step {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}
.fac-step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Elements */
.fac-form-group {
    margin-bottom: 1.5rem;
}
.fac-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}
.fac-form-group small {
    display: block;
    margin-top: -0.25rem;
    margin-bottom: 0.5rem;
    font-size: 0.85em;
    color: var(--global-palette-5, #777777);
}
.fac-form-group input[type="number"],
.fac-form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--global-palette-8, #cccccc);
    border-radius: 4px;
    box-sizing: border-box; /* Important for 100% width */
}
.fac-input-group {
    display: flex;
    gap: 1rem;
}
.fac-input-group input {
    flex: 1;
}
.fac-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
}
.fac-radio-group label {
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Navigation Buttons */
.fac-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    border-top: 1px solid var(--global-palette-8, #e0e0e0);
    padding-top: 1.5rem;
}
.fac-button {
    padding: 0.8rem 1.8rem;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
    transition: all 0.2s ease;
}
.fac-button-primary {
    background-color: var(--global-palette-1, #0073e6); /* Use theme primary color */
    color: var(--global-palette-white, #ffffff);
}
.fac-button-primary:hover {
    opacity: 0.9;
}
.fac-button-secondary {
    background-color: var(--global-palette-white, #ffffff);
    color: var(--global-palette-4, #333333);
    border-color: var(--global-palette-7, #cccccc);
}
.fac-button-secondary:hover {
    background-color: var(--global-palette-9, #f5f5f5);
}
#fac-prev-btn {
    margin-right: auto;
}
#fac-next-btn {
    margin-left: auto;
}

/* Results Section */
.fac-results-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    text-align: center;
    animation: fadeIn 0.5s ease-in-out;
}
.fac-results-summary, .fac-results-chart-area {
    flex: 1;
    min-width: 250px;
    padding: 1.5rem;
    background-color: var(--global-palette-9, #f9f9f9);
    border-radius: 8px;
}
.fac-results-summary p {
    margin: 0;
}
.fac-result-age-display {
    font-size: 4rem;
    font-weight: bold;
    color: var(--global-palette-1, #0073e6);
    line-height: 1.1;
    margin: 0.5rem 0;
}
#fac-result-comparison {
    font-weight: bold;
}
.fac-chart {
    margin-top: 1rem;
    width: 100%;
}
.fac-bar-group {
    margin-bottom: 1rem;
}
.fac-bar-label {
    text-align: left;
    font-size: 0.9em;
    margin-bottom: 0.25rem;
}
.fac-bar-wrapper {
    width: 100%;
    background-color: var(--global-palette-8, #e0e0e0);
    border-radius: 4px;
    overflow: hidden;
}
.fac-bar {
    height: 30px;
    border-radius: 4px;
    transition: width 1s ease-out;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;
    box-sizing: border-box;
}
#fac-fitness-age-bar { background-color: #36a2eb; } /* Blue - ok to hardcode chart colors */
#fac-chrono-age-bar { background-color: #ff6384; } /* Red - ok to hardcode chart colors */
.fac-bar-value {
    color: white;
    font-weight: bold;
    font-size: 0.9em;
}

/* Advice Section */
.fac-advice {
    margin-top: 2rem;
    padding: 1.5rem;
    border: 1px dashed var(--global-palette-7, #cccccc);
    border-radius: 8px;
}
.fac-advice h4 {
    margin-top: 0;
}
.fac-advice ul {
    padding-left: 20px;
    margin-bottom: 0;
}
.fac-advice li {
    margin-bottom: 0.5rem;
}

/* Utility Buttons (Reset/Print) */
.fac-utility {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Error Message */
.fac-error {
    color: #D8000C; /* Error color is generally universal */
    background-color: #FFD2D2;
    padding: 0.75rem;
    border-radius: 4px;
    margin-top: 1rem;
    text-align: center;
    font-weight: bold;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .fac-container {
        padding: 1.5rem;
    }
    .fac-progress-bar {
        font-size: 0.9em;
    }
    .fac-step-icon {
        width: 30px;
        height: 30px;
    }
    .fac-step-label { display: none; } /* Hide labels on mobile to save space */
    .fac-progress-line { top: 15px; }
    .fac-input-group {
        flex-direction: column;
        gap: 1rem;
    }
    .fac-results-container {
      flex-direction: column;
    }
}


/* ---- START: REVISED PRINT STYLES ---- */

/* Hide the print-only section by default on screen */
#fac-print-section {
    display: none;
}

@media print {
    /* Hide everything on the page by default */
    body * {
        visibility: hidden;
    }
    
    /* Make the print section and everything inside it visible */
    #fac-print-section, #fac-print-section * {
        visibility: visible;
    }
    
    /* Position the print section to take over the whole page */
    #fac-print-section {
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        font-family: sans-serif; /* Use a generic font for printing */
        color: #000;
    }

    /* Styling for the dynamically created print content */
    .fac-print-title {
        text-align: center;
        font-size: 24px;
        margin-bottom: 20px;
    }

    .fac-print-summary-table {
        width: 100%;
        margin-bottom: 20px;
        border-collapse: collapse;
    }
    
    .fac-print-summary-table th, .fac-print-summary-table td {
        border: 1px solid #ccc;
        padding: 8px;
        text-align: left;
    }
    
    .fac-print-summary-table th {
        background-color: #f2f2f2;
    }

    /* Ensure results layout is clean for printing */
    .fac-print-section .fac-results-container {
        flex-direction: column;
    }
    .fac-print-section .fac-bar {
       /* Use a simple color for printing instead of background color */
       border: 1px solid #000;
       background-color: #eee !important;
    }
    .fac-print-section .fac-bar-value {
        color: #000 !important; /* Ensure text is visible on light background */
    }
}

/* ---- END: REVISED PRINT STYLES ---- */