/* BMI Calculator Tool Styles */

/* Tool Container - Full Page Layout */
.bmi-calculator-tool {
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    padding: 0;
    margin: 0;
}

.tool-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

/* Tool Header */
.tool-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem 0;
}

.tool-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: rgb(34, 33, 33);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.tool-header h1 i {
    color: var(--primary-color);
    font-size: 1.8rem;
}

.tool-description {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 0;
    line-height: 1.6;
}

/* Calculator Interface */
.calculator-interface {
    margin-bottom: 2rem;
}

.calculator-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

/* Unit Selection */
.unit-selection {
    margin-bottom: 2rem;
}

.section-label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

.unit-tabs {
    display: flex;
    gap: 0.5rem;
    background: #f8fafc;
    padding: 0.25rem;
    border-radius: 8px;
}

.unit-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.unit-tab:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

.unit-tab.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.unit-tab i {
    font-size: 1rem;
}

/* Input Forms */
.input-forms {
    margin-bottom: 2rem;
}

.input-form {
    display: none;
}

.input-form.active {
    display: block;
}

.form-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f3f4f6;
}

.form-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.form-header p {
    font-size: 0.875rem;
    color: var(--text-light);
    margin: 0;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

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

.form-input {
    flex: 1;
    padding: 0.75rem;
    padding-right: 3rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.unit-label {
    position: absolute;
    right: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
    pointer-events: none;
}

.height-inputs {
    display: flex;
    gap: 0.5rem;
}

.height-inputs .input-with-unit {
    flex: 1;
}

/* Gender Selection */
.gender-selection {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-dark);
    cursor: pointer;
}

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

.radio-mark {
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

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

.radio-label input[type="radio"]:checked + .radio-mark::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.example-text {
    font-size: 0.875rem;
    color: var(--text-light);
    font-style: italic;
    text-align: center;
    margin-top: 0.5rem;
}

/* Action Controls */
.action-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.calculate-btn,
.clear-btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.calculate-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1d4ed8 100%);
    color: white;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.clear-btn {
    background: #f3f4f6;
    color: var(--text-dark);
}

.clear-btn:hover {
    background: #e5e7eb;
}

.calculate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Result Section */
.result-section {
    margin-top: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.result-section.show {
    opacity: 1;
    transform: translateY(0);
}

.result-display {
    background: white;
    border-radius: 12px;
    padding: 2rem;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f3f4f6;
}

.result-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.copy-result-btn {
    padding: 0.5rem;
    background: #f3f4f6;
    border: none;
    border-radius: 6px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-result-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* BMI Result Display */
.bmi-result-container {
    text-align: center;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.bmi-result-container.animate {
    opacity: 1;
    transform: translateY(0);
}

.bmi-value {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: block;
    transition: all 0.3s ease;
}

.bmi-value.counting {
    transform: scale(1.1);
}

.bmi-category {
    font-size: 1.5rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: inline-block;
    margin-bottom: 1rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.bmi-category.animate {
    opacity: 1;
    transform: translateY(0);
}

/* BMI Category Colors */
.bmi-category.underweight {
    background: #dbeafe;
    color: #1e40af;
}

.bmi-category.normal {
    background: #dcfce7;
    color: #166534;
}

.bmi-category.overweight {
    background: #fef3c7;
    color: #92400e;
}

.bmi-category.obese {
    background: #fee2e2;
    color: #dc2626;
}

/* BMI Scale Visualization */
.bmi-scale {
    margin-bottom: 2rem;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.bmi-scale.animate {
    opacity: 1;
    transform: translateY(0);
}

.scale-bar {
    display: flex;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.8s ease;
}

.scale-bar.animate {
    transform: scaleX(1);
}

.scale-segment {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    position: relative;
}

.scale-segment.underweight {
    background: #3b82f6;
}

.scale-segment.normal {
    background: #10b981;
}

.scale-segment.overweight {
    background: #f59e0b;
}

.scale-segment.obese {
    background: #ef4444;
}

.scale-segment::after {
    content: attr(data-range);
    position: absolute;
    bottom: -1.5rem;
    font-size: 0.75rem;
    color: var(--text-light);
    white-space: nowrap;
}

.bmi-indicator {
    position: absolute;
    top: -10px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid var(--text-dark);
    transform: translateX(-50%);
    left: 0%;
    opacity: 0;
    transition: left 1s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
}

.bmi-indicator.animate {
    opacity: 1;
}

/* Health Info and Ideal Weight */
.health-info,
.ideal-weight {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.health-info.animate,
.ideal-weight.animate {
    opacity: 1;
    transform: translateY(0);
}

.info-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-content {
    font-size: 0.875rem;
    color: var(--text-light);
    line-height: 1.6;
}

.age-note,
.gender-note {
    background: #f0f9ff;
    border-left: 4px solid var(--primary-color);
    padding: 0.75rem;
    margin: 1rem 0;
    border-radius: 0 4px 4px 0;
    font-size: 0.875rem;
}

.weight-range {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 1rem;
    border-radius: 6px;
    margin-top: 1rem;
}

.weight-label {
    font-size: 0.875rem;
    color: var(--text-light);
}

.weight-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary-color);
}

.height-conversion {
    background: #f0f9ff;
    border-left: 4px solid var(--primary-color);
    padding: 0.75rem;
    margin: 1rem 0;
    border-radius: 0 4px 4px 0;
    font-size: 0.875rem;
    color: var(--text-dark);
}

/* Calculation Breakdown */
.calculation-breakdown {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.calculation-breakdown.animate {
    opacity: 1;
    transform: translateY(0);
}

.breakdown-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breakdown-step {
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.breakdown-step.animate {
    opacity: 1;
    transform: translateX(0);
}

.step-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.step-formula {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: var(--primary-color);
    background: #f3f4f6;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.25rem;
}

.step-result {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Loading, Error, and Success States */
.loading-indicator,
.error-message,
.success-message {
    text-align: center;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.loading-indicator {
    background: #f3f4f6;
    color: var(--text-light);
}

.error-message {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.success-message {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 0.5rem;
}

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

/* Pulse animation for BMI value during counting */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.bmi-value.pulse {
    animation: pulse 0.3s ease-in-out;
}

/* Accessibility: Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    .result-section,
    .bmi-result-container,
    .bmi-category,
    .bmi-scale,
    .scale-bar,
    .bmi-indicator,
    .health-info,
    .ideal-weight,
    .calculation-breakdown,
    .breakdown-step {
        transition: none;
        animation: none;
    }

    .result-section.show,
    .bmi-result-container.animate,
    .bmi-category.animate,
    .bmi-scale.animate,
    .scale-bar.animate,
    .bmi-indicator.animate,
    .health-info.animate,
    .ideal-weight.animate,
    .calculation-breakdown.animate,
    .breakdown-step.animate {
        opacity: 1;
        transform: none;
    }
}

/* Popular Examples */
.popular-examples {
    margin-top: 2rem;
}

.popular-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.popular-title i {
    color: #fbbf24;
}

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

.example-item {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.example-item:hover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
    transform: translateY(-2px);
}

.example-icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.example-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

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

/* Related Tools Section */
.related-tools-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.related-tools-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.related-tools-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.related-tools-header h3 i {
    color: var(--primary-color);
}

.related-tools-header p {
    color: var(--text-light);
    margin: 0.5rem 0 0 0;
    font-size: 0.95rem;
}

.related-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.related-tool-link {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--primary-color);
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.related-tool-link:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1d4ed8 100%);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.related-tool-link i {
    font-size: 0.875rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .tool-container {
        padding: 1rem;
    }
    
    .calculator-card {
        padding: 1.5rem;
    }
    
    .unit-tabs {
        flex-direction: row;
        gap: 0.25rem;
    }

    .unit-tab {
        padding: 0.625rem 0.75rem;
        font-size: 0.8rem;
        gap: 0.375rem;
    }

    .unit-tab span {
        white-space: nowrap;
    }
    
    .input-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .gender-selection {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .height-inputs {
        flex-direction: row;
    }
    
    .action-controls {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .calculate-btn,
    .clear-btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 48px;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .bmi-value {
        font-size: 3rem;
    }

    .result-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .weight-range {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    /* Ensure animations are smooth on mobile */
    .result-section,
    .bmi-result-container,
    .bmi-scale,
    .health-info,
    .ideal-weight,
    .calculation-breakdown {
        transition-duration: 0.4s; /* Slightly faster on mobile */
    }

    .related-tools-section {
        padding: 1.5rem;
    }

    .related-tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .related-tool-link {
        padding: 0.625rem 0.75rem;
        font-size: 0.8rem;
        flex-direction: column;
        gap: 4px;
    }

    .related-tool-link i {
        font-size: 1.1rem;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .unit-tab {
        padding: 0.5rem 0.5rem;
        font-size: 0.75rem;
        gap: 0.25rem;
    }

    .unit-tab i {
        font-size: 0.875rem;
    }

    .related-tools-section {
        padding: 1rem;
    }

    .related-tools-grid {
        grid-template-columns: 1fr;
    }

    .related-tool-link {
        flex-direction: row;
        gap: 8px;
        justify-content: flex-start;
        text-align: left;
    }
}
