/* BMR & BMI Calculator — page specific overrides (uses variables from main.css) */
.tool-container {
    padding: 80px 0;
    min-height: calc(100vh - 200px);
}

.tool-header {
    text-align: center;
    margin-bottom: 40px;
}

.tool-header h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
    color: var(--text);
}

.tool-header p {
    color: var(--text-light);
}

/* Calculator Toggle */
.calculator-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--card-bg);
    padding: 15px 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-light);
    transition: var(--transition);
    cursor: pointer;
}

.toggle-label.active {
    color: var(--primary);
    font-weight: 600;
}

.toggle-label i {
    font-size: 1.1rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #e5e7eb;
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .toggle-slider {
    background: var(--primary);
}

input:checked + .toggle-slider:before {
    transform: translateX(30px);
}

.calculator-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 60px;
}

.input-section, .result-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

.result-section {
    display: flex;
    flex-direction: column;
}

.input-section h3, .result-header h3 {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(227, 6, 19, 0.2);
}

.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.gender-selector {
    display: flex;
    gap: 15px;
}

.gender-selector input[type="radio"] {
    display: none;
}

.gender-selector label {
    padding: 12px 20px;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    flex: 1;
    background: #fff;
}

.gender-selector input[type="radio"]:checked + label {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 12px;
    color: var(--text-light);
    z-index: 1;
}

.input-with-icon input, .input-with-icon select {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    background: #fff;
}

.unit-select {
    position: absolute;
    right: 8px;
    width: auto !important;
    background: #f8fafc !important;
    padding: 6px 8px !important;
    border-left: 1px solid #e5e7eb !important;
    border-radius: 0 var(--radius) var(--radius) 0 !important;
}

.full-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    font-size: 1rem;
    background: #fff;
    transition: var(--transition);
}

.input-with-icon input:focus, 
.input-with-icon select:focus,
.full-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.1);
}

.input-help {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 5px;
    font-style: italic;
}

.calculate-btn {
    width: 100%;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(227, 6, 19, 0.2);
}

.result-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e5e7eb;
}

.status-indicator.ready {
    background: #22c55e;
}

.status-indicator.processing {
    background: #f59e0b;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.result-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    padding: 18px;
    background: #f8fafc;
    border-radius: var(--radius);
    border: 1px solid #e5e7eb;
    min-height: 200px;
}

.empty-result {
    text-align: center;
    color: var(--text-light);
}

.empty-result i {
    font-size: 2.3rem;
    color: #e5e7eb;
    margin-bottom: 10px;
}

/* Results Containers */
.results-container {
    display: none;
}

.results-container.active {
    display: block;
}

.summary-section {
    margin-top: 20px;
    padding: 20px;
    background: #f8fafc;
    border-radius: var(--radius);
    border: 1px solid #e5e7eb;
}

.summary-section h4 {
    margin-bottom: 15px;
    text-align: center;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.summary-item {
    text-align: center;
    padding: 20px;
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid #e5e7eb;
}

.summary-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 5px;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 5px;
}

.summary-description {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* BMR Specific Styles */
.calorie-breakdown {
    margin-top: 20px;
}

.calorie-breakdown h4 {
    margin-bottom: 15px;
    text-align: center;
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.breakdown-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid #e5e7eb;
    gap: 12px;
}

.breakdown-item.maintenance {
    border-left: 4px solid #3b82f6;
}

.breakdown-item.weight-loss {
    border-left: 4px solid #22c55e;
}

.breakdown-item.weight-gain {
    border-left: 4px solid #f59e0b;
}

.breakdown-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1rem;
}

.breakdown-content {
    flex: 1;
}

.breakdown-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 4px;
}

.breakdown-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.breakdown-description {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* BMI Specific Styles */
.bmi-scale {
    margin-top: 20px;
}

.bmi-scale h4 {
    margin-bottom: 15px;
    text-align: center;
}

.scale-container {
    position: relative;
    padding: 20px;
    background: #f8fafc;
    border-radius: var(--radius);
    border: 1px solid #e5e7eb;
}

.scale-bar {
    display: flex;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.scale-segment {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    position: relative;
    padding: 5px;
}

.scale-segment.underweight {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
}

.scale-segment.normal {
    background: linear-gradient(135deg, #4ade80, #16a34a);
}

.scale-segment.overweight {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.scale-segment.obese {
    background: linear-gradient(135deg, #f87171, #ef4444);
}

.scale-label {
    font-size: 0.7rem;
    margin-bottom: 2px;
}

.scale-range {
    font-size: 0.6rem;
    opacity: 0.9;
}

.scale-marker {
    position: absolute;
    top: -10px;
    transform: translateX(-50%);
    text-align: center;
    transition: left 0.5s ease;
}

.marker-dot {
    width: 16px;
    height: 16px;
    background: var(--primary);
    border: 3px solid white;
    border-radius: 50%;
    margin: 0 auto 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.marker-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.health-risks {
    margin-top: 20px;
}

.health-risks h4 {
    margin-bottom: 15px;
    text-align: center;
}

.risks-content {
    padding: 15px;
    background: #f8fafc;
    border-radius: var(--radius);
    border: 1px solid #e5e7eb;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Tool info */
.tool-info {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    margin-top: 40px;
}

.tool-info h2 {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(227, 6, 19, 0.2);
}

.tool-info h3 {
    margin: 18px 0 10px;
    color: var(--primary);
}

.tool-info h4 {
    margin: 15px 0 8px;
    color: var(--text);
}

.tool-info ul, .tool-info ol {
    margin-left: 18px;
    margin-bottom: 12px;
}

.tool-info li {
    margin-bottom: 6px;
}

/* Info Tabs */
.info-tabs {
    margin-top: 20px;
}

.tab-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.tab-button {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.formulas {
    margin: 15px 0;
}

.formula-item {
    padding: 15px;
    background: #f8fafc;
    border-radius: var(--radius);
    border: 1px solid #e5e7eb;
    font-family: monospace;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.bmi-categories {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 15px 0;
}

.category-item {
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid #e5e7eb;
    font-size: 0.9rem;
}

.category-item.underweight {
    background: #dbeafe;
    border-left: 4px solid #3b82f6;
}

.category-item.normal {
    background: #dcfce7;
    border-left: 4px solid #16a34a;
}

.category-item.overweight {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
}

.category-item.obese {
    background: #fee2e2;
    border-left: 4px solid #ef4444;
}

.disclaimer {
    padding: 15px;
    background: #fef3c7;
    border-radius: var(--radius);
    border: 1px solid #f59e0b;
    font-size: 0.9rem;
    margin-top: 15px;
}

/* Responsive */
@media (max-width: 980px) {
    .calculator-container {
        grid-template-columns: 1fr;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .breakdown-grid {
        grid-template-columns: 1fr;
    }
    
    .input-row {
        grid-template-columns: 1fr;
    }
    
    .bmi-categories {
        grid-template-columns: 1fr;
    }
    
    .tab-buttons {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .tool-header h1 {
        font-size: 1.8rem;
    }
    
    .toggle-container {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .scale-bar {
        flex-direction: column;
        height: auto;
    }
    
    .scale-segment {
        flex-direction: row;
        justify-content: space-between;
        padding: 10px;
    }
    
    .scale-label, .scale-range {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .input-section, .result-section {
        padding: 20px;
    }
    
    .gender-selector {
        flex-direction: column;
    }
    
    .breakdown-item {
        flex-direction: column;
        text-align: center;
    }
}