:root {
    --primary: #006D4E;
    --primary-glow: rgba(0, 109, 78, 0.15);
    --secondary: #1e293b;
    --accent: #006D4E;
    --accent-light: #E6F7F1;
    --text-main: #0f172a;
    --text-muted: #707C8C;
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --input-bg: #f8fafc;
    --border-light: #e2e8f0;
    --border-dark: #cbd5e1;
    --radius-full: 9999px;
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 12px;
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    padding: 2rem 1rem;
    overflow-x: hidden;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'PT Serif', serif;
}

/* Background graphics - made subtle */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    filter: blur(100px);
    pointer-events: none;
}
.blob { position: absolute; border-radius: 50%; opacity: 0.1; }
.blob-1 { width: 50vw; height: 50vw; background: var(--primary); top: -10%; left: -10%; }
.blob-2 { width: 40vw; height: 40vw; background: var(--accent); bottom: -10%; right: -5%; }

/* App Structure */
.app-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

/* Header */
.header { text-align: center; }
.logo { display: inline-flex; align-items: center; justify-content: center; }
.logo-img { height: 160px; width: auto; object-fit: contain; }
.subtitle { color: var(--text-muted); font-size: 1.1rem; margin-top: 0.5rem; font-weight: 500; }

/* Main Card */
.calculator-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.04);
    padding: 3rem;
    width: 100%;
}

/* Form Structure */
.master-form { display: flex; flex-direction: column; gap: 3rem; }
.form-section { display: flex; flex-direction: column; gap: 1.5rem; }

.section-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}
.section-title i { width: 22px; height: 22px; color: var(--primary); }

/* Grid Layouts - Using minmax for safe shrinking */
.input-grid-triple {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* Inputs & Labels */
.input-group { display: flex; flex-direction: column; gap: 0.5rem; width: 100%; }
.input-group label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* BULLETPROOF VISIBLE INPUTS */
.input-group input {
    width: 100%;
    height: 56px;
    background-color: var(--input-bg);
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius-md);
    padding: 0 1.25rem;
    font-family: var(--font-main);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    transition: all 0.2s ease;
    appearance: none; /* remove mobile default styling */
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px var(--primary-glow);
}

/* Gender Toggle Radio Group */
.premium-radio-group {
    display: flex;
    background-color: var(--input-bg);
    border: 1.5px solid var(--border-dark);
    padding: 4px;
    border-radius: var(--radius-md);
    height: 56px;
    width: 100%;
}
.radio-label { flex: 1; position: relative; cursor: pointer; display: flex; }
.radio-label input { position: absolute; opacity: 0; cursor: pointer; }
.radio-custom {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-muted);
    transition: all 0.2s;
}
.radio-label input:checked + .radio-custom {
    background-color: var(--secondary);
    color: #ffffff;
}

/* Action Buttons */
.form-actions-master {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    width: 100%;
}

.master-calculate-btn {
    flex: 3;
    height: 60px;
    background-color: var(--primary);
    border: none;
    border-radius: var(--radius-full);
    color: #ffffff;
    font-family: var(--font-main);
    font-size: 1.15rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    cursor: pointer;
    box-shadow: 0 8px 25px var(--primary-glow);
    transition: transform 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
}
.master-calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px var(--primary-glow);
}

.master-reset-btn {
    flex: 1;
    height: 60px;
    background-color: #ffffff;
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius-full);
    color: var(--text-muted);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    appearance: none;
    -webkit-appearance: none;
}
.master-reset-btn:hover {
    background-color: #fee2e2;
    color: #ef4444;
    border-color: #f87171;
}

/* Results Dashboard - Premium Report Design */
.results-dashboard {
    margin-top: 3rem;
}

#capture-report-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Header Card */
.report-header-card {
    background-color: var(--primary); 
    border-radius: 16px;
    padding: 2.5rem;
    color: #ffffff;
    box-shadow: 0 10px 30px var(--primary-glow);
    position: relative;
    overflow: hidden;
}
.report-header-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background-color: rgba(255, 255, 255, 0.05); /* very subtle circle */
    border-radius: 50%;
}
.report-badge {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 1.25rem;
}
.report-title {
    font-size: 2.25rem;
    font-family: 'Times New Roman', Times, serif; /* Elegant serif as requested */
    margin: 0 0 0.5rem 0;
    font-weight: 700;
    line-height: 1.1;
}
.report-meta {
    font-size: 0.95rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}
.report-stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 2;
}
.stat-pill {
    background-color: rgba(255, 255, 255, 0.15);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    min-width: 80px;
}
.stat-label {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-bottom: 0.2rem;
}
.stat-pill strong {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Assessment Banner */
.assessment-banner {
    background-color: var(--accent-light);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.assessment-icon {
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.4);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.assessment-icon i { width: 30px; height: 30px; }
.assessment-content { flex: 1; }
.assessment-label {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--primary);
    margin-bottom: 0.5rem;
}
.assessment-content h3 {
    color: var(--primary);
    font-size: 1.75rem;
    margin: 0 0 0.5rem 0;
    font-family: 'Times New Roman', Times, serif;
}
.assessment-content p {
    color: var(--text-main);
    opacity: 0.8;
    margin: 0;
    font-size: 1.05rem;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

/* Card Structures */
.metric-card {
    background-color: #ffffff;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
}

.border-top-green { border-top: 4px solid var(--primary); }
.border-top-blue { border-top: 4px solid #707C8C; }
.border-top-orange { border-top: 4px solid #1e293b; }

.metric-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}
.metric-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: #64748b;
    letter-spacing: 1px;
}
.metric-subtitle {
    font-size: 0.9rem;
    color: #94a3b8;
}

.metric-value-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.metric-value {
    font-size: 3rem;
    font-weight: 800;
    font-family: 'Times New Roman', Times, serif;
}
.metric-unit {
    color: #64748b;
    font-weight: 600;
}

.text-green { color: var(--primary); }
.text-blue { color: #5A6A80; }
.text-orange { color: #1e293b; }

.metric-badge {
    align-self: flex-start;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 2rem;
}
.badge-green { background-color: var(--accent-light); color: var(--primary); }
.badge-blue { background-color: #f1f5f9; color: #5A6A80; }
.badge-orange { background-color: #e2e8f0; color: #1e293b; }

/* Progress */
.metric-progress-wrapper {
    width: 100%;
    height: 6px;
    background-color: #e2e8f0;
    border-radius: 3px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.metric-progress {
    height: 100%;
    border-radius: 3px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-green { background-color: #10b981; }
.progress-blue { background-color: #0ea5e9; }
.progress-orange { background-color: #f59e0b; }

.metric-desc {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

/* Master buttons */
.master-download-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem;
    background-color: var(--secondary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    font-family: var(--font-main);
}
.master-download-btn:hover { background-color: #1e293b; transform: translateY(-2px); }

/* Metric Icon Row */
.metric-icon-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.metric-icon-row i {
    width: 18px;
    height: 18px;
    color: #94a3b8;
}

/* BMI Gauge */
.bmi-gauge-container {
    width: 100%;
    max-width: 220px;
    margin: 0 auto 1rem;
}
.bmi-gauge {
    width: 100%;
    height: auto;
}
#bmi-needle {
    transform-origin: 100px 100px;
    transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Gradient Progress Bars */
.metric-progress {
    height: 100%;
    border-radius: 3px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-green { background: linear-gradient(90deg, #E6F7F1, var(--primary)); }
.progress-blue { background: linear-gradient(90deg, #f1f5f9, #707C8C); }
.progress-orange { background: linear-gradient(90deg, #e2e8f0, #1e293b); }

/* Calorie Breakdown */
.calorie-breakdown {
    background-color: #ffffff;
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 3rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border: 1px solid #f1f5f9;
}
.breakdown-chart-area {
    position: relative;
    width: 180px;
    height: 180px;
    flex-shrink: 0;
}
.donut-center-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
}
.donut-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    font-family: 'Times New Roman', Times, serif;
}
.donut-label {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
}
.breakdown-legend {
    flex: 1;
}
.breakdown-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.breakdown-title i { width: 20px; height: 20px; color: #64748b; }
.legend-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.legend-item:last-child { border-bottom: none; }
.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
}
.legend-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.legend-text strong {
    font-size: 0.95rem;
    color: #0f172a;
}
.legend-text span {
    font-size: 0.85rem;
    color: #64748b;
}

/* Target Card */
.target-card {
    background: linear-gradient(135deg, #0f172a, #1e3a5f);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    color: #ffffff;
}
.target-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.target-left > i {
    width: 40px;
    height: 40px;
    opacity: 0.6;
}
.target-label {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    opacity: 0.7;
    margin-bottom: 0.25rem;
}
.target-main-value {
    font-size: 2.5rem;
    font-weight: 800;
    font-family: 'Times New Roman', Times, serif;
    line-height: 1;
}
.target-main-value small {
    font-size: 1rem;
    font-weight: 600;
    opacity: 0.7;
}
.target-advice {
    font-size: 0.95rem;
    opacity: 0.8;
    max-width: 280px;
    text-align: right;
    line-height: 1.5;
    margin: 0;
}

@media (max-width: 768px) {
    .calorie-breakdown { flex-direction: column; text-align: center; gap: 1.5rem; }
    .breakdown-chart-area { margin: 0 auto; }
    .target-card { flex-direction: column; text-align: center; }
    .target-left { flex-direction: column; }
    .target-advice { text-align: center; max-width: 100%; }
}

/* Activity Grid */
.activity-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
.activity-label { cursor: pointer; display: block; }
.activity-label input { position: absolute; opacity: 0; width: 0; height: 0; }
.activity-card {
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.25rem 1rem;
    background-color: var(--card-bg);
    transition: all 0.2s ease;
    height: 100%;
}
.activity-title {
    font-weight: 700;
    color: var(--text-main);
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
    transition: color 0.2s;
}
.activity-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    opacity: 0.9;
}
.activity-label input:checked + .activity-card {
    border-color: var(--primary);
    background-color: var(--accent-light);
}
.activity-label input:checked + .activity-card .activity-title {
    color: var(--primary);
}

/* Styled Select */
.styled-select {
    width: 100%;
    height: 56px;
    background-color: var(--input-bg);
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius-md);
    padding: 0 1.25rem;
    font-family: var(--font-main);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%2364748b%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%226%209%2012%2015%2018%209%22%3E%3C%2Fpolyline%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2em;
}
.styled-select:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px var(--primary-glow);
}

/* Info Hub */
.info-hub { margin-top: 3rem; }
.faq-section { background: var(--card-bg); padding: 2.5rem; border-radius: var(--radius-xl); box-shadow: 0 10px 30px rgba(0,0,0,0.03); border: 1px solid var(--border-light); }
.faq-section h3 { font-size: 1.5rem; font-weight: 800; color: var(--secondary); margin-bottom: 1.5rem; text-align: center; }
.faq-item { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border-light); }
.faq-item:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.faq-question { font-size: 1.05rem; font-weight: 700; color: var(--secondary); margin-bottom: 0.5rem; }
.faq-answer { font-size: 0.95rem; color: var(--text-muted); line-height: 1.6; }

.footer { text-align: center; padding: 2rem 0; color: var(--text-muted); font-size: 0.9rem; }

/* Utils & Animations */
.hidden { display: none !important; }

.fade-in { animation: fadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

.result-box { 
    opacity: 0; 
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInUp { 
    from { opacity: 0; transform: translateY(30px) scale(0.95); } 
    to { opacity: 1; transform: translateY(0) scale(1); } 
}

.pulse-anim { animation: pulse 2s infinite; }
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(14, 165, 233, 0); }
    100% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0); }
}

.spin { animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Capture Mode Overrides */
.pdf-capture-mode * {
    animation: none !important;
    transition: none !important;
}
.pdf-capture-mode .result-box,
.pdf-capture-mode .fade-in-up {
    opacity: 1 !important;
    transform: none !important;
}

/* ========================================= */
/* STRICT MOBILE OPTIMIZATION                */
/* ========================================= */
@media screen and (max-width: 768px) {
    body {
        padding: 1rem 0.75rem; /* Tighter padding for mobile body */
    }

    .app-container {
        gap: 1.5rem;
    }

    .logo h1 { font-size: 2rem; }
    .subtitle { font-size: 1rem; }

    .calculator-card {
        padding: 1.5rem; /* Completely overwrite desktop padding */
        border-radius: var(--radius-lg); 
    }

    .master-form { gap: 2rem; }
    .form-section { gap: 1.25rem; }
    
    .section-title { font-size: 1rem; }

    /* Force grids to single column natively */
    .activity-grid, .input-grid-triple, .metrics-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .input-group input, .premium-radio-group {
        height: 50px; /* More standard mobile touch target */
        font-size: 1rem;
    }

    /* Force button stacking */
    .form-actions-master {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 0;
    }

    .master-calculate-btn, .master-reset-btn {
        width: 100%;
        flex: none; /* remove flex stretch */
    }

    .master-calculate-btn {
        height: 56px;
        font-size: 1.05rem;
    }

    .master-reset-btn {
        height: 50px;
        order: 2; /* Move reset below calculate */
    }
    
    .results-dashboard { margin-top: 2.5rem; }
    .report-title { font-size: 1.75rem; }
    .report-stats-row { gap: 0.5rem; }
    .stat-pill { min-width: 60px; padding: 0.5rem 0.8rem; }
    .assessment-banner { flex-direction: column; align-items: flex-start; }
    .metric-value { font-size: 2.25rem; }

    .master-download-btn {
        width: calc(100% - 2rem);
        margin: 1rem auto 0;
        height: 56px;
    }

    .faq-section { padding: 1.5rem; border-radius: var(--radius-lg); }
}

@media screen and (max-width: 380px) {
    /* Optimization for very small devices like SE */
    .calculator-card { padding: 1.25rem 1rem; }
    .logo h1 { font-size: 1.75rem; }
}
