/* ==================== CSS Variables & Design System ==================== */
:root {
    /* Color Palette */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #764ba2;
    
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-light: #718096;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f7fafc;
    --bg-overlay: rgba(255, 255, 255, 0.95);
    
    --border-color: #e2e8f0;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
    --border-radius-xl: 24px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* BMI Category Colors */
    --bmi-underweight: #3b82f6;
    --bmi-normal: #10b981;
    --bmi-overweight: #f59e0b;
    --bmi-obese: #ef4444;
}

/* ==================== Global Styles ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Battambang', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* ==================== Background Animation ==================== */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite ease-in-out;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.8) 0%, rgba(102, 126, 234, 0) 70%);
    top: -10%;
    left: -10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(118, 75, 162, 0.8) 0%, rgba(118, 75, 162, 0) 70%);
    bottom: -10%;
    right: -10%;
    animation-delay: 7s;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(240, 147, 251, 0.6) 0%, rgba(240, 147, 251, 0) 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 14s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(50px, -50px) scale(1.1);
    }
    66% {
        transform: translate(-50px, 50px) scale(0.9);
    }
}

/* ==================== Container & Card ==================== */
.container {
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card {
    background: var(--bg-overlay);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 40px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== Header ==================== */
.card-header {
    text-align: center;
    margin-bottom: 40px;
}

.title {
    font-size: 2rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
}

/* ==================== Form Styles ==================== */
.form {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.label-icon {
    font-size: 1.1rem;
}

.input {
    width: 100%;
    padding: 14px 18px;
    font-size: 1rem;
    font-family: 'Battambang', 'Inter', sans-serif;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-normal);
    outline: none;
}

.input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.input::placeholder {
    color: var(--text-light);
}

.select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a5568' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 45px;
}

/* ==================== Buttons ==================== */
.btn-calculate {
    margin-top: 16px;
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Battambang', 'Inter', sans-serif;
    color: white;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.btn-calculate::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn-calculate:hover::before {
    left: 100%;
}

.btn-calculate:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-calculate:active {
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 1.3rem;
    transition: transform var(--transition-normal);
}

.btn-calculate:hover .btn-icon {
    transform: translateX(4px);
}

.btn-reset {
    margin-top: 24px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 500;
    font-family: 'Battambang', 'Inter', sans-serif;
    color: var(--primary-color);
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.btn-reset:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-reset .btn-icon {
    font-size: 1.2rem;
    transition: transform var(--transition-normal);
}

.btn-reset:hover .btn-icon {
    transform: rotate(180deg);
}

/* ==================== Result Section ==================== */
.result {
    animation: fadeIn 0.5s ease-out;
}

.result.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-header {
    text-align: center;
    margin-bottom: 32px;
}

.result-title {
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-content {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.bmi-value-container {
    text-align: center;
    padding: 32px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: var(--border-radius-lg);
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.bmi-label {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
}

.bmi-value {
    font-size: 4rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.bmi-category {
    text-align: center;
    padding: 16px 24px;
    border-radius: var(--border-radius-md);
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    box-shadow: var(--shadow-md);
}

.bmi-category.underweight {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.bmi-category.normal {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.bmi-category.overweight {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.bmi-category.obese {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* ==================== BMI Scale ==================== */
.bmi-scale {
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
}

.scale-bar {
    height: 12px;
    background: linear-gradient(to right, 
        var(--bmi-underweight) 0%, 
        var(--bmi-underweight) 25%, 
        var(--bmi-normal) 25%, 
        var(--bmi-normal) 50%, 
        var(--bmi-overweight) 50%, 
        var(--bmi-overweight) 75%, 
        var(--bmi-obese) 75%, 
        var(--bmi-obese) 100%
    );
    border-radius: 6px;
    position: relative;
    margin-bottom: 16px;
}

.scale-indicator {
    position: absolute;
    top: -8px;
    width: 28px;
    height: 28px;
    background: white;
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: var(--shadow-md);
    transition: left var(--transition-slow);
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(-4px);
    }
}

.scale-labels {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    text-align: center;
}

.scale-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==================== Recommendation ==================== */
.recommendation {
    padding: 20px;
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.1) 0%, rgba(0, 242, 254, 0.1) 100%);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    line-height: 1.8;
}

/* ==================== User Info ==================== */
.user-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

.info-value {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* ==================== Footer ==================== */
.footer {
    margin-top: 40px;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    padding: 20px;
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
    .container {
        padding: 20px 16px;
    }
    
    .card {
        padding: 28px 24px;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .icon {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .bmi-value {
        font-size: 3rem;
    }
    
    .scale-labels {
        font-size: 0.75rem;
    }
    
    .user-info {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 24px 20px;
    }
    
    .title {
        font-size: 1.3rem;
        flex-direction: column;
        gap: 8px;
    }
    
    .bmi-value {
        font-size: 2.5rem;
    }
    
    .btn-calculate,
    .btn-reset {
        font-size: 1rem;
        padding: 14px 24px;
    }
}

/* ==================== Utility Classes ==================== */
.hidden {
    display: none !important;
}

/* ==================== Print Styles ==================== */
@media print {
    .background-animation,
    .btn-calculate,
    .btn-reset {
        display: none;
    }
    
    body {
        background: white;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
