/*
 * style.css
 *
 * Main stylesheet for the What's My BMI website.
 * @version 22.1 (Fixes scale arrow positioning)
 * @author RCG Websites
 */

/* --- CSS Variables (Default Light Theme) --- */
:root {
    --primary-color: #007bff;
    --primary-color-dark: #0056b3;
    --secondary-color: #6c757d;
    --background-color: #f4f7f9;
    --surface-color: #ffffff;
    --text-color: #212529;
    --text-muted-color: #6c757d;
    --border-color: #dee2e6;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    
    --success-bg-color: rgba(40, 167, 69, 0.1);
    --error-bg-color: rgba(220, 53, 69, 0.1);
    --warning-bg-color: rgba(255, 193, 7, 0.1);
    --info-bg-color: rgba(23, 162, 184, 0.1);
    
    --font-family-base: 'Roboto', sans-serif;
    --border-radius: 8px;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --transition-speed: 0.3s;
    
    /* Color variables for the new scale */
    --scale-under-bg: #3498db;
    --scale-normal-bg: #2ecc71;
    --scale-over-bg: #f1c40f;
    --scale-obesity1-bg: #e67e22;
    --scale-obesity2-bg: #d35400;
    --scale-obesity3-bg: #c0392b;
    --arrow-color: #343a40;
}

/* --- Dark Theme --- */
body.dark-mode {
    --primary-color: #0084ff;
    --primary-color-dark: #339aff;
    --secondary-color: #8c98a5;
    --background-color: #121212;
    --surface-color: #1e1e1e;
    --text-color: #e0e0e0;
    --text-muted-color: #8c98a5;
    --border-color: #3a3a3a;
    --success-bg-color: rgba(40, 167, 69, 0.2);
    --error-bg-color: rgba(220, 53, 69, 0.2);
    --warning-bg-color: rgba(255, 193, 7, 0.25);
    --info-bg-color: rgba(23, 162, 184, 0.2);
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    --arrow-color: #bbbbbb;
}

/* --- Reset and Base --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { 
    scroll-behavior: smooth; 
    overflow-x: hidden;
    width: 100%;
}
body {
    font-family: var(--font-family-base);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
main { flex-grow: 1; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
h1, h2, h3, h4 { line-height: 1.3; margin-bottom: 0.75rem; }
h1 { font-size: clamp(2rem, 5vw, 2.8rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
h3 { font-size: clamp(1.2rem, 3vw, 1.5rem); }
h4 { font-size: clamp(1.1rem, 2.5vw, 1.2rem); }
p { margin-bottom: 1rem; }
a { color: var(--primary-color); text-decoration: none; transition: color var(--transition-speed); }
a:hover { color: var(--primary-color-dark); }
img { max-width: 100%; height: auto; }
ul, ol { padding-left: 20px; margin-bottom: 1rem; }
li { margin-bottom: 0.5rem; }
hr.section-divider { border: 0; height: 1px; background-color: var(--border-color); margin: 2.5rem 0; }
strong, b { font-weight: 700; }

/* --- Responsive and Styled Tables --- */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin: 1.5rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.styled-table { 
    width: 100%; 
    min-width: 600px;
    border-collapse: collapse; 
    margin: 0; 
}
.styled-table th, .styled-table td { 
    padding: 14px 16px; 
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
}
.styled-table td {
    color: var(--text-color);
}
.styled-table th { 
    background-color: var(--background-color);
    color: var(--text-color); 
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}
.styled-table tbody tr:nth-child(even) {
    background-color: var(--background-color);
}
body.dark-mode .styled-table tbody tr:nth-child(even) {
    background-color: rgba(255,255,255,0.03);
}
.styled-table tbody tr:hover {
    background-color: var(--info-bg-color);
}
.styled-table tr:last-child td {
    border-bottom: none;
}
.styled-table td:first-child {
    font-weight: 500;
}


/* --- Utilities --- */
.card-shadow { background-color: var(--surface-color); border-radius: var(--border-radius); box-shadow: var(--box-shadow); transition: background-color var(--transition-speed), box-shadow var(--transition-speed); padding: 2rem; }
.text-center { text-align: center; }
.formula-box { background-color: var(--background-color); border: 1px solid var(--border-color); padding: 1rem; margin: 1.5rem 0; border-radius: var(--border-radius); text-align: center; font-size: 1.1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.horizontal-scroll-container { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 1.5rem; }

/* --- Callout Box Styles --- */
.callout-box {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border-left: 5px solid var(--info-color);
    background-color: var(--info-bg-color);
    margin: 1.5rem 0;
}
.callout-box .callout-icon {
    font-size: 1.8rem;
    line-height: 1.4;
    flex-shrink: 0;
    color: var(--info-color);
}
.callout-box .callout-text h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--info-color);
    font-size: 1.1rem;
    font-weight: 700;
}
.callout-box .callout-text p {
    margin: 0;
    color: var(--text-color);
    opacity: 0.9;
}
.callout-box.info { border-color: var(--primary-color); background-color: var(--info-bg-color); }
.callout-box.info .callout-icon, .callout-box.info h4 { color: var(--primary-color); }
.callout-box.warning { border-color: var(--warning-color); background-color: var(--warning-bg-color); }
.callout-box.warning .callout-icon, .callout-box.warning h4 { color: var(--warning-color); }
.callout-box.danger { border-color: var(--error-color); background-color: var(--error-bg-color); }
.callout-box.danger .callout-icon, .callout-box.danger h4 { color: var(--error-color); }
.callout-box.success { border-color: var(--success-color); background-color: var(--success-bg-color); }
.callout-box.success .callout-icon, .callout-box.success h4 { color: var(--success-color); }


/* --- Header and Navigation --- */
.main-header { background-color: var(--surface-color); box-shadow: 0 2px 5px rgba(0,0,0,0.1); padding: 1rem 0; position: sticky; top: 0; z-index: 1000; transition: background-color var(--transition-speed); }
.main-header .container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.5rem; font-weight: 700; color: var(--primary-color); flex-shrink: 0; margin-right: auto; }
.main-nav { display: flex; align-items: center; }
.nav-menu { list-style: none; display: flex; gap: 1.5rem; padding: 0; margin: 0; }
.nav-item { position: relative; }
.nav-link { color: var(--text-color); font-weight: 500; position: relative; padding: 0.5rem 0; white-space: nowrap; }
.nav-link::after { content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 2px; background-color: var(--primary-color); transition: width var(--transition-speed) ease; }
.nav-link:hover::after, .nav-link.active::after { width: 100%; }
.nav-link.active { color: var(--primary-color); }

.header-controls { display: flex; align-items: center; gap: 1rem; margin-left: 1.5rem; }
.dark-mode-btn { background: transparent; border: 1px solid var(--border-color); border-radius: 50%; width: 40px; height: 40px; font-size: 1.2rem; cursor: pointer; color: var(--text-color); display:flex; align-items:center; justify-content:center; }
.nav-toggle { display: none; }


/* --- Unit Switcher Styles --- */
.unit-switcher { position: relative; }
.unit-toggle-label { display: flex; align-items: center; cursor: pointer; background-color: var(--background-color); border: 1px solid var(--border-color); border-radius: 20px; height: 40px; width: 140px; padding: 4px; transition: background-color var(--transition-speed); }
.unit-toggle-label input { display: none; }
.unit-toggle-slider { position: relative; width: 100%; height: 100%; display: flex; align-items: center; border-radius: 16px; }
.unit-toggle-slider::before { content: ''; position: absolute; top: 0; left: 0; width: 50%; height: 100%; background-color: var(--primary-color); border-radius: 16px; transition: transform 0.3s ease; }
.unit-toggle-label input:checked + .unit-toggle-slider::before { transform: translateX(100%); }
.unit-text { flex: 1; text-align: center; z-index: 1; font-weight: 500; font-size: 0.9rem; transition: color 0.3s ease; }
.unit-text.imperial { color: #fff; }
.unit-text.metric { color: var(--text-color); }
.unit-toggle-label input:checked + .unit-toggle-slider .unit-text.imperial { color: var(--text-color); }
.unit-toggle-label input:checked + .unit-toggle-slider .unit-text.metric { color: #fff; }


/* --- Dropdown Menu Styles --- */
.nav-link.has-dropdown::after { content: none; }
.dropdown-menu { display: none; position: absolute; top: 100%; left: 0; min-width: 260px; background-color: var(--surface-color); border-radius: var(--border-radius); box-shadow: var(--box-shadow); border: 1px solid var(--border-color); padding: 0.5rem 0; z-index: 1010; opacity: 0; transform: translateY(10px); transition: opacity 0.2s ease, transform 0.2s ease; list-style: none; }
.nav-item:hover > .dropdown-menu { display: block; opacity: 1; transform: translateY(0); }
.dropdown-header { padding: 0.5rem 1.5rem; margin-top: 0.5rem; font-size: 0.8rem; font-weight: 700; color: var(--text-muted-color); text-transform: uppercase; letter-spacing: 0.5px; }
.dropdown-header:first-of-type { margin-top: 0; }
.dropdown-menu .dropdown-item { display: block; padding: 0.75rem 1.5rem; color: var(--text-color); white-space: nowrap; }
.dropdown-menu .dropdown-item:hover { background-color: var(--background-color); color: var(--primary-color); }

/* --- Footer --- */
.main-footer { background-color: var(--surface-color); color: var(--text-muted-color); padding: 3rem 0 1.5rem; margin-top: 3rem; border-top: 4px solid var(--primary-color); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; margin-bottom: 2rem; }
.footer-column h4 { color: var(--text-color); }
.footer-column ul { list-style: none; padding: 0; }
.footer-column li { margin-bottom: 0.5rem; }
.footer-bottom { text-align: center; border-top: 1px solid var(--border-color); padding-top: 1.5rem; font-size: 0.9rem; }
.footer-bottom .disclaimer { font-size: 0.8rem; max-width: 800px; margin: 0.5rem auto 0; }
.contact-email { font-weight: 700; font-size: 1.1rem; }

/* --- Buttons --- */
.btn { display: inline-block; padding: 0.75rem 1.5rem; border-radius: var(--border-radius); border: none; font-weight: 700; cursor: pointer; text-align: center; transition: all var(--transition-speed); }
.btn-primary { background-color: var(--primary-color); color: #fff; }
.btn-primary:hover { background-color: var(--primary-color-dark); }
.btn-secondary { background-color: var(--secondary-color); color: #fff; }
.btn-secondary:hover { background-color: #5a6268; }
.btn-tertiary { background: transparent; color: var(--text-muted-color); padding: 0.5rem 1rem; font-size: 0.9rem; }
.btn-tertiary:hover { color: var(--error-color); }

/* --- Pages and Sections --- */
.content-article, .faq-section, .static-content { max-width: 800px; margin: 2rem auto; }
.tool-page, .static-page { padding-top: 2rem; }
.static-header { text-align: center; padding-bottom: 2rem; border-bottom: 1px solid var(--border-color); margin-bottom: 2rem; }
.static-header h1 { font-size: 2.5rem; }
.static-header p { font-size: 1.2rem; color: var(--text-muted-color); margin-top: 0.5rem; }
.tools-section { background-color: var(--background-color); padding: 3rem 0; }
.section-title { text-align: center; font-size: 2rem; margin-bottom: 1rem; color: var(--text-color); }
.section-subtitle { text-align: center; max-width: 600px; margin: 0 auto 3rem auto; color: var(--text-muted-color); }
.tools-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.tool-card { padding: 1.5rem; background-color: var(--surface-color); border-radius: var(--border-radius); text-align: center; transition: transform 0.2s, box-shadow 0.2s; box-shadow: var(--box-shadow); }
.tool-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.12); }
.tool-card .btn { margin-top: 1rem; }
.tool-card-icon { font-size: 3rem; margin-bottom: 1rem; }
.category-title {
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-color);
    font-size: 1.5rem;
    position: relative;
}
.category-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background-color: var(--primary-color);
    margin: 0.5rem auto 0;
}

/* --- Tool Page Layout --- */
.tool-container { display: flex; flex-direction: column; align-items: center; gap: 2rem; }
.tool-form-column, .tool-results-column { width: 100%; max-width: 650px; }
.tool-results-column { display: none; flex-direction: column; gap: 1.5rem; padding-bottom: 1rem; }
.tool-container.results-active .tool-results-column { display: flex; }

/* --- Forms --- */
.form-title { font-size: 1.8rem; margin-bottom: 0.5rem; }
.form-subtitle { color: var(--text-muted-color); margin-bottom: 2rem; }
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.5rem; }
.form-group .height-inputs { display: flex; gap: 1rem; }
.form-group .height-inputs input { flex: 1; }
.form-group input, .form-group select { width: 100%; padding: 0.75rem; border: 2px solid var(--border-color); border-radius: var(--border-radius); background-color: var(--background-color); color: var(--text-color); font-size: 1rem; transition: border-color var(--transition-speed), box-shadow var(--transition-speed); }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2); }
.form-group input.is-invalid { border-color: var(--error-color); }
.form-group input.is-valid { border-color: var(--success-color); }
.radio-group { display: flex; gap: 0.5rem; }
.radio-group input[type="radio"] { display: none; }
.radio-label { flex: 1; text-align: center; padding: 0.75rem; border: 2px solid var(--border-color); border-radius: var(--border-radius); cursor: pointer; transition: all var(--transition-speed); }
.radio-group input[type="radio"]:checked + .radio-label { border-color: var(--primary-color); background-color: var(--primary-color); color: #fff; font-weight: 700; }
.form-buttons { display: flex; gap: 1rem; margin-top: 2rem; }
.form-buttons .btn { flex: 1; }
.optional-text { font-size: 0.9em; font-weight: 400; color: var(--text-muted-color); }
.form-text { font-size: 0.85rem; color: var(--text-muted-color); margin-top: 0.5rem; display: block; }

/* --- Results --- */
.results-container { min-height: 200px; position: relative; }
.loader-container { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.7); display: none; justify-content: center; align-items: center; z-index: 10; border-radius: var(--border-radius); }
body.dark-mode .loader-container { background-color: rgba(30, 30, 30, 0.7); }
.loader { width: 50px; height: 50px; border: 5px solid var(--border-color); border-top-color: var(--primary-color); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-message { padding: 1rem; background-color: var(--error-bg-color); color: var(--error-color); border: 1px solid var(--error-color); border-radius: var(--border-radius); text-align: center; }
.results-title { text-align: center; margin-bottom: 1rem; font-size: 1.8rem;}
.results-subtitle { text-align: center; margin-top: -0.5rem; margin-bottom: 1.5rem; color: var(--text-muted-color); }
.personalized-table-container { margin-top: 1.5rem; }
.personalized-table-container h4 { text-align: center; margin-bottom: 1rem; }
.result-table { width: 100%; border-collapse: collapse; }
.result-table th, .result-table td { padding: 0.75rem; border: 1px solid var(--border-color); text-align: center; }
.result-table th { background-color: var(--background-color); }
.result-table .highlight { background-color: var(--success-bg-color); font-weight: 700; }
.table-disclaimer { font-size: 0.8rem; text-align: center; color: var(--text-muted-color); margin-top: 0.5rem; }
.history-container { padding: 2rem; }
.history-container h3 { text-align: center; }
.history-list { list-style: none; padding: 0; max-height: 200px; overflow-y: auto; margin: 1rem 0; border: 1px solid var(--border-color); border-radius: var(--border-radius); }
.history-item { display: flex; justify-content: space-between; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-color); align-items: center; }
.history-item:last-child { border-bottom: none; }
.history-date { font-size: 0.9rem; color: var(--text-muted-color); }
.history-values { text-align: right; flex-grow: 1; margin-right: 1rem; }
.history-value { font-weight: 700; font-size: 1.1rem; }
.history-weight { font-size: 0.85rem; color: var(--text-muted-color); margin-left: 0.5rem; }
.history-item-delete { background: transparent; border: none; color: var(--text-muted-color); font-size: 1.5rem; font-weight: 700; line-height: 1; cursor: pointer; padding: 0 0.5rem; border-radius: 50%; flex-shrink: 0; transition: all var(--transition-speed); }
.history-item-delete:hover { color: var(--error-color); background-color: var(--error-bg-color); }

/* --- Modals --- */
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.6); }
.modal-content { background-color: var(--surface-color); margin: 10% auto; padding: 2rem; border: 1px solid var(--border-color); width: 90%; max-width: 700px; border-radius: var(--border-radius); position: relative; animation: slide-down 0.4s ease-out; }
@keyframes slide-down { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-close { color: var(--text-muted-color); position: absolute; top: 1rem; right: 1.5rem; font-size: 2rem; font-weight: bold; cursor: pointer; }
.modal-close:hover { color: var(--text-color); }
#error-modal .modal-content { max-width: 500px; text-align: center; }
#error-modal-message { margin: 1.5rem 0; }

/* --- FAQ --- */
.faq-section { padding: 2rem; }
.faq-item { border-bottom: 1px solid var(--border-color); }
.faq-item:last-child { border-bottom: none; }
.faq-question { width: 100%; background: none; border: none; text-align: left; padding: 1rem 0; font-size: 1.1rem; font-weight: 500; cursor: pointer; color: var(--text-color); display: flex; justify-content: space-between; align-items: center; }
.faq-question::after { content: '+'; font-size: 1.5rem; transition: transform var(--transition-speed); }
.faq-item.active .faq-question::after { transform: rotate(45deg); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.4s ease-out; }
.faq-answer p { padding: 1rem 0; margin-bottom: 0; font-size: 1rem; }
.faq-item.active .faq-answer { max-height: 300px; }

/* --- STANDARDIZED RESULT CARD STYLES --- */
.result-card, .interpretive-card { background: var(--surface-color); padding: 1.5rem; border-radius: var(--border-radius); border-left: 6px solid var(--border-color); transition: border-color 0.5s ease; box-shadow: var(--box-shadow); margin-top: 1.5rem; }
.interpretive-card { margin-top: 1.5rem; }
.result-row { display: flex; justify-content: space-between; align-items: baseline; padding: 0.85rem 0; border-bottom: 1px solid var(--border-color); }
.result-row:first-child { padding-top: 0; }
.result-row:last-of-type { border-bottom: none; padding-bottom: 0; }
.result-label { font-size: 1rem; color: var(--text-muted-color); margin-right: 1rem; }
.result-label .formula-credit { display: block; font-size: 0.8rem; font-style: italic; opacity: 0.8; }
.result-value { font-size: 1.3rem; font-weight: 700; color: var(--text-color); text-align: right; flex-shrink: 0; }
.result-value.main-value { font-size: 3rem; font-weight: 700; color: var(--primary-color); }
.result-value.secondary-value { font-size: 2.2rem; font-weight: 700; color: var(--secondary-color); }
body.dark-mode .result-value.secondary-value { color: #a9b3bb; }
.result-value-container { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.result-value-subtext { font-size: 1rem; font-weight: 500; color: var(--text-muted-color); margin-top: 0.25rem; }
.formula-credit { font-size: 0.8rem; color: var(--text-muted-color); font-weight: 400; }
.result-sub-section { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px dashed var(--border-color); }
.result-sub-section h4 { font-size: 1.1rem; color: var(--primary-color); margin-bottom: 1rem; text-align: center; }
.result-card.card-under, .interpretive-card.card-under { border-color: var(--scale-under-bg); }
.result-card.card-normal, .interpretive-card.card-normal { border-color: var(--scale-normal-bg); }
.result-card.card-over, .interpretive-card.card-over { border-color: var(--scale-over-bg); }
.result-card.card-obesity1, .interpretive-card.card-obesity1 { border-color: var(--scale-obesity1-bg); }
.result-card.card-obesity2, .interpretive-card.card-obesity2 { border-color: var(--scale-obesity2-bg); }
.result-card.card-obesity3, .interpretive-card.card-obesity3 { border-color: var(--scale-obesity3-bg); }
.result-card.card-bfp-essential, .interpretive-card.card-bfp-essential { border-color: var(--scale-under-bg); }
.result-card.card-bfp-athlete, .interpretive-card.card-bfp-athlete { border-color: #27ae60; }
.result-card.card-bfp-fitness, .interpretive-card.card-bfp-fitness { border-color: var(--scale-normal-bg); }
.result-card.card-bfp-acceptable, .interpretive-card.card-bfp-acceptable { border-color: var(--scale-over-bg); }
.result-card.card-bfp-attention, .interpretive-card.card-bfp-attention { border-color: var(--scale-obesity1-bg); }
.result-card.card-bfp-obese, .interpretive-card.card-bfp-obese { border-color: var(--scale-obesity3-bg); }
.interpretive-card h4 { color: var(--primary-color); }
.interpretive-card.card-under h4, .interpretive-card.card-bfp-essential h4 { color: var(--scale-under-bg); }
.interpretive-card.card-normal h4, .interpretive-card.card-bfp-fitness h4, .interpretive-card.card-bfp-athlete h4 { color: var(--scale-normal-bg); }
.interpretive-card.card-over h4, .interpretive-card.card-bfp-acceptable h4 { color: var(--scale-over-bg); }
.interpretive-card.card-obesity1 h4, .interpretive-card.card-bfp-attention h4 { color: var(--scale-obesity1-bg); }
.interpretive-card.card-obesity3 h4, .interpretive-card.card-bfp-obese h4 { color: var(--scale-obesity3-bg); }

/* --- BMI & FAT VISUAL SCALE --- */
.bmi-scale-container, .bfp-scale-container { margin: 1.5rem 0; padding-top: 20px; padding-bottom: 10px; position: relative; display: none; }
.result-card .bmi-scale-container, .result-card .bfp-scale-container { animation: fadeIn 0.5s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.bmi-scale, .bfp-scale { height: 18px; width: 100%; border-radius: 9px; position: relative; box-shadow: inset 0 1px 3px rgba(0,0,0,0.15); border: none; background: var(--border-color); }
.bmi-scale { background: linear-gradient( to right, var(--scale-under-bg) 0%, var(--scale-under-bg) 15%, var(--scale-normal-bg) 15%, var(--scale-normal-bg) 42%, var(--scale-over-bg) 42%, var(--scale-over-bg) 58%, var(--scale-obesity1-bg) 58%, var(--scale-obesity1-bg) 75%, var(--scale-obesity2-bg) 75%, var(--scale-obesity2-bg) 90%, var(--scale-obesity3-bg) 90%, var(--scale-obesity3-bg) 100% ); }
body.dark-mode .bmi-scale, body.dark-mode .bfp-scale { box-shadow: inset 0 1px 4px rgba(0,0,0,0.4); }

.bmi-scale-arrow, .bfp-scale-arrow {
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 14px solid var(--arrow-color); /* This creates a downward-pointing arrow */
    position: absolute;
    top: 6px; /* FIX: Positions the arrow correctly above the scale (Container padding-top 20px - arrow height 14px = 6px) */
    transform: translateX(-50%);
    transition: left 0.5s ease-out;
    z-index: 2;
}

.bmi-scale-labels, .bfp-scale-labels { display:flex; justify-content:space-between; margin-top:8px; padding:0 5px; font-size: clamp(0.7rem, 1.8vw, 0.8rem); color: var(--text-muted-color); opacity:0.8; }

/* --- MACRONUTRIENT CALCULATOR SPECIFIC STYLES --- */
.simple-macro-card { background: var(--surface-color); padding: 1.5rem; border-radius: var(--border-radius); box-shadow: var(--box-shadow); border-left: 6px solid var(--primary-color); margin-bottom: 2rem; }
.simple-macro-card h3 { text-align: center; margin-bottom: 0.5rem; }
.simple-macro-card .total-calories-value { font-size: 2.5rem; font-weight: 700; color: var(--primary-color); display: block; margin-bottom: 1.5rem; text-align: center; }
.simple-macro-grid { display: flex; justify-content: space-around; align-items: center; gap: 1rem; text-align: center; border-top: 1px solid var(--border-color); padding-top: 1.5rem; }
.simple-macro-item .macro-label { font-size: 1rem; font-weight: 500; margin-bottom: 0.25rem; display: block; }
.simple-macro-item .protein-label { color: #007bff; }
.simple-macro-item .carbs-label { color: #28a745; }
.simple-macro-item .fat-label { color: #ffc107; }
.simple-macro-item .macro-value { font-size: 1.5rem; font-weight: 700; color: var(--text-color); }
.result-card-grid { display: grid; grid-template-columns: 1fr 180px; gap: 1.5rem; align-items: center; background: var(--surface-color); padding: 1.5rem; border-radius: var(--border-radius); box-shadow: var(--box-shadow); margin: 0; }
.macro-chart-container { position: relative; height: 180px; width: 180px; }
.macro-details-table { width: 100%; border-collapse: collapse; border-radius: var(--border-radius); overflow: hidden; }
.macro-details-table thead th { background-color: var(--primary-color); color: #fff; padding: 0.75rem 1rem; text-align: left; font-weight: 700; }
.macro-details-table tbody td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border-color); }
.macro-details-table tbody tr:last-child td { border-bottom: none; }
.macro-details-table tbody td:nth-child(2), .macro-details-table tbody td:nth-child(3) { text-align: right; font-weight: 700; }
.macro-details-table .macro-grams-value { display: block; font-size: 0.85em; font-weight: 400; color: var(--text-muted-color); }
.macro-details-table .protein-row { background-color: rgba(0, 123, 255, 0.07); }
.macro-details-table .carbs-row { background-color: rgba(40, 167, 69, 0.07); }
.macro-details-table .fat-row { background-color: rgba(255, 193, 7, 0.07); }
.macro-details-table .protein-row td:first-child { border-left: 4px solid #007bff; }
.macro-details-table .carbs-row td:first-child { border-left: 4px solid #28a745; }
.macro-details-table .fat-row td:first-child { border-left: 4px solid #ffc107; }
.macro-meals-table .protein-bg-light { background-color: rgba(0, 123, 255, 0.1); }
.macro-meals-table .carbs-bg-light { background-color: rgba(40, 167, 69, 0.1); }
.macro-meals-table .fat-bg-light { background-color: rgba(255, 193, 7, 0.1); }
.alternative-plans-container h3 { margin-bottom: 1.5rem; }
.alternative-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.alternative-plan-card { background-color: var(--surface-color); border: 1px solid var(--border-color); border-top: 4px solid var(--secondary-color); border-radius: var(--border-radius); padding: 1.5rem; display: flex; flex-direction: column; transition: transform 0.2s ease-out, box-shadow 0.2s ease-out; }
.alternative-plan-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.12); }
.alternative-plan-card.plan-balanced { border-top-color: var(--primary-color); }
.alternative-plan-card.plan-high-protein { border-top-color: #c0392b; }
.alternative-plan-card.plan-low-carb { border-top-color: #e67e22; }
.alternative-plan-card.plan-keto { border-top-color: #8e44ad; }
.alternative-plan-card h4 { color: var(--text-color); margin-bottom: 0.5rem; }
.alternative-plan-card .plan-description { font-size: 0.85rem; color: var(--text-muted-color); margin-bottom: 1rem; flex-grow: 1; }
.alternative-plan-card ul { list-style: none; padding: 0; margin: 0; font-size: 0.95rem; }
.alternative-plan-card li { display: flex; justify-content: space-between; align-items: baseline; padding: 0.5rem 0; border-bottom: 1px solid var(--border-color); }
.alternative-plan-card li:last-child { border-bottom: none; }
.alternative-plan-card .macro-cal { font-size: 0.8rem; color: var(--text-muted-color); margin-left: 0.25rem; }
.custom-macro-inputs { border: 1px solid var(--border-color); border-radius: var(--border-radius); padding: 1rem 1.5rem; margin-top: 1rem; }
.custom-macro-title { font-weight: 500; margin-bottom: 1.5rem; }
.custom-macro-inputs .form-group { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.custom-macro-inputs .form-group label { flex-basis: 120px; margin-bottom: 0; }
.custom-macro-inputs input[type="range"] { width: 100%; flex-grow: 1; }
.custom-macro-inputs .percent-value { font-weight: 700; flex-basis: 50px; text-align: right; }

/* --- ABOUT US PAGE --- */
.values-container { display: flex; flex-direction: column; gap: 1.5rem; margin-top: 2rem; }

/* --- CUSTOM CHECKBOX STYLES --- */
.checkbox-label { display: flex; align-items: center; cursor: pointer; font-weight: 500; gap: 0.75rem; padding: 0.75rem; border: 2px solid var(--border-color); border-radius: var(--border-radius); transition: all var(--transition-speed); }
.checkbox-label:hover { border-color: var(--primary-color); }
.checkbox-label input[type="checkbox"] { width: 1.25em; height: 1.25em; margin: 0; flex-shrink: 0; cursor: pointer; }

/* --- Water visualization --- */
.water-icon-group { text-align: center; margin: 1rem 0; line-height: 1.5; }
.water-icon { font-size: 2rem; color: var(--primary-color); margin: 0 0.2rem; display: inline-block; }

/* --- Responsiveness --- */
@media (max-width: 992px) {
    .main-header .container { flex-wrap: wrap; }
    .logo { order: 1; }
    .nav-toggle { order: 3; margin-left: 0.5rem; display: block; background: none; border: none; cursor: pointer; padding: 0.5rem; z-index: 1020; }
    .header-controls { order: 2; margin-left: auto; }
    .main-nav { order: 4; width: 100%; flex-basis: 100%; justify-content: flex-start;}
    .hamburger, .hamburger::before, .hamburger::after { content: ''; display: block; width: 25px; height: 3px; background-color: var(--text-color); transition: all var(--transition-speed); position: relative; }
    .hamburger::before { top: -8px; }
    .hamburger::after { top: 8px; }
    .nav-toggle.active .hamburger { background-color: transparent; }
    .nav-toggle.active .hamburger::before { transform: translateY(8px) rotate(45deg); }
    .nav-toggle.active .hamburger::after { transform: translateY(-8px) rotate(-45deg); }
    .nav-menu { display: none; flex-direction: column; width: 100%; background-color: var(--surface-color); padding: 1rem 0; margin-top: 1rem; border-top: 1px solid var(--border-color); }
    .nav-menu.active { display: flex; }
    .nav-menu.active .has-dropdown-parent > .nav-link.has-dropdown { display: none; }
    .nav-menu.active .dropdown-menu { display: block; position: static; width: 100%; box-shadow: none; border: none; padding: 0; background-color: transparent; opacity: 1; transform: none; margin-top: 1rem; }
    .nav-menu.active .dropdown-header { padding: 1rem 0 0.5rem; margin: 0; font-size: 0.8rem; font-weight: 700; color: var(--text-muted-color); text-transform: uppercase; }
    .nav-menu.active .dropdown-item { padding: 0.75rem 0; }
}
@media (max-width: 768px) {
    .result-card-grid { grid-template-columns: 1fr; }
    #macro-details-table-container { order: 2; }
    .macro-chart-container { order: 1; margin: 0 auto; }
    .personalized-table-container, .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .personalized-table-container .result-table, .styled-table { min-width: 500px; }
    .macro-details-table { table-layout: fixed; width: 100%; }
    .macro-details-table th, .macro-details-table td { padding: 0.75rem 0.5rem; font-size: 0.9rem; vertical-align: middle; }
    .macro-details-table .macro-grams-value { display: block; font-size: 0.8em; }
}
@media (max-width: 480px) {
    .header-controls { gap: 0.5rem; }
    .unit-switcher { display: none; }
}