/* Primal Protocols - Modern Essentialist Theme (v2.0) */
/* Prevent horizontal scroll without breaking specific element widths */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

/* Apply box-sizing only to containers to protect your existing layout */
.container,
.insight-box,
.vitamin-profile {
    box-sizing: border-box;
}

:root {
    /* Brand Colors */
    --primary-purple: #45287d;
    --accent-teal: #22c1c3;

    /* Light Theme (Default) */
    --bg-light: #f4f6f8;
    --white: #ffffff;
    --text-dark: #2d3436;
    --text-soft: #636e72;
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --control-height: 34px;
    /* Added to replace hardcoded grays */
    --border-light: #eee;
    --border-dark: #ddd;
    --bg-muted: #f8f9fa;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

[data-theme="dark"] {
    --primary-purple: #b79cfa;
    --accent-teal: #22c1c3;

    --bg-light: #121418;
    --white: #1e2128;
    --text-dark: #f0f2f5;
    --text-soft: #a0aec0;
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.4);
    --border-light: #333a45;
    --border-dark: #4a5568;
    --bg-muted: #2a2f3a;
}

/* --- THEME TOGGLE BUTTON --- */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dark);
    /* Adapts automatically based on your variables */
    display: flex;
    position: relative;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    margin-left: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s ease, transform 0.3s ease;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background-color: var(--bg-muted);
    transform: scale(1.05);
    /* Slight "pop" effect on hover */
}

/* --- APPEARANCE DROPDOWN --- */
.appearance-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* Hide icons by default; JS will display the active one */
.theme-toggle svg {
    display: none;
}

/* The Tooltip styling */
.theme-toggle::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #222;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    z-index: 100;
}

/* Hover state with the 1s delay */
.theme-toggle:hover::after {
    opacity: 1;
    visibility: visible;
    transition-delay: 1s;
    /* Only shows after 1 second of hovering */
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background-color: var(--white);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius);
    list-style: none;
    padding: 0.5rem 0;
    min-width: 140px;
    box-shadow: var(--shadow-card);

    /* Animation settings */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-option {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: var(--text-dark);
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.theme-option:hover {
    background-color: var(--bg-muted);
}

/* Highlight for the currently selected option */
.theme-option.active {
    color: var(--primary-purple);
    font-weight: 700;
    background-color: var(--bg-muted);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* --- HEADER & NAVIGATION --- */
header {
    background: var(--white);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0rem 10px;
}

.logo-text-link {
    text-decoration: none;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-purple);
    display: flex;
    align-items: center;
}

.logoAccent {
    color: var(--accent-teal);
}

/* --- Brand Logo Sizing --- */
.brand-logo {
    height: 35px;
    width: auto;
    display: flex;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

nav a {
    text-decoration: none;
    color: var(--text-soft);
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--primary-purple);
}

.search-bar {
    display: flex;
    gap: 10px;
}

.search-bar input {
    background-color: var(--white);
    color: var(--text-dark);
    padding: 8px 12px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius);
    outline: none;
}

.subscription-form {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    position: relative;
}

.subscription-form input {
    background-color: var(--white);
    color: var(--text-dark);
    flex: 1;
    min-width: 200px;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius);
    outline: none;
}

.subscription-form input:focus {
    border-color: var(--accent-teal);
}

.subscription-form button {
    background: var(--primary-purple);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
}

.subscription-form button:hover {
    background: var(--accent-teal);
    transform: translateY(-2px);
}

.email-error {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    padding-left: 12px;
    margin-top: 5px;
    color: red;
    font-size: 0.8rem;
    display: none;
}

/* Mobile Elements (Hidden on Desktop) */
.mobile-toggle,
.mobile-search-icon {
    display: none;
}

/* --- MAIN CONTENT & TABS --- */
main {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    min-height: 80vh;
}

h1 {
    text-align: center;
    color: var(--primary-purple);
    font-size: 2.2rem;
    margin-bottom: 2rem;
}

.nutrition-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

.tab {
    padding: 12px 30px;
    border: 2px solid var(--border-light);
    background: white;
    color: var(--text-soft);
    font-weight: 700;
    cursor: pointer;
    border-radius: 16px;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.tab.active {
    background-color: var(--primary-purple);
    color: var(--white);
    border-color: var(--primary-purple);
    box-shadow: 0 4px 15px rgba(69, 40, 125, 0.2);
}

#vitamin-profiles {
    display: grid !important;
    /* This rule creates the "3 columns" look automatically */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
    gap: 30px;
    padding-bottom: 40px;
    width: 100%;
}

.vitamin-profile {
    background: var(--white);
    padding: 15px;
    /* Compact padding */
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    text-decoration: none;
    color: inherit;
    box-sizing: border-box;
    /* Lock dimensions to ensure grid uniformity */
    min-height: 190px;
    height: 100%;
    border: 2px solid transparent;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1)
}

.vitamin-profile h3 {
    margin: 0;
    color: var(--primary-purple);
    /* Slightly smaller font for compact feel */
    font-size: 1.1rem;
}

.vitamin-profile h4 {
    color: var(--primary-purple);
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 1rem;
}

.nutrient-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 0.5rem;
}

.nutrient-header h4 {
    margin: 0;
    flex: 1;
}

.nutrient-type-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.nutrient-type-pill[data-type="vitamin"] {
    background: #e8f4f8;
    color: #0277bd;
    border: 1px solid #01579b;
}

.nutrient-type-pill[data-type="mineral"] {
    background: #f3e5f5;
    color: #6a1b9a;
    border: 1px solid #4a148c;
}

.nutrient-type-pill[data-type="macronutrient"] {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #bf360c;
}

.vitamin-profile p {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.9rem;
    line-height: 1.4;
    /* Limit description to 3 lines to keep cards uniform */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vitamin-profile:hover {
    transform: translateY(-px);
    box-shadow: 0 15px 35px rgba(69, 40, 125, 0.12);
    border-color: var(--border-light);
}

.vitamin-profile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-purple);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.vitamin-profile:hover::before {
    opacity: 1;
}


.vitamin-info-wrapper {
    flex-grow: 1;
    color: var(--text-soft);
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vitamin-info-container {
    background: var(--bg-muted);
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    flex-shrink: 0;
    min-height: 100px;
}

.vitamin-info-container strong {
    color: var(--primary-purple);
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

/* --- Upgraded Nutrient Cards (Applies to Home & Nutrition pages) --- */

/* Create a responsive grid for the cards on both pages */
.featured-nutrients .nutrient-grid,
#vitamin-profiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

#vitamin-profiles .vitamin-profile {
    min-height: 180px;
}
    margin-top: 2rem;
}

/* 3. Bonus: Nudge the "View RDA Data" link on hover */
.vitamin-profile .card-link a {
    transition: transform 0.2s ease;
    display: inline-block;
}

.vitamin-profile:hover .card-link a {
    transform: translateX(5px); /* Gentle rightward shift to prompt the click */
}

/* Center the title specifically for this home page section */
.featured-nutrients .page-title {
    text-align: center;
    margin-bottom: 2.5rem;
}

/* --- FOOTER --- */
footer {
    background: var(--white);
    border-top: 1px solid var(--border-light);
    padding: 3rem 0;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-row-bottom {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2rem;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section li {
    margin-bottom: 10px;
}

.footer-section a {
    text-decoration: none;
    color: var(--text-soft);
}

/* --- SOCIAL MEDIA ICONS --- */
.footer-section .fa-brands {
    font-size: 1.2rem;
    /* Increases the icon size (default is usually 1rem) */
    margin-right: 5px;
    /* Adds some comfortable spacing between the icons */
    transition: transform 0.2s ease, color 0.2s ease;
}

/* Optional: Adds a slight "pop" and color change when a user hovers over them */
.footer-section a:hover .fa-brands {
    color: var(--accent-teal);
    transform: scale(1.1);
}

.copyright {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-soft);
    font-size: 0.8rem;
}

.disclaimer-container {
    font-size: 0.75rem;
    color: var(--text-soft);
    text-align: center;
    margin-top: 2rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* --- FILTER CONTROLS --- */
.filter-controls {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#nutrientSearch {
    background-color: var(--white);
    padding: 12px 20px;
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

#nutrientSearch:focus {
    border-color: var(--primary-purple);
    outline: none;
}

.category-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border-dark);
    background-color: var(--white);
    color: var(--text-soft);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    border-color: var(--primary-purple);
    color: var(--primary-purple);
}

.filter-btn.active {
    background: var(--primary-purple);
    color: white;
    border-color: var(--primary-purple);
}

/* Nutrition Overview Card */
.nutrition-overview-card {
    background: linear-gradient(135deg, var(--primary-purple) 0%, #2a1b4e 100%);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    border-left: 5px solid var(--accent-teal);
}

.nutrition-overview-card h3 {
    margin-top: 0;
    color: var(--accent-teal);
    font-size: 1.5rem;
    margin-bottom: 0.2rem;
}

.nutrition-overview-card .subtitle {
    color: var(--text-soft);
    font-style: italic;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.nutrition-overview-card .overview-text {
    line-height: 1.6;
    opacity: 0.9;
    color: white;
}

.nutrient-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.nutrient-column h4 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    color: var(--text-dark);
}

.nutrient-column p {
    opacity: 0.9;
    color: white;
}

.nutrient-column .macro-title {
    color: var(--accent-teal);
}

.nutrient-column .micro-title {
    color: var(--accent-teal);
}

.nutrient-column ul {
    list-style-type: none;
    padding-left: 0;
    margin-top: 0.5rem;
}

.nutrient-column li {
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    opacity: 0.9;
    color: white;
    position: relative;
    padding-left: 15px;
}

.nutrient-column li::before {
    content: "•";
    color: var(--accent-teal);
    font-weight: bold;
    position: absolute;
    left: 0;
}



/* --- HERO SECTION --- */
.hero-section {
    background: linear-gradient(135deg, var(--primary-purple) 0%, #2a1b4e 100%);
    color: white;
    padding: 0.5rem 20px 3rem;
    text-align: center;
    border-radius: var(--radius);
    margin-bottom: 3rem;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-content p {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto 2rem;
    opacity: 0.9;
}

.highlight {
    color: var(--accent-teal);
}

/* Buttons */
.hero-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.button {
    padding: 12px 30px;
    border-radius: 16px;
    text-decoration: none;
    font-weight: 700;
    transition: transform 0.2s;
}

.button.primary {
    background-color: var(--accent-teal);
    color: var(--primary-purple);
}

.button.secondary {
    background: transparent;
    border: 2px solid white;
    color: white;
}

/* --- HERO SECTION SEARCH BAR --- */
.hero-search-wrapper {
    margin: 2rem auto;
    max-width: 550px;
    width: 100%;
}

.search-wrapper:focus-within {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(69, 40, 125, 0.1);
}

.search-wrapper input {
    border: none;
    outline: none;
    width: 100%;
    height: 100%;
    font-size: 1rem;
    background: transparent;
    color: var(--text-dark);
}

.hero-search-form {
    display: flex;
    gap: 10px;
    width: 100%;
}

.hero-search-form input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid var(--border-dark);
    border-radius: var(--radius);
    font-size: 1rem;
    background-color: var(--white);
    color: var(--text-dark);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.hero-search-form input:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(69, 40, 125, 0.15);
}

.hero-search-form .button.primary {
    margin: 0;
    /* Override any default button margins */
    padding: 0 24px;
    white-space: nowrap;
}



.button:hover {
    transform: translateY(-3px);
}

/* --- FEATURED INSIGHT --- */
.featured-insight {
    margin: 4rem auto;
    max-width: 1200px;
}

.insight-box {
    background: linear-gradient(135deg, var(--primary-purple) 0%, #2a1b4e 100%);
    color: white;
    padding: 3rem 20px;
    border-radius: var(--radius);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.insight-box .tag {
    background: var(--accent-teal);
    color: var(--primary-purple);
    padding: 5px 15px;
    border-radius: var(--radius);
    font-weight: bold;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.insight-box h3 {
    font-size: 2rem;
    margin: 1.5rem 0 1rem;
    padding: 5px 5px;
}

.insight-box .text-link {
    color: var(--accent-teal);
    text-decoration: underline;
}

/* --- DETAIL PAGE STYLES --- */
.detail-header {
    background: linear-gradient(135deg, var(--primary-purple) 0%, #2a1b4e 100%);
    color: white;
    border-radius: var(--radius);
    padding: 3rem 20px;
    text-align: center;
    margin-top: 2rem;
    margin-bottom: 3rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.detail-header h1 {
    color: var(--accent-teal);
}

/* Container for the top navigation (Back button + Dropdown) */
.detail-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    width: 100%;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    height: var(--control-height);
    padding: 0 1.5rem;
    background-color: var(--white);
    color: var(--primary-purple);
    text-decoration: none;
    font-weight: 600;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-sizing: border-box;
}

.back-btn:hover {
    background-color: var(--primary-purple);
    color: var(--white);
    transform: translateY(-2px);
}

.nutrient-select {
    width: 65%;
    height: var(--control-height);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-dark);
    background-color: var(--white);
    border: 2px solid #e1e8ed;
    border-radius: var(--radius);
    cursor: pointer;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-left: 1.5rem;
    padding-right: 3rem;
    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%232d3436%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20class%3D%22feather%20feather-chevron-down%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 1.5rem center;
    background-size: 1.2rem;
}

.nutrient-select:hover {
    border-color: var(--primary-purple);
}

/* --- LIVE SEARCH DROPDOWN --- */
.search-input-container {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--white);
    border: 1px solid var(--border-dark);
    border-radius: 0 0 var(--radius) var(--radius);
    margin-top: 2px;
    box-shadow: var(--shadow-card);
    list-style: none;
    padding: 0;
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;

    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all 0.2s ease;
}

.search-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-dropdown li {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    color: var(--text-dark);
    font-size: 0.95rem;
    transition: background-color 0.2s ease;
}

.search-dropdown li:last-child {
    border-bottom: none;
}

.search-dropdown li:hover {
    background-color: var(--bg-muted);
    color: var(--primary-purple);
    font-weight: 500;
}

/* "No Results Found" specific styling */
.search-dropdown .no-results {
    color: var(--text-soft);
    cursor: default;
    font-style: italic;
}

.search-dropdown .no-results:hover {
    background-color: transparent;
    color: var(--text-soft);
    font-weight: normal;
}

/* --- AI Optimization: Quick Facts Box (Strictly Consistent Style) --- */
.quick-facts-box {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-card);
}

.quick-facts-box h2 {
    margin-top: 0;
    font-size: 1.3rem;
    color: var(--primary-purple);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

/* Responsive grid layout */
.quick-facts-box ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

/* Stacks the label on top of the text */
.quick-facts-box li {
    display: flex;
    flex-direction: column;
    color: var(--text-soft);
    line-height: 1.4;
    font-size: 0.95rem;
}

/* Uses your standard dark text variable for the labels */
.quick-facts-box li strong {
    color: var(--text-dark);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

/* --- DROPDOWN CONTAINER --- */
.quick-switcher {
    display: flex;
    justify-content: flex-end;
    /* Forces the select box inside to hug the right edge */
    flex: 1;
    max-width: 400px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    margin-bottom: 2rem;
}

.data-table th,
.data-table td {
    padding: 12px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-dark);
}

.data-table th {
    background-color: var(--accent-teal);
    color: var(--primary-purple);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.age-group-title {
    margin-top: 2rem;
    color: var(--primary-purple);
    border-bottom: 2px solid var(--accent-teal);
    display: inline-block;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

/* --- DETAIL PAGE UPDATES --- */

.header-content.center-content {
    justify-content: center;
}

.logo-link.no-margin {
    margin-bottom: 0;
}

/* --- DISCLAIMER POPUP STYLES --- */

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9998;
    display: block;
}

.disclaimer-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.disclaimer-popup p {
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    font-size: 1rem;
    line-height: 1.5;
}

.disclaimer-popup button {
    background-color: var(--accent-teal);
    color: var(--primary-purple);
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.3s;
}

.disclaimer-popup button:hover {
    background-color: #1eb0b2;
}

.disclaimer-hidden {
    display: none !important;
}

/* --- LEGAL & TEXT PAGE STYLING --- */
/* (Used for Terms, Privacy Policy, etc.) */

.legal-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 3rem 4rem 1.5rem;
    background: var(--white);
    border-radius: var(--radius);
}

.legal-content h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-purple);
    border-bottom: 2px solid var(--accent-teal);
    padding-bottom: 0.5rem;
    text-align: center;

}

.legal-content h2 {
    font-size: 1.4rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.5rem;
}

.legal-content h3 {
    font-size: 1.1rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: 700;
}

.legal-content p,
.legal-content ul {
    margin-bottom: 1rem;
    color: var(--text-soft);
    line-height: 1.7;
}

.legal-content ul {
    padding-left: 1.5rem;
}

.legal-content li {
    margin-bottom: 0.5rem;
}

.last-updated {
    display: block;
    color: var(--text-soft);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    margin-top: 0.5rem;
}

/* --- ABOUT US & CONTACT PAGE STYLES --- */

/* Standardizes the cards on the About Us page */
.about-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 800px;
    /* Keeps the text readable and centered */
    margin: 0 auto;
}

.section-box {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border-top: 4px solid var(--accent-teal);
}

.section-box h2,
.section-box h3 {
    color: var(--primary-purple);
    margin-top: 0;
}

.section-box:hover {
    transform: translateY(-2px);
}

/* Contact Section Specifics */
.contact-item {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
}

.contact-label {
    font-weight: 700;
    color: var(--text-dark);
}

.contact-link {
    color: var(--accent-teal);
    text-decoration: none;
    font-weight: 600;
}

.contact-link:hover {
    text-decoration: underline;
}

/* --- DARK MODE CONTRAST FIXES --- */
/* Forces text on teal backgrounds to use the dark brand purple for readability */
[data-theme="dark"] .button.primary,
[data-theme="dark"] .data-table th,
[data-theme="dark"] .insight-box .tag,
[data-theme="dark"] #accept-disclaimer {
    color: #45287d;
}

/* --- 404 Error Page Styles --- */
.error-page-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 65vh;
    padding: 2rem;
    background-color: var(--bg-light);
    text-align: center;
}

.error-content {
    background-color: var(--white);
    padding: 3rem 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

.error-content h1 {
    font-size: 6rem;
    color: var(--primary-purple);
    margin: 0;
    line-height: 1;
    font-weight: 800;
}

.error-content h2 {
    font-size: 1.8rem;
    color: var(--text-dark);
    margin: 1rem 0;
}

.error-content p {
    color: var(--text-soft);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.error-page-container .error-search-wrapper {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

.error-page-container .search-label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.error-page-container .search-input-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.error-page-container .search-input-container .search-input {
    width: 100%;
    max-width: 400px;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
}

.error-page-container .search-input-container .search-input:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 2px rgba(69, 40, 125, 0.2);
}

.error-page-container .search-input-container .btn-primary {
    padding: 0.8rem 1.5rem;
    background-color: var(--primary-purple);
    color: var(--white);
    text-decoration: none;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    transition: opacity 0.3s ease;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    cursor: pointer;
    font-size: 1rem;
}

.error-page-container .search-input-container .btn-primary:hover {
    opacity: 0.9;
}

/* =========================================
   Cookie Consent Banner
   ========================================= */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--white);
    border-top: 1px solid var(--border-dark);
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
    padding: 1rem 20px;
    z-index: 9999;
    box-sizing: border-box;
    /* Starts hidden below the screen */
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-banner.show {
    /* Slides up when the 'show' class is added */
    transform: translateY(0);
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.cookie-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-dark);
    line-height: 1.4;
}

.cookie-content a {
    color: var(--accent-teal);
    text-decoration: underline;
    font-weight: 600;
}

.cookie-buttons {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

.cookie-buttons button {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    flex: 1;
    max-width: 150px;
}

.btn-accept {
    background-color: var(--accent-teal);
    color: var(--white);
}

.btn-accept:hover {
    background-color: #1ba0a2;
    /* Slightly darker teal */
}

.btn-decline {
    background-color: var(--border-light);
    color: var(--text-soft);
}

.btn-decline:hover {
    background-color: var(--border-dark);
}

.cookie-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
    /* Hidden by default */
}

.cookie-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    width: 90%;
    max-width: 450px;
    z-index: 10001;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
    /* Hidden by default */
}

.cookie-modal h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.cookie-modal p {
    font-size: 0.9rem;
    color: var(--text-soft);
    margin-bottom: 1.5rem;
}

.cookie-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-light);
    padding: 1rem 0;
}

.cookie-option-text h4 {
    margin: 0 0 0.2rem 0;
    font-size: 1rem;
}

.cookie-option-text p {
    margin: 0;
    font-size: 0.8rem;
}

/* Toggle Switch Styling */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-dark);
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent-teal);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* =========================================
   ADVERTISEMENT PLACEMENTS (AC 1)
   ========================================= */

/* Base styling (Mobile-First: Behaves like a standard card) */
.in-feed-ad {
    background-color: var(--bg-muted);
    border-radius: var(--radius);
    box-shadow: inset 0 0 0 1px var(--border-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    /* Matches card padding */
    text-align: center;
    overflow: hidden;
    transition: all 0.3s ease;
    box-sizing: border-box;
    /* Perfectly match the vitamin-profile card dimensions */
    min-height: 200px;
    height: 100%;
}

#vitamin-profiles .in-feed-ad {
    display: none; /* Temporarily hidden - will be implemented soon */
    min-height: 180px;
}

.in-feed-ad .ad-placeholder-content {
    color: var(--text-soft);
    font-family: monospace;
}

.in-feed-ad .ad-placeholder-content small {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.7rem;
}

.in-feed-ad .ad-placeholder-content .ad-mockup {
    margin-top: 10px;
    padding: 30px 40px;
    background: #e1e4e8;
    border-radius: 8px;
    font-weight: 600;
}

.in-feed-ad ins.adsbygoogle {
    display: block;
    width: 100%;
    height: 200px;
}

#vitamin-profiles .in-feed-ad ins.adsbygoogle {
    height: 180px;
}

/* =========================================
   IN-ARTICLE AD PLACEMENTS (AC 2)
   ========================================= */

.in-article-ad {
    display: none; /* Temporarily hidden - will be implemented soon */
    margin: 40px auto;
    max-width: 100%;
    background-color: var(--bg-muted);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    border: 1px dashed var(--border-dark);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100px;
    box-sizing: border-box;
}

.in-article-ad ins.adsbygoogle {
    display: block;
    width: 100%;
    height: 100px;
}

.in-article-ad .ad-placeholder-content {
    color: var(--text-soft);
    font-family: monospace;
    box-sizing: border-box;
}

.in-article-ad .ad-mockup {
    margin-top: 10px;
    padding: 20px 40px;
    background: #e1e4e8;
    border-radius: 8px;
    font-weight: 600;
    color: #555;
}

/* =========================================
   HOME PAGE AD PLACEMENT (Between Sections)
   ========================================= */

.static-page-ad.home-ad {
    width: 100%;
    max-width: 1200px;
    /* Aligns with the wider Home Page grid */
    margin: 50px auto;
    /* Even 50px gap above and below the ad */
    padding: 20px;
    background-color: transparent;
    border: 1px dashed var(--border-dark);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100px;
    box-sizing: border-box;
}

.static-page-ad.home-ad ins.adsbygoogle {
    display: block;
    width: 100%;
    height: 100px;
}

/* --- SPUI --- */

@media (min-width: 769px) {
    .in-feed-ad {
        /* Removed grid-column: 1 / -1 to keep it card-sized */
        grid-column: auto;
        max-height: 220px;
        /* Prevents oversized ads from bloating the row */
    }
}

@media (max-width: 768px) {

    /* --- Mobile "Floating Card" - Disclaimer Popup (Centered) --- */
    #disclaimer-popup {
        /* 1. Force it to the exact center of the screen */
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;

        /* 2. Clear any lingering bottom/right positioning */
        bottom: auto !important;
        right: auto !important;

        /* 3. Give it breathing room on the sides (16px gap) */
        width: calc(100% - 32px) !important;
        margin: 0 !important;

        /* 4. Soft corners and shadow */
        border-radius: 20px !important;
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2) !important;
        box-sizing: border-box !important;
    }

    /* --- Mobile "Bottom Sheet" - Cookie Banner --- */
    #cookie-banner.show {
        /* 1. Kill the desktop centering/positioning rules */
        top: auto !important;
        transform: none !important;

        /* 2. Pin it flush to the edges (Bottom Sheet style) */
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 24px 20px !important;

        /* 3. Soft top corners, flat bottom corners */
        border-top-left-radius: 24px !important;
        border-top-right-radius: 24px !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;

        /* 4. Shadow to lift it off the background */
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15) !important;
        box-sizing: border-box !important;
    }

    /* THE FIX: Force the inner container to stack vertically */
    #cookie-banner.show .cookie-content {
        display: flex !important;
        flex-direction: column !important;
        /* This forces the text ABOVE the buttons */
        align-items: center !important;
        text-align: center !important;
        gap: 16px !important;
        width: 100% !important;
    }

    /* Target the text explicitly to guarantee center alignment */
    #cookie-banner.show p {
        text-align: center !important;
        margin: 0 !important;
        width: 100% !important;
    }

    /* Target the container holding your buttons */
    #cookie-banner.show .cookie-buttons,
    #cookie-banner.show .button-group {
        display: flex !important;
        flex-direction: row !important;
        /* Places the buttons side-by-side */
        justify-content: center !important;
        gap: 12px !important;
        width: 100% !important;
    }

    /* Make the buttons share the width equally and reduce height */
    #cookie-banner.show button {
        flex: 1 !important;
        /* Forces them to split the width exactly 50/50 */
        width: auto !important;
        justify-content: center !important;
        padding: 10px 8px !important;
        margin: 0 !important;
        font-size: 0.9rem !important;
        white-space: nowrap !important;
    }

    /* --- Your Existing Mobile Layout Styles --- */
    .header-content {
        flex-wrap: wrap;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .hero-section p {
        font-size: 1rem;
    }

    .brand-logo {
        height: 28px;
        width: auto;
    }

    .logo-text-link {
        font-size: 1.75rem;
    }

    .brand-wrapper {
        gap: 8px;
    }

    .mobile-toggle {
        display: block;
        font-size: 1.5rem;
        cursor: pointer;
    }

    nav {
        display: none;
        width: 100%;
        order: 3;
        margin-top: 1rem;
        align-items: center;
    }

    nav.open {
        display: block;
    }

    nav ul {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .search-bar {
        display: none;
    }

    #vitamin-profiles {
        grid-template-columns: 1fr;
    }

    .nutrient-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .featured-insight .container {
        padding: 0 1.1rem;
    }

    .insight-box {
        box-sizing: border-box;
        padding: 1.5rem !important;
        margin: 1rem 0;
        border-left-width: 4px;
        width: 100%;
    }

    .insight-box h3 {
        font-size: 1.2rem;
        line-height: 1.4;
        margin: 0.8rem 0;
    }

    .detail-nav {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        padding: 0 0.75rem;
        box-sizing: border-box;
    }


    .quick-switcher {
        flex: 1;
        display: flex;
        justify-content: flex-end;
    }

    .back-btn {
        display: inline-flex;
        align-items: center;
        background: var(--white);
        border: 1px solid var(--border-dark);
        border-radius: var(--radius);
        padding: 8px 12px;
        font-size: 0.85rem;
        flex-shrink: 0;
        color: var(--text-dark);
        text-decoration: none;
        white-space: nowrap;
        box-sizing: border-box;
    }

    .nutrient-select {
        width: 100%;
        max-width: 100%;
        font-size: 0.85rem;
        padding-right: 25px;
        text-overflow: ellipsis;
    }

    .legal-content {
        padding: 1.0rem 1rem 1.0rem 1rem;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        border-radius: 0;
    }

    .legal-content h1 {
        font-size: 1.8rem;
    }

    .legal-content h2 {
        font-size: 1.3rem;
        margin-top: 2rem;
    }

    /* Removed the conflicting .cookie-content flex-direction: row from down here! */
    .cookie-buttons {
        width: 100%;
    }

    .contact-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .contact-label {
        font-size: 0.9rem;
        color: var(--text-soft);
    }

    /* =========================================
   --- COOKIE SETTINGS MODAL STYLING --- 
   ========================================= */

    /* 1. Space out the text and the toggles */
    /* (Assuming your rows have a class like .cookie-option, .setting-row, or similar. 
   If it's just a div, this generic selector will catch the direct children rows) */
    #cookie-modal>div>div,
    #cookie-modal .cookie-option {
        display: flex;
        justify-content: space-between;
        align-items: center;
        /* Centers the toggle vertically with the text */
        gap: 30px;
        /* Creates a guaranteed 30px moat between text and toggle */
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 1px solid var(--border-light);
    }

    /* Remove the border from the last option so it doesn't double up above the button */
    #cookie-modal .cookie-option:last-of-type,
    #cookie-modal>div>div:nth-last-child(2) {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }

    /* 2. Force the text block to wrap nicely and not push into the toggle */
    #cookie-modal .cookie-option>div:first-child,
    #cookie-modal>div>div>div:first-child {
        flex: 1;
        /* Tells the text to take up the remaining space, but yield to the toggle */
        text-align: left;
        padding-right: 15px;
        /* An extra layer of padding just to be safe */
    }

    /* 3. Give the Save Preferences Button a premium, brand-aligned look */
    #save-cookie-prefs {
        width: 100%;
        background-color: var(--primary-purple);
        /* Uses your brand purple */
        color: var(--white);
        padding: 14px 20px;
        margin-top: 24px;
        font-size: 1rem;
        font-weight: 600;
        border: none;
        border-radius: var(--radius);
        /* Uses your global 12px rounded corners */
        cursor: pointer;
        box-shadow: 0 4px 15px rgba(69, 40, 125, 0.25);
        /* Soft glowing shadow */
        transition: all 0.2s ease;
    }

    /* 4. Add hover and active (click) states for the button */
    #save-cookie-prefs:hover {
        background-color: #361f62;
        /* Slightly darker purple on hover */
        transform: translateY(-2px);
        /* Lifts up slightly */
    }

    #save-cookie-prefs:active {
        transform: translateY(0);
        /* Snaps back down when clicked */
        box-shadow: 0 2px 8px rgba(69, 40, 125, 0.2);
    }

    .in-feed-ad {
        margin: 10px 0;
        border-radius: var(--radius);
    }

    .in-feed-ad ins.adsbygoogle {
        height: 170px;
        width: 100%;
    }

    .in-article-ad {
        /* 1. Remove the negative margins (-20px) to stop it from hitting the screen edges */
        margin: 30px 0;

        /* 2. Restore the rounded corners and borders so it looks like a proper card */
        border-radius: var(--radius);
        border: 1px dashed var(--border-dark);

        /* 3. Ensure internal padding is sufficient for smaller screens */
        padding: 15px;
    }

    .static-page-ad.home-ad {
        /* 1. Add 20px margin to the left and right to pull it away from the screen edges */
        margin: 30px 20px;

        /* 2. Restore the side borders and rounded corners so it looks like a contained card */
        border-left: 1px dashed var(--border-dark);
        border-right: 1px dashed var(--border-dark);
        border-radius: var(--radius);

        /* 3. Keep the internal padding so the ad doesn't touch its own border */
        padding: 15px;

        /* 4. Ensure it calculates width correctly with the new margins */
        width: calc(100% - 40px);
    }
}