:root {
    --primary: #8b5cf6; /* Purple */
    --primary-hover: #7c3aed;
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --input-bg: rgba(15, 23, 42, 0.6);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    
    /* BMI Categories Colors */
    --underweight: #38bdf8; /* Light Blue */
    --normal: #10b981;      /* Emerald Green */
    --overweight: #f59e0b;  /* Amber */
    --obese: #ef4444;       /* Rose Red */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

.app-container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Glassmorphism Card */
.tool-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 35px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.tool-header {
    text-align: center;
    margin-bottom: 35px;
}

.icon-wrapper {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    border-radius: 20px;
    margin-bottom: 16px;
    box-shadow: 0 10px 25px -5px rgba(139, 92, 246, 0.5);
}

.icon-wrapper ion-icon {
    font-size: 36px;
    color: white;
}

.tool-header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tool-header p {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Layout Grid */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 30px;
}

/* Form Elements */
.inputs-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    justify-content: center;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper ion-icon {
    position: absolute;
    right: 15px;
    font-size: 20px;
    color: var(--primary);
    z-index: 2;
}

input[type="number"] {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 700;
    padding: 14px 45px 14px 15px;
    border-radius: 14px;
    outline: none;
    transition: all 0.3s ease;
}

input[type="number"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.btn-calculate {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    color: #fff;
    border: none;
    padding: 16px;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
    transition: all 0.3s;
    box-shadow: 0 10px 20px -5px rgba(139, 92, 246, 0.4);
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(139, 92, 246, 0.5);
}

/* Results Section - Custom Gauge */
.results-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 25px;
}

.bmi-gauge {
    position: relative;
    width: 250px;
    height: 125px; /* Half of width */
    margin-bottom: 20px;
}

.gauge-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.path-underweight { stroke: var(--underweight); }
.path-normal { stroke: var(--normal); }
.path-overweight { stroke: var(--overweight); }
.path-obese { stroke: var(--obese); }

.gauge-needle {
    transform-origin: 50px 50px;
    transform: rotate(-90deg); /* Start at 0 / left */
    transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1);
}

.bmi-value-display {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    padding: 5px 20px;
    border-radius: 20px;
    font-size: 1.5rem;
    font-weight: 800;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3);
}

.result-status {
    font-size: 1.3rem;
    font-weight: 800;
    margin-top: 15px;
    margin-bottom: 5px;
    color: #fff;
}

.result-message {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

/* Cross Linking Card */
.cross-link-card {
    width: 100%;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
    border: 1px dashed rgba(239, 68, 68, 0.4);
    border-radius: 14px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.cross-link-card ion-icon {
    font-size: 32px;
    color: #ef4444; /* Rose Red */
}

.cross-link-content {
    flex: 1;
}

.cross-link-content h4 {
    font-size: 0.9rem;
    color: #ef4444;
    margin-bottom: 5px;
}

.link-btn {
    display: inline-block;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.link-btn:hover {
    color: #ef4444;
    text-decoration: underline;
}

/* SEO Content Area */
.seo-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 25px;
}

.seo-content h2 {
    font-size: 1.3rem;
    color: #fff;
    margin-bottom: 12px;
}

.seo-content p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.8;
    margin-bottom: 10px;
}

.seo-content strong {
    color: var(--primary);
}

/* Ads Placeholder */
.ads-container {
    width: 100%;
    display: flex;
    justify-content: center;
}

.ads-placeholder {
    width: 100%;
    max-width: 728px;
    height: 90px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .calculator-grid {
        grid-template-columns: 1fr;
    }
}


/* Light Mode Theme Auto-injected */
body.light-mode {
    --bg-color: #f1f5f9;
    --card-bg: rgba(255, 255, 255, 0.85);
    --input-bg: rgba(255, 255, 255, 0.95);
    --text-main: #0f172a;
    --text-muted: #475569;
    --border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .tool-card, 
body.light-mode .article-container,
body.light-mode .seo-content {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #0f172a !important;
}

body.light-mode select, 
body.light-mode input, 
body.light-mode textarea {
    background: #fff;
    color: #0f172a;
    border-color: rgba(0,0,0,0.2);
}

body.light-mode .logo { color: #0f172a !important; text-shadow: none !important; }



/* Layout Fixes for Header & Footer */
body {
    display: block !important;
}
.app-container, .article-container {
    margin-left: auto !important;
    margin-right: auto !important;
}
