/* ============================================
   CSS Variables & Reset
   ============================================ */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #8b5cf6;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --underweight-color: #3b82f6;
    --normal-color: #10b981;
    --overweight-color: #f59e0b;
    --obese-color: #ef4444;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius: 12px;
    --border-radius-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

/* ============================================
   Container & Layout
   ============================================ */
.container {
    max-width: 1400px;
    margin: 0 auto;
}

.content-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.calculator-container {
    flex: 1;
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 40px;
    animation: fadeInUp 0.6s ease-out;
}

/* ============================================
   Header
   ============================================ */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ============================================
   Unit Toggle
   ============================================ */
.unit-toggle {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    background: var(--bg-secondary);
    padding: 6px;
    border-radius: var(--border-radius);
}

.unit-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.unit-btn .icon {
    font-size: 1.2rem;
}

.unit-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.unit-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

/* ============================================
   Form Inputs
   ============================================ */
.bmi-form {
    margin-bottom: 32px;
}

.input-group {
    margin-bottom: 24px;
}

.input-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

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

.input-wrapper-dual {
    display: flex;
    gap: 12px;
}

.input-half {
    flex: 1;
}

.input-field {
    flex: 1;
    padding: 14px 16px;
    padding-right: 60px;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    transition: var(--transition);
    outline: none;
}

.input-field:focus {
    border-color: var(--primary-color);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-field::placeholder {
    color: var(--text-muted);
}

.input-unit {
    position: absolute;
    right: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    pointer-events: none;
}

/* ============================================
   Calculate Button
   ============================================ */
.calculate-btn {
    width: 100%;
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-icon {
    font-size: 1.3rem;
    transition: transform 0.3s ease;
}

.calculate-btn:hover .btn-icon {
    transform: translateX(4px);
}

/* ============================================
   Results Section
   ============================================ */
.results {
    margin-bottom: 32px;
}

.result-card {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-radius: var(--border-radius-lg);
    padding: 32px;
    text-align: center;
    margin-bottom: 24px;
    transition: var(--transition);
}

.result-header {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.result-value {
    font-size: 4rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 12px;
    line-height: 1;
}

.result-category {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.result-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ============================================
   BMI Scale
   ============================================ */
.bmi-scale {
    margin-top: 24px;
}

.scale-bar {
    display: flex;
    height: 40px;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.scale-segment {
    flex: 1;
    position: relative;
    transition: var(--transition);
}

.scale-segment:hover {
    opacity: 0.8;
    transform: scaleY(1.1);
}

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

.scale-segment.normal {
    background: linear-gradient(135deg, #10b981, #34d399);
}

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

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

.scale-segment::after {
    content: attr(data-range);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.scale-labels {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.scale-labels span {
    flex: 1;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ============================================
   Information Section
   ============================================ */
.info-section {
    background: var(--bg-secondary);
    padding: 32px;
    border-radius: var(--border-radius-lg);
    margin-top: 32px;
}

.info-section h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.info-section > p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.7;
}

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

.info-card {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    transition: var(--transition);
}

.info-card:nth-child(1) {
    border-left-color: var(--underweight-color);
}

.info-card:nth-child(2) {
    border-left-color: var(--normal-color);
}

.info-card:nth-child(3) {
    border-left-color: var(--overweight-color);
}

.info-card:nth-child(4) {
    border-left-color: var(--obese-color);
}

.info-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.info-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.info-range {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.info-card p:last-child {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================
   Content Articles & Educational Sections
   ============================================ */
.content-article {
    background: var(--bg-primary);
    padding: 32px;
    border-radius: var(--border-radius-lg);
    margin-top: 32px;
    box-shadow: var(--shadow-sm);
}

.content-article h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.content-article h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.content-article h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.content-article p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.8;
}

.content-article ul {
    margin: 16px 0;
    padding-left: 24px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.content-article li {
    margin-bottom: 10px;
}

.content-article li strong {
    color: var(--text-primary);
}

/* Formula Boxes */
.formula-box {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-left: 4px solid var(--primary-color);
    padding: 20px;
    border-radius: var(--border-radius);
    margin: 16px 0;
}

.formula-box h3 {
    font-size: 1.2rem;
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--primary-color);
}

.formula {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-primary);
    padding: 12px 16px;
    border-radius: 8px;
    margin: 12px 0;
    display: block;
}

.formula-example {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 12px;
    font-style: italic;
}

/* Health Implications */
.health-implications {
    margin-top: 20px;
}

.health-implications h4 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-top: 28px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.health-implications ul {
    background: var(--bg-secondary);
    padding: 20px 20px 20px 44px;
    border-radius: var(--border-radius);
    margin: 12px 0 16px 0;
}

/* Limitations List */
.limitations-list {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.limitation-item {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    transition: var(--transition);
}

.limitation-item:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.limitation-item h4 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.limitation-item p {
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.7;
}

/* Alternatives Grid */
.alternatives-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.alternative-item {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    padding: 24px;
    border-radius: var(--border-radius);
    border-top: 4px solid var(--primary-color);
    transition: var(--transition);
}

.alternative-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.alternative-item h4 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.15rem;
}

.alternative-item p {
    color: var(--text-secondary);
    margin-bottom: 0;
    font-size: 0.95rem;
    line-height: 1.7;
}

/* Tips Lists */
.tips-list {
    list-style: none;
    padding-left: 0;
    margin: 20px 0;
}

.tips-list li {
    background: var(--bg-secondary);
    padding: 16px 16px 16px 48px;
    margin-bottom: 12px;
    border-radius: var(--border-radius);
    position: relative;
    transition: var(--transition);
}

.tips-list li:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
}

.tips-list li::before {
    content: "✓";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--normal-color);
}

.tips-list li strong {
    color: var(--primary-color);
}

/* Medical Advice List */
.medical-advice-list {
    background: var(--bg-secondary);
    padding: 20px 20px 20px 44px;
    border-radius: var(--border-radius);
    margin: 16px 0;
    border-left: 4px solid var(--primary-color);
}

.medical-advice-list li {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

/* FAQ Items */
.faq-item {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    border-left: 4px solid var(--primary-light);
    transition: var(--transition);
}

.faq-item:hover {
    box-shadow: var(--shadow-md);
    border-left-color: var(--primary-color);
}

.faq-item h4 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.faq-item p {
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.8;
}

/* Disclaimer Box */
.disclaimer-box {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 2px solid #f59e0b;
    border-radius: var(--border-radius-lg);
    padding: 24px;
    margin-top: 32px;
}

.disclaimer-box h3 {
    color: #92400e;
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.2rem;
}

.disclaimer-box p {
    color: #78350f;
    margin-bottom: 0;
    line-height: 1.8;
    font-size: 0.95rem;
}

/* ============================================
   Ad Containers
   ============================================ */
.ad-container {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Style for AdSense units */
.adsbygoogle {
    display: block;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
}

.ad-top,
.ad-bottom {
    max-width: 100%;
}

.ad-sidebar {
    flex-shrink: 0;
    position: sticky;
    top: 20px;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    text-align: center;
    padding: 24px;
    margin-top: 40px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card.show {
    animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   Result Category Colors
   ============================================ */
.result-category.underweight {
    color: var(--underweight-color);
}

.result-category.normal {
    color: var(--normal-color);
}

.result-category.overweight {
    color: var(--overweight-color);
}

.result-category.obese {
    color: var(--obese-color);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1200px) {
    .ad-sidebar {
        display: none;
    }
    
    .content-wrapper {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }
    
    .calculator-container {
        padding: 24px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .result-value {
        font-size: 3rem;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .scale-segment::after {
        font-size: 0.6rem;
    }
    
    .scale-labels {
        flex-wrap: wrap;
    }
    
    .unit-toggle {
        flex-direction: column;
        gap: 8px;
    }
    
    .content-article {
        padding: 20px;
    }
    
    .content-article h2 {
        font-size: 1.5rem;
    }
    
    .content-article h3 {
        font-size: 1.2rem;
    }
    
    .alternatives-grid {
        grid-template-columns: 1fr;
    }
    
    .info-section {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.75rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .result-value {
        font-size: 2.5rem;
    }
    
    .info-section {
        padding: 20px;
    }
}

