/* 
   ==========================================================================
   FITNY PREMIUM CALCULATOR SUITE
   A comprehensive, high-performance design system for all calculator tools.
   ========================================================================== 
*/

/* --- 1. CALCULATOR HUB STYLES (Main /calculator/ Page) --- */

.calculator-intro {
    background: var(--bg-offset);
    padding: 100px 0 60px;
    margin-bottom: 4rem;
    border-bottom: 1px solid rgba(10, 25, 47, 0.05);
}

.cluster-section {
    margin-bottom: 6rem;
}

.cluster-title {
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    margin-bottom: 2.5rem;
    padding-left: 1.5rem;
    border-left: 6px solid var(--accent);
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
}

.calculator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
}

.calc-card {
    background: #ffffff;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid #edf2f7;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.calc-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, transparent 50%, rgba(255, 107, 0, 0.05) 50%);
    transition: var(--transition);
}

.calc-card:hover {
    transform: translateY(-10px);
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
}

.calc-card:hover::after {
    background: linear-gradient(135deg, transparent 50%, rgba(255, 107, 0, 0.1) 50%);
}

.calc-icon {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    background: var(--bg-offset);
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    transition: var(--transition);
}

.calc-card:hover .calc-icon {
    background: var(--accent);
    transform: scale(1.1) rotate(5deg);
}

.calc-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.calc-card p {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.pillar-educational {
    padding: 80px 0;
    line-height: 1.8;
}

.pillar-educational h2 {
    font-size: clamp(2rem, 5vw, 2.8rem);
    margin-bottom: 2rem;
}

/* --- 2. INDIVIDUAL TOOL STYLES (Sub-Calculators) --- */

.tool-header {
    text-align: center;
    padding: 60px 0 40px;
    max-width: 900px;
    margin: 0 auto;
}

.tool-header h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    margin-bottom: 1.5rem;
    line-height: 1.1;
    color: var(--primary);
}

.tool-header span {
    color: var(--accent);
}

.tool-header p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

.calc-card-wide {
    background: var(--white);
    padding: 4.5rem 4rem;
    border-radius: 32px;
    box-shadow: 0 40px 80px rgba(10, 25, 47, 0.08);
    border: 1px solid rgba(10, 25, 47, 0.05);
    max-width: 1000px;
    margin: 3rem auto 6rem;
    position: relative;
    overflow: hidden;
}

.calc-card-wide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 3rem;
}

.input-group label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.radio-group {
    display: flex;
    gap: 2rem;
    margin-top: 0.5rem;
    background: var(--bg-offset);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    transition: var(--transition);
}

.radio-group:focus-within {
    border-color: var(--accent);
}

.radio-group label {
    margin: 0;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.radio-group label:hover {
    color: var(--primary);
}

.radio-group input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Tool Result Display */

.result-box {
    margin-top: 5rem;
    padding: 4rem;
    background: var(--primary);
    background-image: radial-gradient(circle at 20% 20%, rgba(255, 107, 0, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(255, 107, 0, 0.1) 0%, transparent 40%);
    border-radius: 28px;
    color: white;
    text-align: center;
    box-shadow: 0 30px 60px rgba(10, 25, 47, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeInUp 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.result-box h3 {
    color: rgba(255, 255, 255, 0.8) !important;
    margin-bottom: 1rem;
    font-size: 1.4rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.result-box .main-result-value {
    display: block;
    font-size: clamp(3.5rem, 10vw, 5.5rem);
    font-weight: 800;
    color: var(--accent);
    font-family: 'Outfit', sans-serif;
    margin: 1.5rem 0;
    line-height: 1;
    filter: drop-shadow(0 0 20px rgba(255, 107, 0, 0.4));
}

#goals-table {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    margin-top: 4rem;
    padding-top: 4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

#goals-table div {
    background: rgba(255, 255, 255, 0.05);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

#goals-table div:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-5px);
}

#goals-table strong {
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.8rem;
    color: var(--accent);
}

#goals-table span {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--white);
    font-family: 'Outfit', sans-serif;
}

/* --- 3. COMMON COMPONENTS & UTILITIES --- */

.formula-explanation {
    background: var(--bg-offset);
    padding: 5rem 4rem;
    border-radius: 32px;
    margin: 6rem 0;
    border: 2px dashed #cbd5e0;
    position: relative;
}

.formula-explanation::after {
    content: '🧪';
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2.5rem;
    background: white;
    padding: 0 20px;
}

.formula-explanation h2 {
    font-size: 2.2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.formula-box {
    background: white;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
    margin-top: 2.5rem;
    border-left: 6px solid var(--accent);
}

.formula-box p {
    font-style: italic;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.formula-box p:last-child {
    margin-bottom: 0;
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.mini-card {
    background: var(--white);
    padding: 3rem 2.5rem;
    border-radius: 24px;
    text-align: center;
    border: 2px solid #edf2f7;
    box-shadow: var(--shadow);
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
}

.mini-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
}

.mini-card h4 {
    font-size: 1.4rem;
    margin-bottom: 0.8rem;
    color: var(--primary);
}

.mini-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* --- 4. LEGACY & COMPATIBILITY LAYER --- */

.calculator-box {
    background: var(--white);
    padding: 4rem;
    border-radius: 32px;
    margin: 4rem auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid #edf2f7;
    max-width: 800px;
}

.btn-calculate {
    display: block;
    width: 100%;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 10px 20px rgba(10, 25, 47, 0.2);
}

.btn-calculate:hover {
    background: var(--accent);
    transform: translateY(-5px);
    box-shadow: 0 15px 30px var(--accent-glow);
}

.result-container {
    margin-top: 4rem;
    padding: 3.5rem;
    background: var(--bg-offset);
    border-radius: 28px;
    border-left: 8px solid var(--accent);
    box-shadow: var(--shadow-lg);
}

.result-container h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.result-container #bmi-value {
    font-size: 4rem;
    font-weight: 800;
    color: var(--accent);
    display: block;
    margin: 1rem 0;
}

.bmi-bar {
    height: 16px;
    background: #e2e8f0;
    border-radius: 10px;
    margin-top: 2.5rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(5px);
}

#bmi-indicator {
    position: absolute;
    height: 100%;
    width: 8px;
    background: var(--primary);
    top: 0;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(10, 25, 47, 0.3);
    transition: left 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* --- 5. RESPONSIVE DESIGN --- */

@media (max-width: 900px) {
    .calc-card-wide {
        padding: 3rem 2rem;
    }
}

/* --- BMI Table Styles --- */

.bmi-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 3rem 0;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.bmi-table th {
    background: var(--primary);
    color: white;
    padding: 1.5rem;
    text-align: left;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 1px;
}

.bmi-table td {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid #edf2f7;
    font-weight: 500;
}

.range-under {
    background-color: #f0f7ff;
    color: #2b6cb0;
}

.range-normal {
    background-color: #f0fff4;
    color: #2f855a;
}

.range-over {
    background-color: #fffaf0;
    color: #c05621;
}

.range-obese {
    background-color: #fff5f5;
    color: #c53030;
}

.bmi-table tr:hover {
    filter: brightness(0.95);
}

@media (max-width: 768px) {
    .calculator-intro {
        padding: 60px 0 40px;
    }

    .cluster-title {
        font-size: 1.8rem;
    }

    .result-box {
        padding: 2.5rem 1.5rem;
    }

    .result-box .main-result-value {
        font-size: 3.5rem;
    }

    .input-grid {
        gap: 2rem;
    }

    .radio-group {
        flex-direction: column;
        gap: 1.2rem;
    }

    #goals-table {
        grid-template-columns: 1fr;
    }
}

/* --- 6. SILO LAYOUT & ADS --- */

.silo-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 4rem;
    margin-top: 6rem;
    align-items: start;
}

@media (max-width: 1100px) {
    .silo-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        order: 2;
    }

    .content {
        order: 1;
    }
}

.sidebar {
    position: sticky;
    top: 100px;
}

.toc {
    background: var(--bg-offset);
    padding: 2.5rem;
    border-radius: 24px;
    border: 1px solid #edf2f7;
    margin-bottom: 2.5rem;
}

.toc h4 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.toc ul {
    list-style: none;
    padding: 0;
}

.toc ul li {
    margin-bottom: 1rem;
}

.toc ul li a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    transition: var(--transition);
    display: block;
}

.toc ul li a:hover {
    color: var(--accent);
    transform: translateX(5px);
}

.ad-banner {
    background: #f7fafc;
    border: 2px dashed #cbd5e0;
    padding: 2.5rem;
    text-align: center;
    border-radius: 20px;
    margin: 4rem 0;
    color: #718096;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.8rem;
}

.ad-sidebar-box {
    background: var(--primary);
    color: white;
    padding: 2.5rem;
    border-radius: 24px;
    text-align: center;
    margin-top: 2rem;
}

.ad-sidebar-box p {
    font-size: 0.7rem;
    opacity: 0.7;
    letter-spacing: 2px;
    margin-bottom: 1rem;
}

/* --- 7. ADVANCED UI COMPONENTS (SHARED) --- */

.hydration-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
    position: relative;
    z-index: 2;
}

.stat-item {
    background: rgba(255, 255, 255, 0.08);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.12);
}

.stat-item strong {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.8rem;
    color: var(--accent);
    opacity: 0.9;
}

.stat-item span {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    font-family: 'Outfit', sans-serif;
}

.stat-sub {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-top: 0.5rem;
    text-transform: uppercase;
}

/* Unit Switcher */
.unit-switcher-container {
    display: flex;
    justify-content: center;
    margin-bottom: 4rem;
}

.unit-switcher-pill {
    background: var(--bg-offset);
    padding: 6px;
    border-radius: 50px;
    display: flex;
    border: 1px solid #e2e8f0;
}

.unit-btn {
    border: none;
    background: transparent;
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-muted);
}

.unit-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(10, 25, 47, 0.2);
}

/* Selector Grids */
.gender-selector,
.climate-grid {
    display: flex;
    gap: 10px;
    background: var(--bg-offset);
    padding: 6px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
}

.gender-option,
.state-option {
    flex: 1;
    cursor: pointer;
    position: relative;
}

.gender-option input,
.state-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.gender-pill,
.state-option span {
    display: block;
    text-align: center;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.gender-option input:checked+.gender-pill,
.state-option input:checked+span {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* Input Units */
.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-unit input {
    flex: 1;
    padding-right: 60px;
}

.unit-tag {
    position: absolute;
    right: 20px;
    font-weight: 700;
    color: var(--accent);
    pointer-events: none;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.pro-tip {
    margin-top: 3rem;
    padding: 2.3rem;
    background: rgba(255, 107, 0, 0.05);
    border-radius: 24px;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-muted);
    border: 1px solid rgba(255, 107, 0, 0.15);
    position: relative;
    z-index: 2;
}

.result-box .pro-tip {
    background: rgba(255, 107, 0, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 107, 0, 0.2);
}

.pro-tip strong {
    color: var(--accent);
    display: block;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.content-section {
    margin-bottom: 5rem;
}

.content-section h2 {
    font-size: 2.4rem;
    margin-bottom: 2rem;
    color: var(--primary);
}

.mechanism-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 3rem 0;
}

.mechanism-card {
    background: white;
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid #edf2f7;
    box-shadow: var(--shadow);
}

.research-callout {
    background: #fffaf0;
    border-left: 8px solid #ed8936;
    padding: 3rem;
    border-radius: 0 24px 24px 0;
    margin: 4rem 0;
}

@media (max-width: 768px) {
    .calculator-intro {
        padding: 60px 0 40px;
    }

    .cluster-title {
        font-size: 1.8rem;
    }

    .result-box {
        padding: 2.5rem 1.5rem;
    }

    .result-box .main-result-value {
        font-size: 3.5rem;
    }

    .input-grid {
        gap: 2rem;
    }

    .radio-group {
        flex-direction: column;
        gap: 1.2rem;
    }

    #goals-table {
        grid-template-columns: 1fr;
    }

    .unit-switcher-pill {
        width: 100%;
    }

    .unit-btn {
        flex: 1;
        padding: 10px 15px;
        font-size: 0.8rem;
    }

    .gender-selector,
    .climate-grid {
        padding: 4px;
    }

    .gender-pill,
    .state-option span {
        padding: 10px 5px;
        font-size: 0.85rem;
    }

    .pro-tip {
        padding: 1.5rem;
        font-size: 0.9rem;
    }

    .full-width-mobile {
        grid-column: span 1 !important;
    }
}