/**
 * Health Calculators CSS
 * Responsive styling for all health calculators
 * Version: 1.0.0
 */

/* Reset and Base Styles */
.health-calculator * {
    box-sizing: border-box;
}

.health-calculator {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Header Styles */
.health-calculator-header {
    margin-bottom: 25px;
    text-align: center;
}

.health-calculator-title {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
}

.health-calculator-description {
    margin: 0;
    font-size: 16px;
    color: #666;
    line-height: 1.5;
}

/* Form Styles */
.health-calculator-form {
    margin-bottom: 25px;
}

.calculator-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field label {
    margin-bottom: 5px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
}

.required {
    color: #e74c3c;
    margin-left: 2px;
}

.form-field input,
.form-field select {
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
}

.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-field input.error,
.form-field select.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.calculate-btn,
.reset-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.calculate-btn {
    background: #3498db;
    color: white;
}

.calculate-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.reset-btn {
    background: #95a5a6;
    color: white;
}

.reset-btn:hover {
    background: #7f8c8d;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(149, 165, 166, 0.3);
}

/* Results Styles */
.health-calculator-results {
    margin-top: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.result-value {
    text-align: center;
    margin-bottom: 20px;
}

.result-value h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #2c3e50;
}

.result-value .value {
    font-size: 32px;
    font-weight: 700;
    color: #27ae60;
    margin: 10px 0;
}

.result-interpretation {
    margin-bottom: 20px;
}

.result-interpretation h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #2c3e50;
}

.result-interpretation p {
    margin: 0;
    font-size: 15px;
    color: #555;
}

.result-categories {
    margin-bottom: 20px;
}

.result-categories h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #2c3e50;
}

.category {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e1e5e9;
}

.category:last-child {
    border-bottom: none;
}

.category strong {
    color: #2c3e50;
}

.result-recommendations {
    margin-bottom: 0;
}

.result-recommendations h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #2c3e50;
}

.result-recommendations ul {
    margin: 0;
    padding-left: 20px;
}

.result-recommendations li {
    margin-bottom: 8px;
    font-size: 14px;
    color: #555;
}

/* Loading and Error States */
.loading {
    text-align: center;
    padding: 20px;
    color: #3498db;
    font-size: 16px;
    font-weight: 500;
}

.error-message {
    background: #fdf2f2;
    color: #e74c3c;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #e74c3c;
    font-weight: 500;
}

/* Disclaimer */
.health-calculator-disclaimer {
    margin-top: 25px;
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    font-size: 13px;
    color: #856404;
    line-height: 1.5;
}

.health-calculator-disclaimer strong {
    color: #856404;
}

/* Responsive Design */
@media (min-width: 768px) {
    .form-fields {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-actions {
        justify-content: flex-start;
    }
    
    .health-calculator {
        margin: 30px auto;
        padding: 30px;
    }
    
    .health-calculator-title {
        font-size: 28px;
    }
}

@media (min-width: 1024px) {
    .health-calculator {
        max-width: 700px;
    }
    
    .form-fields {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Print Styles */
@media print {
    .health-calculator {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .form-actions {
        display: none;
    }
    
    .health-calculator-disclaimer {
        background: #f5f5f5;
        border: 1px solid #ddd;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .health-calculator {
        border: 2px solid #000;
    }
    
    .form-field input,
    .form-field select {
        border: 2px solid #000;
    }
    
    .calculate-btn {
        background: #000;
        color: #fff;
    }
    
    .reset-btn {
        background: #666;
        color: #fff;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .form-field input,
    .form-field select,
    .calculate-btn,
    .reset-btn {
        transition: none;
    }
    
    .calculate-btn:hover,
    .reset-btn:hover {
        transform: none;
    }
}

/* Focus Styles for Accessibility */
.calculate-btn:focus,
.reset-btn:focus,
.form-field input:focus,
.form-field select:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Calculator-specific result styling */
.result-value .value.underweight {
    color: #f39c12;
}

.result-value .value.normal {
    color: #27ae60;
}

.result-value .value.overweight {
    color: #e67e22;
}

.result-value .value.obese {
    color: #e74c3c;
}

.result-value .value.optimal {
    color: #27ae60;
}

.result-value .value.elevated {
    color: #f39c12;
}

.result-value .value.high {
    color: #e74c3c;
}

.result-value .value.critical {
    color: #8e44ad;
}

/* Animation for results */
.health-calculator-results {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading spinner */
.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
