/* BMI Calculator PRO - RTL Support */

/* RTL Direction */
.bmi-calculator-container {
    direction: rtl;
    text-align: right;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 30px;
    box-sizing: border-box;
}

/* Header Styles */
.bmi-calculator-header {
    text-align: center;
    margin-bottom: 30px;
}

.bmi-calculator-title {
    font-size: 2.5em;
    color: #2c3e50;
    margin: 0 0 15px 0;
    font-weight: 700;
}

.bmi-calculator-description {
    font-size: 1.1em;
    color: #7f8c8d;
    margin: 0;
    line-height: 1.6;
}

/* Gender Tabs */
.gender-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    gap: 10px;
}

.gender-tab {
    padding: 12px 25px;
    background: #ecf0f1;
    color: #34495e;
    border: 2px solid #bdc3c7;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 1em;
}

.gender-tab:hover {
    background: #d5dbdb;
    border-color: #95a5a6;
}

.gender-tab.active {
    background: #3498db;
    color: white;
    border-color: #2980b9;
}

/* Form Styles */
.bmi-calculator-form {
    margin-bottom: 30px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.bmi-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1em;
}

.bmi-input {
    padding: 12px 15px;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #2c3e50;
}

.bmi-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.bmi-input:invalid {
    border-color: #e74c3c;
}

/* Calculate Button */
.calculate-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.calculate-btn:hover {
    background: linear-gradient(135deg, #2980b9, #1f5f8b);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.calculate-btn:active {
    transform: translateY(0);
}

/* Results Section */
.results-section {
    opacity: 0 !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    transition: all 0.5s ease;
    margin-top: 0 !important;
    padding: 0 !important;
    display: none !important;
    max-height: 0 !important;
    transform: scale(0) !important;
}

.results-section.show {
    opacity: 1 !important;
    visibility: visible !important;
    height: auto !important;
    max-height: 1000px !important;
    margin-top: 30px !important;
    padding: 0 !important;
    display: block !important;
    transform: scale(1) !important;
}

.maintenance-info {
    text-align: center;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    border-left: 5px solid #3498db;
}

.maintenance-info p {
    margin: 0;
    font-size: 1.1em;
    color: #2c3e50;
    font-weight: 600;
}

#daily-calories {
    color: #e74c3c;
    font-size: 1.3em;
    font-weight: 700;
}

/* Results Table */
.results-table {
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
}

.results-table table {
    width: 100%;
    border-collapse: collapse;
}

.results-table th {
    background: #34495e;
    color: white;
    padding: 15px;
    text-align: center;
    font-weight: 600;
    font-size: 1.1em;
}

.results-table td {
    padding: 20px 15px;
    text-align: center;
    border-bottom: 1px solid #ecf0f1;
}

.results-table tr:last-child td {
    border-bottom: none;
}

.result-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-label {
    font-weight: 600;
    color: #7f8c8d;
    font-size: 0.9em;
}

.number {
    font-size: 1.5em;
    font-weight: 700;
    color: #e74c3c;
}

/* BMI Result */
.bmi-result {
    text-align: center;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.bmi-result h3 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 1.3em;
}

#bmi-value {
    color: #e74c3c;
    font-weight: 700;
}

#bmi-category {
    margin: 0;
    font-size: 1.1em;
    color: #7f8c8d;
    font-weight: 600;
}

/* BMI Scale */
.bmi-scale {
    text-align: center;
    margin-top: 25px;
}

.bmi-scale h4 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 1.2em;
}

.scale-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.scale-item {
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.scale-item.healthy {
    background: #27ae60;
}

.scale-item.overweight {
    background: #f39c12;
}

.scale-item.obese {
    background: #e74c3c;
}

.scale-label {
    font-size: 0.9em;
}

.scale-range {
    font-size: 1.1em;
    font-weight: 700;
}

/* Error Messages */
.error-message {
    color: #e74c3c;
    font-size: 0.9em;
    margin-top: 5px;
    display: none;
}

.bmi-input.error {
    border-color: #e74c3c;
    background: #fdf2f2;
}

/* Loading State */
.calculate-btn.loading {
    background: #95a5a6;
    cursor: not-allowed;
}

.calculate-btn.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .bmi-calculator-container {
        padding: 20px;
        margin: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .bmi-calculator-title {
        font-size: 2em;
    }
    
    .scale-container {
        flex-direction: column;
        align-items: center;
    }
    
    .scale-item {
        min-width: 200px;
    }
}

@media (max-width: 480px) {
    .bmi-calculator-container {
        padding: 15px;
        margin: 10px;
    }
    
    .bmi-calculator-title {
        font-size: 1.8em;
    }
    
    .gender-tabs {
        flex-direction: column;
        align-items: center;
    }
    
    .gender-tab {
        width: 200px;
        text-align: center;
    }
}

/* RTL Specific Adjustments */
.bmi-calculator-container input[type="number"] {
    text-align: right;
}

.bmi-calculator-container select {
    text-align: right;
}

/* Focus States for Accessibility */
.bmi-input:focus,
.calculate-btn:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .bmi-calculator-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .calculate-btn,
    .gender-tabs {
        display: none;
    }
    
    .results-section {
        opacity: 1 !important;
    }
}
