/**
 * Keto Macro Calculator Styles
 * Version: 1.0.0
 */

/* ============================================
   Calculator Page Layout
   ============================================ */

.calculator-page {
    padding: 2rem 0 4rem;
    background: #fdf9f5;
}

.calculator-hero {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 1rem;
}

.calculator-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2B354F;
    margin-bottom: 1rem;
}

.calculator-hero .lead {
    font-size: 1.25rem;
    color: #6b5e4b;
    max-width: 700px;
    margin: 0 auto;
}

.calculator-disclaimer {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin: 0 auto 2rem;
    max-width: 900px;
}

.calculator-disclaimer p {
    margin: 0;
    font-size: 0.9rem;
    color: #856404;
    line-height: 1.6;
}

.calculator-disclaimer strong {
    font-weight: 600;
}

.calculator-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(43, 53, 79, 0.1);
    padding: 2rem;
    margin-bottom: 3rem;
}

/* ============================================
   Form Sections
   ============================================ */

.calc-section {
    margin-bottom: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 2px solid #f0f0f0;
}

.calc-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.calc-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2B354F;
    margin-bottom: 1.5rem;
}

/* ============================================
   Form Groups & Inputs
   ============================================ */

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    color: #2B354F;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.btn-help {
    background: none;
    border: none;
    color: #c4714b;
    cursor: pointer;
    margin-left: 0.25rem;
    padding: 0;
    vertical-align: middle;
}

.btn-help:hover {
    color: #a55a3a;
}

.input-with-unit {
    position: relative;
    display: inline-block;
    width: 100%;
}

.input-with-unit input {
    width: 100%;
    padding: 0.75rem 4rem 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.input-with-unit input:focus {
    outline: none;
    border-color: #c4714b;
}

.input-unit {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 0.9rem;
    pointer-events: none;
}

/* ============================================
   Gender Toggle
   ============================================ */

.gender-toggle,
.unit-toggle,
.keto-type-toggle {
    display: flex;
    gap: 1rem;
}

.gender-option,
.unit-option,
.keto-type-option {
    flex: 1;
    position: relative;
    cursor: pointer;
}

.gender-option input,
.unit-option input,
.keto-type-option input {
    position: absolute;
    opacity: 0;
}

.gender-label,
.unit-label,
.keto-type-label {
    display: block;
    padding: 0.75rem 1rem;
    text-align: center;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-weight: 600;
    color: #6b5e4b;
    transition: all 0.2s;
}

.gender-option input:checked + .gender-label,
.unit-option input:checked + .unit-label,
.keto-type-option input:checked + .keto-type-label {
    background: #c4714b;
    border-color: #c4714b;
    color: white;
}

.gender-option:hover .gender-label,
.unit-option:hover .unit-label,
.keto-type-option:hover .keto-type-label {
    border-color: #c4714b;
}

.keto-type-option {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.keto-type-desc {
    display: block;
    font-size: 0.85rem;
    font-weight: 400;
    margin-top: 0.25rem;
    opacity: 0.8;
}

/* ============================================
   Height & Weight Inputs (Unit Toggle)
   ============================================ */

.height-input,
.weight-input {
    display: none;
}

.height-input.active,
.weight-input.active {
    display: block;
}

/* ============================================
   Sliders
   ============================================ */

.slider-group {
    margin-top: 1rem;
}

.slider-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #c4714b;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(196, 113, 75, 0.3);
}

.slider-group input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #c4714b;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(196, 113, 75, 0.3);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #999;
}

.slider-labels output {
    font-weight: 700;
    color: #2B354F;
    font-size: 1.1rem;
}

/* ============================================
   Radio Groups (Activity & Goal)
   ============================================ */

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-option {
    position: relative;
    cursor: pointer;
}

.radio-option input {
    position: absolute;
    opacity: 0;
}

.radio-content {
    display: block;
    padding: 1rem 1.25rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.2s;
}

.radio-option input:checked + .radio-content {
    background: #fef5f0;
    border-color: #c4714b;
}

.radio-option:hover .radio-content {
    border-color: #c4714b;
}

.radio-content strong {
    display: block;
    color: #2B354F;
    margin-bottom: 0.25rem;
}

.radio-content small {
    color: #6b5e4b;
    font-size: 0.85rem;
}

/* ============================================
   Deficit/Surplus Group
   ============================================ */

.deficit-group .deficit-label {
    transition: all 0.2s;
}

.form-text {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #6b5e4b;
}

/* ============================================
   Results Panel (Sticky Sidebar)
   ============================================ */

.calculator-results-col {
    position: relative;
}

.calculator-results {
    position: sticky;
    top: 2rem;
}

.results-card {
    background: linear-gradient(135deg, #2B354F 0%, #3d4a6b 100%);
    color: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 24px rgba(43, 53, 79, 0.3);
}

.results-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    color: white;
}

/* ============================================
   Calories Display
   ============================================ */

.result-calories {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.metric-value {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.metric-label {
    font-size: 0.95rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================
   Macro Breakdown
   ============================================ */

.macro-breakdown {
    margin-bottom: 2rem;
}

.macro-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.macro-item:last-child {
    margin-bottom: 0;
}

.macro-icon {
    font-size: 2rem;
    line-height: 1;
}

.macro-details {
    flex: 1;
}

.macro-name {
    font-size: 0.85rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.macro-amount {
    font-size: 1.5rem;
    font-weight: 700;
}

.macro-percent {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-left: 0.5rem;
}

/* ============================================
   Meal Breakdown
   ============================================ */

.meal-breakdown {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 2rem;
}

.meal-breakdown-title {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.meal-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

.meal-name {
    font-weight: 600;
    min-width: 100px;
}

.meal-macros {
    text-align: right;
    opacity: 0.9;
    font-size: 0.85rem;
}

/* ============================================
   Action Buttons
   ============================================ */

.results-actions .btn-primary {
    background: #c4714b;
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 700;
    font-size: 1.05rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.results-actions .btn-primary:hover {
    background: #a55a3a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(196, 113, 75, 0.4);
}

.btn-group-sm {
    display: flex;
    gap: 0.5rem;
}

.btn-outline-secondary {
    flex: 1;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-outline-secondary svg {
    vertical-align: middle;
    margin-right: 0.25rem;
}

/* ============================================
   Body Fat Estimator Modal
   ============================================ */

.bf-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.bf-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}

.bf-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.bf-modal-close:hover {
    color: #333;
}

.bf-modal-content h2 {
    color: #2B354F;
    margin-bottom: 0.5rem;
}

.bf-modal-content > p {
    color: #6b5e4b;
    margin-bottom: 2rem;
}

/* BF Gender Tabs */
.bf-gender-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.bf-tab {
    flex: 1;
    padding: 0.75rem;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-weight: 600;
    color: #6b5e4b;
    cursor: pointer;
    transition: all 0.2s;
}

.bf-tab.active {
    background: #c4714b;
    border-color: #c4714b;
    color: white;
}

/* BF Options Grid */
.bf-options {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.bf-options.active {
    display: grid;
}

.bf-option {
    text-align: center;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.bf-option:hover {
    border-color: #c4714b;
    background: #fef5f0;
}

.bf-option.selected {
    border-color: #c4714b;
    background: #fef5f0;
    box-shadow: 0 4px 12px rgba(196, 113, 75, 0.2);
}

.bf-visual {
    width: 100px;
    height: 120px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bf-body {
    width: 60px;
    height: 100px;
    background: linear-gradient(180deg, #ddd 0%, #bbb 100%);
    border-radius: 30px 30px 20px 20px;
    position: relative;
}

/* Visual body fat representations (simplified) */
.bf-12 { width: 50px; background: linear-gradient(180deg, #f0c9a6 0%, #d4a574 100%); }
.bf-17 { width: 55px; background: linear-gradient(180deg, #f0c9a6 0%, #c99565 100%); }
.bf-22 { width: 60px; background: linear-gradient(180deg, #e8b896 0%, #c99565 100%); }
.bf-27 { width: 70px; background: linear-gradient(180deg, #e8b896 0%, #b88556 100%); }
.bf-32 { width: 80px; background: linear-gradient(180deg, #e0a886 0%, #b88556 100%); }

.bf-20 { width: 55px; background: linear-gradient(180deg, #f0c9a6 0%, #d4a574 100%); }
.bf-25 { width: 60px; background: linear-gradient(180deg, #e8b896 0%, #c99565 100%); }
.bf-30 { width: 68px; background: linear-gradient(180deg, #e8b896 0%, #c99565 100%); }
.bf-35 { width: 76px; background: linear-gradient(180deg, #e0a886 0%, #b88556 100%); }
.bf-40 { width: 85px; background: linear-gradient(180deg, #e0a886 0%, #b88556 100%); }

.bf-label {
    font-weight: 700;
    color: #2B354F;
    margin-bottom: 0.25rem;
}

.bf-desc {
    font-size: 0.85rem;
    color: #6b5e4b;
}

/* ============================================
   FAQ Section
   ============================================ */

.calculator-faq {
    padding: 3rem 0;
}

.calculator-faq h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #2B354F;
    text-align: center;
    margin-bottom: 3rem;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.faq-item h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2B354F;
    margin-bottom: 0.75rem;
}

.faq-item p {
    color: #6b5e4b;
    line-height: 1.6;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 991px) {
    .calculator-results {
        position: static;
        margin-top: 2rem;
    }
}

@media (max-width: 768px) {
    .calculator-hero h1 {
        font-size: 2rem;
    }

    .calculator-hero .lead {
        font-size: 1.1rem;
    }

    .calculator-wrapper {
        padding: 1.5rem;
    }

    .metric-value {
        font-size: 2.5rem;
    }

    .macro-amount {
        font-size: 1.25rem;
    }

    .bf-options {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .faq-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    body * {
        visibility: hidden;
    }

    .calculator-results,
    .calculator-results * {
        visibility: visible;
    }

    .calculator-results {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white !important;
        color: black !important;
    }

    .results-card {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        border: 2px solid #2B354F;
    }

    .results-title,
    .metric-value,
    .metric-label,
    .macro-name,
    .macro-amount,
    .macro-percent,
    .meal-breakdown-title,
    .meal-name,
    .meal-macros {
        color: black !important;
    }

    .macro-item,
    .meal-breakdown {
        background: #f9f9f9 !important;
        border: 1px solid #ddd;
    }

    .results-actions,
    .btn-help {
        display: none !important;
    }

    /* Print Header */
    .calculator-results::before {
        content: 'KetoFocus Macro Calculator';
        display: block;
        text-align: center;
        font-size: 1.5rem;
        font-weight: 700;
        margin-bottom: 1rem;
        color: #2B354F;
    }
}
