/**
 * BMI Calculator Tool Styles
 * Extends main.css with tool-specific styling
 * Light theme default with dark theme support
 */

.bmi-calculator-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Unit Toggle */
.unit-toggle {
    display: flex;
    gap: 0.5rem;
    padding: 0.25rem;
    background: #f3f4f6;
    border-radius: 8px;
    width: fit-content;
    margin: 0 auto;
}

.unit-btn {
    padding: 0.75rem 2rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.unit-btn:hover {
    color: #1f2937;
}

.unit-btn.active {
    background: #3b82f6;
    color: white;
}

/* Input Sections */
.input-section {
    margin-top: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1f2937;
}

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

.form-input {
    width: 100%;
    padding: 0.875rem 3rem 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    background: #ffffff;
    color: #1f2937;
    transition: all 0.2s ease;
}

.form-input:hover {
    border-color: #d1d5db;
}

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

.form-input::placeholder {
    color: #9ca3af;
}

.input-unit {
    position: absolute;
    right: 1rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #6b7280;
    pointer-events: none;
}

.height-imperial {
    display: flex;
    gap: 0.75rem;
}

/* Calculate Button */
.calculate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 300px;
    margin: 1.5rem auto 0;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.calculate-btn:active {
    transform: translateY(0);
}

.calculate-btn svg {
    flex-shrink: 0;
}

/* Result Section */
.result-section {
    margin-top: 2rem;
    padding: 2rem;
    border-top: 2px solid #e5e7eb;
    background: #f8fafc;
    border-radius: 16px;
    animation: slideIn 0.4s ease;
}

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

.result-main-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 1.5rem 0;
    text-align: center;
}

/* BMI Display */
.bmi-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.bmi-value-container {
    text-align: center;
}

.bmi-value {
    font-size: 4rem;
    font-weight: 800;
    color: #3b82f6;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.bmi-label {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bmi-category {
    text-align: center;
}

.category-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.category-badge.underweight {
    background: #dbeafe;
    color: #1e40af;
}

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

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

.category-badge.obese {
    background: #fee2e2;
    color: #991b1b;
}

.category-description {
    font-size: 0.9375rem;
    color: #6b7280;
    line-height: 1.5;
}

/* BMI Scale */
.bmi-scale {
    margin-bottom: 2rem;
}

.scale-bar {
    position: relative;
    height: 40px;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    margin-bottom: 0.75rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.scale-segment {
    flex: 1;
    height: 100%;
}

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

.scale-segment.normal {
    background: linear-gradient(to right, #22c55e, #4ade80);
}

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

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

.scale-indicator {
    position: absolute;
    top: -8px;
    left: 0;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid #1f2937;
    transform: translateX(-50%);
    transition: left 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.scale-labels {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.scale-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    text-align: center;
}

/* BMI Details */
.bmi-details {
    margin-bottom: 2rem;
}

.details-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 1rem 0;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.detail-item {
    padding: 1.25rem;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    text-align: center;
}

.detail-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.detail-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
}

/* Health Range */
.health-range {
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    border: 2px solid #22c55e;
    border-radius: 12px;
}

.range-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 1rem 0;
    text-align: center;
}

.range-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.range-item {
    text-align: center;
}

.range-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.range-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #22c55e;
}

.range-separator {
    font-size: 1.5rem;
    font-weight: 700;
    color: #6b7280;
}

/* Custom Modal */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-modal.show {
    opacity: 1;
}

.custom-modal-content {
    position: relative;
    max-width: 400px;
    width: 90%;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.custom-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: #fef2f2;
    border-bottom: 1px solid #fecaca;
}

.custom-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #dc2626;
    margin: 0;
}

.custom-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.custom-modal-close:hover {
    background: #fee2e2;
    color: #dc2626;
}

.custom-modal-body {
    padding: 1.5rem;
}

.custom-modal-body p {
    margin: 0;
    font-size: 1rem;
    color: #4b5563;
    line-height: 1.6;
}

.custom-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.custom-modal-btn {
    padding: 0.625rem 1.5rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-modal-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .height-imperial {
        flex-direction: row;
    }

    .bmi-value {
        font-size: 3rem;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }

    .range-info {
        flex-direction: column;
        gap: 1rem;
    }

    .range-separator {
        display: none;
    }

    .scale-label {
        font-size: 0.625rem;
    }

    .unit-btn {
        padding: 0.625rem 1.5rem;
        font-size: 0.875rem;
    }

    .result-section {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .bmi-display {
        padding: 1.5rem;
    }

    .bmi-value {
        font-size: 2.5rem;
    }

    .calculate-btn {
        max-width: 100%;
    }

    .unit-toggle {
        width: 100%;
    }

    .unit-btn {
        flex: 1;
    }
}

/* Dark Theme Support - System Preference */
@media (prefers-color-scheme: dark) {
    .unit-toggle {
        background: #1e293b;
    }

    .unit-btn {
        color: #94a3b8;
    }

    .unit-btn:hover {
        color: #e2e8f0;
    }

    .form-label {
        color: #e2e8f0;
    }

    .form-input {
        background: #1e293b;
        border-color: #334155;
        color: #e2e8f0;
    }

    .form-input:hover {
        border-color: #475569;
    }

    .form-input::placeholder {
        color: #64748b;
    }

    .input-unit {
        color: #94a3b8;
    }

    .result-section {
        background: rgba(15, 23, 42, 0.6);
        border-color: #1e293b;
    }

    .result-main-title {
        color: #e2e8f0;
    }

    .bmi-display {
        background: #1e293b;
        border-color: #334155;
    }

    .bmi-label {
        color: #94a3b8;
    }

    .category-description {
        color: #94a3b8;
    }

    .category-badge.underweight {
        background: rgba(59, 130, 246, 0.2);
        color: #93c5fd;
    }

    .category-badge.normal {
        background: rgba(34, 197, 94, 0.2);
        color: #86efac;
    }

    .category-badge.overweight {
        background: rgba(251, 191, 36, 0.2);
        color: #fcd34d;
    }

    .category-badge.obese {
        background: rgba(239, 68, 68, 0.2);
        color: #fca5a5;
    }

    .scale-indicator {
        border-top-color: #e2e8f0;
    }

    .scale-label {
        color: #94a3b8;
    }

    .details-title {
        color: #e2e8f0;
    }

    .detail-item {
        background: #1e293b;
        border-color: #334155;
    }

    .detail-label {
        color: #94a3b8;
    }

    .detail-value {
        color: #e2e8f0;
    }

    .health-range {
        background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
    }

    .range-title {
        color: #e2e8f0;
    }

    .range-label {
        color: #94a3b8;
    }

    .range-separator {
        color: #94a3b8;
    }

    .custom-modal-content {
        background: #1e293b;
        border-color: #334155;
    }

    .custom-modal-header {
        background: rgba(239, 68, 68, 0.15);
        border-bottom-color: rgba(239, 68, 68, 0.3);
    }

    .custom-modal-title {
        color: #fca5a5;
    }

    .custom-modal-close {
        color: #94a3b8;
    }

    .custom-modal-close:hover {
        background: rgba(239, 68, 68, 0.2);
        color: #fca5a5;
    }

    .custom-modal-body p {
        color: #cbd5e1;
    }

    .custom-modal-footer {
        background: #0f172a;
        border-top-color: #334155;
    }
}

/* Light Theme Specific (when explicitly set) */
[data-theme="light"] .unit-toggle {
    background: #f3f4f6;
}

[data-theme="light"] .unit-btn {
    color: #6b7280;
}

[data-theme="light"] .unit-btn:hover {
    color: #1f2937;
}

[data-theme="light"] .form-label {
    color: #1f2937;
}

[data-theme="light"] .form-input {
    background: #ffffff;
    border-color: #e5e7eb;
    color: #1f2937;
}

[data-theme="light"] .form-input:hover {
    border-color: #d1d5db;
}

[data-theme="light"] .form-input::placeholder {
    color: #9ca3af;
}

[data-theme="light"] .input-unit {
    color: #6b7280;
}

[data-theme="light"] .result-section {
    background: #f8fafc;
    border-color: #e5e7eb;
}

[data-theme="light"] .result-main-title {
    color: #1f2937;
}

[data-theme="light"] .bmi-display {
    background: #ffffff;
    border-color: #e5e7eb;
}

[data-theme="light"] .bmi-label {
    color: #6b7280;
}

[data-theme="light"] .category-description {
    color: #6b7280;
}

[data-theme="light"] .category-badge.underweight {
    background: #dbeafe;
    color: #1e40af;
}

[data-theme="light"] .category-badge.normal {
    background: #dcfce7;
    color: #166534;
}

[data-theme="light"] .category-badge.overweight {
    background: #fef3c7;
    color: #92400e;
}

[data-theme="light"] .category-badge.obese {
    background: #fee2e2;
    color: #991b1b;
}

[data-theme="light"] .scale-indicator {
    border-top-color: #1f2937;
}

[data-theme="light"] .scale-label {
    color: #6b7280;
}

[data-theme="light"] .details-title {
    color: #1f2937;
}

[data-theme="light"] .detail-item {
    background: #ffffff;
    border-color: #e5e7eb;
}

[data-theme="light"] .detail-label {
    color: #6b7280;
}

[data-theme="light"] .detail-value {
    color: #1f2937;
}

[data-theme="light"] .health-range {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
}

[data-theme="light"] .range-title {
    color: #1f2937;
}

[data-theme="light"] .range-label {
    color: #6b7280;
}

[data-theme="light"] .range-separator {
    color: #6b7280;
}

[data-theme="light"] .custom-modal-content {
    background: #ffffff;
    border-color: #e5e7eb;
}

[data-theme="light"] .custom-modal-header {
    background: #fef2f2;
    border-bottom-color: #fecaca;
}

[data-theme="light"] .custom-modal-title {
    color: #dc2626;
}

[data-theme="light"] .custom-modal-close {
    color: #6b7280;
}

[data-theme="light"] .custom-modal-close:hover {
    background: #fee2e2;
    color: #dc2626;
}

[data-theme="light"] .custom-modal-body p {
    color: #4b5563;
}

[data-theme="light"] .custom-modal-footer {
    background: #f9fafb;
    border-top-color: #e5e7eb;
}

/* Dark Theme Specific (when explicitly set) */
[data-theme="dark"] .unit-toggle {
    background: #1e293b;
}

[data-theme="dark"] .unit-btn {
    color: #94a3b8;
}

[data-theme="dark"] .unit-btn:hover {
    color: #e2e8f0;
}

[data-theme="dark"] .form-label {
    color: #e2e8f0;
}

[data-theme="dark"] .form-input {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .form-input:hover {
    border-color: #475569;
}

[data-theme="dark"] .form-input::placeholder {
    color: #64748b;
}

[data-theme="dark"] .input-unit {
    color: #94a3b8;
}

[data-theme="dark"] .result-section {
    background: rgba(15, 23, 42, 0.6);
    border-color: #1e293b;
}

[data-theme="dark"] .result-main-title {
    color: #e2e8f0;
}

[data-theme="dark"] .bmi-display {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .bmi-label {
    color: #94a3b8;
}

[data-theme="dark"] .category-description {
    color: #94a3b8;
}

[data-theme="dark"] .category-badge.underweight {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

[data-theme="dark"] .category-badge.normal {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

[data-theme="dark"] .category-badge.overweight {
    background: rgba(251, 191, 36, 0.2);
    color: #fcd34d;
}

[data-theme="dark"] .category-badge.obese {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

[data-theme="dark"] .scale-indicator {
    border-top-color: #e2e8f0;
}

[data-theme="dark"] .scale-label {
    color: #94a3b8;
}

[data-theme="dark"] .details-title {
    color: #e2e8f0;
}

[data-theme="dark"] .detail-item {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .detail-label {
    color: #94a3b8;
}

[data-theme="dark"] .detail-value {
    color: #e2e8f0;
}

[data-theme="dark"] .health-range {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
}

[data-theme="dark"] .range-title {
    color: #e2e8f0;
}

[data-theme="dark"] .range-label {
    color: #94a3b8;
}

[data-theme="dark"] .range-separator {
    color: #94a3b8;
}

[data-theme="dark"] .custom-modal-content {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .custom-modal-header {
    background: rgba(239, 68, 68, 0.15);
    border-bottom-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .custom-modal-title {
    color: #fca5a5;
}

[data-theme="dark"] .custom-modal-close {
    color: #94a3b8;
}

[data-theme="dark"] .custom-modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

[data-theme="dark"] .custom-modal-body p {
    color: #cbd5e1;
}

[data-theme="dark"] .custom-modal-footer {
    background: #0f172a;
    border-top-color: #334155;
}
