/* ============================================ */
/* 1. CSS Reset & Base Setup */
/* ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Smooth color transitions for all elements */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Disable transitions during theme switch */
.no-transitions * {
    transition: none !important;
    animation-duration: 0s !important;
}

/* ============================================ */
/* 2. CSS Custom Properties (Variables) */
/* ============================================ */
:root {
    /* Default Light Mode Colors */
    --bg-primary: #FAFAFA;
    --bg-secondary: #FFFFFF;
    --bg-elevated: #FFFFFF;
    --text-primary: #1A1A1A;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --text-muted: #999999;
    --border-light: #E5E5E5;
    --border-medium: #E5E5E5;
    --accent-primary: #B8860B;
    --accent-wine: #B8860B;
    --accent-secondary: #8B7355;
    --shadow-sm: rgba(0, 0, 0, 0.04);
    --shadow-md: rgba(0, 0, 0, 0.08);
    --shadow-lg: rgba(0, 0, 0, 0.12);

    --bg: var(--bg-primary);
    --text: var(--text-primary);
    --card-bg: var(--bg-secondary);
    --card-border: var(--border-light);
    --muted: var(--text-muted);
    
    /* Border Radius Scale */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* Spacing Scale (follows 8px grid) */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 5rem;
    
    /* Typography Scale */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;
    --text-6xl: 4rem;
}

/* Dark Mode Color Overrides */
[data-theme="dark"] {
    --bg-primary: #0A0A0A;
    --bg-secondary: #141414;
    --bg-elevated: #1A1A1A;
    --text-primary: #FAFAFA;
    --text-secondary: #A8A8A8;
    --text-tertiary: #707070;
    --text-muted: #606060;
    --border-light: #2A2A2A;
    --border-medium: #333333;
    --accent-primary: #D4AF37;
    --accent-wine: #D4AF37;
    --accent-secondary: #A0906B;
    --shadow-sm: rgba(0, 0, 0, 0.2);
    --shadow-md: rgba(0, 0, 0, 0.4);
    --shadow-lg: rgba(0, 0, 0, 0.6);
    
    /* Variables from styles.css - merged */
    --bg: var(--bg-primary);
    --text: var(--text-primary);
    --card-bg: var(--bg-elevated);
    --card-border: var(--border-medium);
    --muted: var(--text-muted);
}

/* Auto Dark Mode Detection */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #0A0A0A;
        --bg-secondary: #141414;
        --bg-elevated: #1A1A1A;
        --text-primary: #E5E5E5;
        --text-secondary: #A0A0A0;
        --text-tertiary: #707070;
        --text-muted: #707070;
        --border-light: #2A2A2A;
        --border-medium: #2A2A2A;
        --accent-wine: #D4AF37;
        --shadow-sm: rgba(0, 0, 0, 0.2);
        --shadow-md: rgba(0, 0, 0, 0.4);
        --shadow-lg: rgba(0, 0, 0, 0.6);
        
        /* Variables from styles.css - merged */
        --bg: var(--bg-primary);
        --text: var(--text-primary);
        --card-bg: var(--bg-elevated);
        --card-border: var(--border-medium);
        --muted: var(--text-muted);
    }
}

/* ============================================ */
/* 3. Base Document Styles */
/* ============================================ */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Segoe UI', Arial, sans-serif;
    background-color: var(--bg); /* Using the merged variable */
    color: var(--text); /* Using the merged variable */
    line-height: 1.7;
    min-height: 100vh;
    transition: background-color 0.4s ease, color 0.4s ease;
    font-size: 16px;
    font-weight: 400;
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Text selection styling */
::selection {
    background: var(--accent-primary);
    color: white;
}

*:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ============================================ */
/* 4. Layout Components */
/* ============================================ */
.container {
    max-width: 1200px; /* Changed from styles.css to match global.css */
    margin: 0 auto;
    padding: var(--space-4xl) var(--space-xl);
}

/* ============================================ */
/* 5. Shared Header & Nav Styles */
/* ============================================ */
.header {
    text-align: center;
    padding: 0 0 var(--space-3xl) 0;
    margin-bottom: var(--space-2xl);
    border-bottom: 1px solid var(--border-light);
}

.header-content h1 {
    font-size: clamp(var(--text-4xl), 6vw, var(--text-6xl));
    font-weight: 200;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-primary);
    line-height: 1.1;
}

.header-subtitle {
    color: var(--text-secondary);
    font-size: var(--text-base);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 500;
    line-height: 1.4;
}

/* Menu Toggle Button */
.menu-toggle {
    position: fixed;
    top: var(--space-xl);
    left: var(--space-xl);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 12px var(--shadow-md);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1001;
}

.menu-toggle:hover {
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--shadow-lg);
}

/* Hamburger Icon */
.menu-icon {
    width: 22px;
    height: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.menu-line {
    display: block;
    height: 1.5px;
    width: 100%;
    background: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* Animated X when menu is open */
.menu-open .menu-toggle .menu-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-open .menu-toggle .menu-line:nth-child(2) {
    opacity: 0;
}

.menu-open .menu-toggle .menu-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Navigation Menu Overlay */
.nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    overflow-y: auto;
}

.nav-menu.active {
    opacity: 1;
    visibility: visible;
}

/* Navigation Menu Content */
.nav-menu-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-4xl) var(--space-xl);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.nav-menu-header {
    padding: var(--space-2xl) 0;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: var(--space-3xl);
}

.nav-menu-label {
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

/* Navigation Menu Items */
.nav-menu-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.nav-menu-item {
    display: flex;
    align-items: center;
    padding: var(--space-xl) 0;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateX(-30px);
}

/* Stagger animation for menu items */
.nav-menu.active .nav-menu-item {
    opacity: 1;
    transform: translateX(0);
}

.nav-menu.active .nav-menu-item:nth-child(1) { transition-delay: 0.1s; }
.nav-menu.active .nav-menu-item:nth-child(2) { transition-delay: 0.15s; }
.nav-menu.active .nav-menu-item:nth-child(3) { transition-delay: 0.2s; }
.nav-menu.active .nav-menu-item:nth-child(4) { transition-delay: 0.25s; }
.nav-menu.active .nav-menu-item:nth-child(5) { transition-delay: 0.3s; }
.nav-menu.active .nav-menu-item:nth-child(6) { transition-delay: 0.35s; }

/* Hover line effect */
.nav-menu-item::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--accent-primary), transparent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.nav-menu-item:hover::before,
.nav-menu-item.active::before {
    transform: scaleX(1);
}

.nav-menu-item:hover {
    padding-left: var(--space-md);
}

.nav-menu-number {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-tertiary);
    margin-right: var(--space-2xl);
    letter-spacing: 0.05em;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

.nav-menu-text {
    flex: 1;
    font-size: clamp(var(--text-2xl), 4vw, var(--text-3xl));
    font-weight: 200;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.nav-menu-item:hover .nav-menu-text {
    color: var(--accent-primary);
    letter-spacing: 0.08em;
}

.nav-menu-item.active .nav-menu-text {
    color: var(--accent-primary);
}

.nav-menu-arrow {
    font-size: var(--text-2xl);
    color: var(--accent-primary);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.nav-menu-item:hover .nav-menu-arrow,
.nav-menu-item.active .nav-menu-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Navigation Footer */
.nav-menu-footer {
    padding-top: var(--space-3xl);
    border-top: 1px solid var(--border-light);
    margin-top: auto;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    transition-delay: 0.4s;
}

.nav-menu.active .nav-menu-footer {
    opacity: 1;
    transform: translateY(0);
}

.nav-menu-footer p {
    color: var(--text-muted);
    font-size: var(--text-sm);
    letter-spacing: 0.05em;
}

/* Blur background when menu is open */
.menu-open .container > *:not(.nav-menu):not(.menu-toggle) {
    filter: blur(5px);
    transition: filter 0.5s ease;
}

/* Prevent scroll when menu is open */
.menu-open {
    overflow: hidden;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .menu-toggle {
        width: 44px;
        height: 44px;
        top: var(--space-md);
        left: var(--space-md);
    }
    
    .nav-menu-content {
        padding: var(--space-3xl) var(--space-lg);
    }
    
    .nav-menu-text {
        font-size: var(--text-xl);
    }
    
    .nav-menu-number {
        margin-right: var(--space-lg);
    }
    
    .nav-menu-item {
        padding: var(--space-lg) 0;
    }
}

/* Keyboard focus styles */
.nav-menu-item:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 4px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .nav-menu,
    .nav-menu-item,
    .nav-menu-footer {
        transition: none !important;
    }
}

/* Theme toggle button */
.theme-toggle {
    position: fixed;
    top: var(--space-xl);
    right: var(--space-xl);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 12px var(--shadow-md);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
}

.theme-toggle:hover {
    border-color: var(--accent-primary);
    transform: translateY(-1px) rotate(180deg);
    box-shadow: 0 6px 16px var(--shadow-lg);
}

.theme-icon {
    width: 22px;
    height: 22px;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

[data-theme="light"] .theme-icon {
    color: var(--text-primary);
}

[data-theme="dark"] .theme-icon {
    color: var(--text-primary);
}

/* ============================================ */
/* 6. Typography Utilities */
/* ============================================ */
.text-muted {
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.text-center {
    text-align: center;
}

/* ============================================ */
/* 7. Search & Results Layout */
/* ============================================ */
.filter-bar {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
}

.search-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
.search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.search-input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}
.search-input::placeholder {
    color: var(--muted);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.guides-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
    margin-top: 2rem;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted);
    padding: 2rem;
}

/* ============================================ */
/* 8. Cards & Content */
/* ============================================ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1.2rem;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.card p {
    color: var(--muted);
    margin-top: 0.4rem;
}

.dish {
    color: var(--accent-primary);
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}
.gout-risk {
    display: inline-block;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.risk-low {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.risk-medium {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.risk-high {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.risk-very-low {
    background-color: #d1f2eb;
    color: #0c5d56;
    border: 1px solid #7dcea0;
}

.risk-low-medium {
    background-color: #fef9e7;
    color: #7d6608;
    border: 1px solid #f7dc6f;
}

.risk-medium-high {
    background-color: #fdeaa7;
    color: #b7950b;
    border: 1px solid #f4d03f;
}

.risk-very-high {
    background-color: #fadbd8;
    color: #a93226;
    border: 1px solid #f1948a;
}

[data-theme="dark"] .risk-low {
    background-color: #1e4620;
    color: #a3cfad;
    border: 1px solid #2d5a30;
}

[data-theme="dark"] .risk-medium {
    background-color: #4a3c1a;
    color: #e6d39a;
    border: 1px solid #5d4a20;
}

[data-theme="dark"] .risk-high {
    background-color: #4a1e23;
    color: #e6a3aa;
    border: 1px solid #5d2a30;
}
[data-theme="dark"] .risk-very-low {
    background-color: #0e4b42;
    color: #a3d5ca;
    border: 1px solid #16a085;
}

[data-theme="dark"] .risk-low-medium {
    background-color: #4d4417;
    color: #f4e4a6;
    border: 1px solid #d4ac0d;
}

[data-theme="dark"] .risk-medium-high {
    background-color: #7d6608;
    color: #f8f1c4;
    border: 1px solid #f1c40f;
}

[data-theme="dark"] .risk-very-high {
    background-color: #6b2c28;
    color: #f5b7b1;
    border: 1px solid #e74c3c;
}

.purine-content {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: var(--space-sm);
}

.alternatives {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-light);
}

.alternatives-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: var(--space-xs);
}

.alternatives-list {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.food-item {
    display: block;
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}
/* ============================================ */
/* 9. Footer */
/* ============================================ */
.footer {
    text-align: center;
    margin-top: 3rem;
    color: var(--muted);
}

/* ============================================ */
/* 10. Responsive Overrides */
/* ============================================ */
@media (min-width: 600px) {
    .guides-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 900px) {
    .guides-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: var(--space-3xl) var(--space-lg);
    }
    
    .header-actions {
        display: none;
    }
    
    .theme-toggle {
        width: 44px;
        height: 44px;
        top: var(--space-md);
        right: var(--space-md);
    }

    .nav-link {
        top: var(--space-md);
        left: var(--space-md);
    }
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 12px var(--shadow-md);
    -webkit-backdrop-filter: blur(10px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--shadow-lg);
}

.back-to-top-icon {
    color: var(--text-primary);
    transition: color 0.3s ease, transform 0.3s ease;
}

.back-to-top:hover .back-to-top-icon {
    color: var(--accent-primary);
    transform: translateY(-1px);
}

/* Mobile positioning adjustments */
@media (max-width: 768px) {
    .back-to-top {
        width: 44px;
        height: 44px;
        bottom: var(--space-md);
        right: var(--space-md);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .back-to-top {
        transition: opacity 0.3s ease;
    }
}
/* Risk Level Filters */
.risk-filters {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    flex-wrap: wrap;
}

/* Risk Level Filters with color coding */
.risk-filter-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-lg);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Low Risk - Green */
.risk-filter-btn[data-risk="low"]:hover {
    border-color: #16a085;
    color: #0c5d56;
    background: #d1f2eb;
    transform: translateY(-1px);
}

.risk-filter-btn[data-risk="low"].active {
    background: #16a085;
    border-color: #16a085;
    color: white;
    box-shadow: 0 2px 8px rgba(22, 160, 133, 0.3);
}

/* Medium Risk - Yellow/Orange */
.risk-filter-btn[data-risk="medium"]:hover {
    border-color: #f39c12;
    color: #b7950b;
    background: #fef9e7;
    transform: translateY(-1px);
}

.risk-filter-btn[data-risk="medium"].active {
    background: #f39c12;
    border-color: #f39c12;
    color: white;
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
}

/* High Risk - Red */
.risk-filter-btn[data-risk="high"]:hover {
    border-color: #e74c3c;
    color: #a93226;
    background: #fadbd8;
    transform: translateY(-1px);
}

.risk-filter-btn[data-risk="high"].active {
    background: #e74c3c;
    border-color: #e74c3c;
    color: white;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

/* All Risk Levels - Default accent color */
.risk-filter-btn[data-risk="all"]:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.risk-filter-btn[data-risk="all"].active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: 0 2px 8px var(--shadow-md);
}

/* Dark mode adjustments */
[data-theme="dark"] .risk-filter-btn[data-risk="low"]:hover {
    border-color: #1abc9c;
    color: #a3d5ca;
    background: #0e4b42;
}

[data-theme="dark"] .risk-filter-btn[data-risk="low"].active {
    background: #1abc9c;
    border-color: #1abc9c;
}

[data-theme="dark"] .risk-filter-btn[data-risk="medium"]:hover {
    border-color: #f1c40f;
    color: #f4e4a6;
    background: #4d4417;
}

[data-theme="dark"] .risk-filter-btn[data-risk="medium"].active {
    background: #f1c40f;
    border-color: #f1c40f;
}

[data-theme="dark"] .risk-filter-btn[data-risk="high"]:hover {
    border-color: #e74c3c;
    color: #f5b7b1;
    background: #6b2c28;
}

[data-theme="dark"] .risk-filter-btn[data-risk="high"].active {
    background: #e74c3c;
    border-color: #e74c3c;
}

/* Risk Level Filters - Compact Mobile Design */
@media (max-width: 768px) {
    .risk-filters {
        margin-top: var(--space-md);
        gap: var(--space-xs);
        justify-content: center;
    }
    
    .risk-filter-btn {
        padding: var(--space-xs) var(--space-sm);
        font-size: var(--text-xs);
        min-height: 32px; /* Smaller than the 44px I suggested earlier */
        border-radius: var(--radius-sm);
        font-weight: 600;
    }
}

/* Very small screens - even more compact */
@media (max-width: 480px) {
    .risk-filters {
        gap: 8px;
    }
    
    .risk-filter-btn {
        padding: 8px 16px;
        font-size: 11px;
        min-height: 28px;
        letter-spacing: 0.03em;
    }
    
    /* Use shorter labels */
    .risk-filter-btn[data-risk="all"] { 
        font-size: 0; 
    }
    .risk-filter-btn[data-risk="all"]::after { 
        content: "All"; 
        font-size: 11px; 
    }
    
    .risk-filter-btn[data-risk="low"] { 
        font-size: 0; 
    }
    .risk-filter-btn[data-risk="low"]::after { 
        content: "Low"; 
        font-size: 11px; 
    }
    
    .risk-filter-btn[data-risk="medium"] { 
        font-size: 0; 
    }
    .risk-filter-btn[data-risk="medium"]::after { 
        content: "Med"; 
        font-size: 11px; 
    }
    
    .risk-filter-btn[data-risk="high"] { 
        font-size: 0; 
    }
    .risk-filter-btn[data-risk="high"]::after { 
        content: "High"; 
        font-size: 11px; 
    }
}
/* Reference Guide - Always Visible */
.reference-guide {
    margin-bottom: var(--space-2xl);
    margin-top: var(--space-2xl);
    padding: var(--space-xl) 0;
    border-top: 1px solid var(--border-light);
}

.guide-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.guide-title {
    font-size: var(--text-xl);
    font-weight: 300;
    color: var(--text-primary);
    margin: 0 0 var(--space-xs) 0;
    letter-spacing: 0.02em;
}

.guide-subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
}

.guide-content {
    display: grid;
    gap: var(--space-xl);
    max-width: 900px;
    margin: 0 auto;
}

/* Key Metrics - Prominent Numbers */
.key-metrics {
    display: flex;
    gap: var(--space-lg);
    justify-content: center;
    margin-bottom: var(--space-lg);
}

.metric {
    text-align: center;
    padding: var(--space-lg) var(--space-xl);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    min-width: 140px;
}

.metric-value {
    font-size: var(--text-2xl);
    font-weight: 200;
    color: var(--accent-primary);
    line-height: 1.2;
    margin-bottom: var(--space-xs);
    letter-spacing: -0.02em;
}

.metric-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Purine Scale - Visual Hierarchy */
.purine-scale {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
}

.scale-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-lg) 0;
    text-align: center;
}

.scale-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

.scale-item {
    text-align: center;
    padding: var(--space-md);
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.scale-range {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    display: inline-block;
}

.scale-range.low {
    background-color: #d1f2eb;
    color: #0c5d56;
    border: 1px solid #7dcea0;
}

.scale-range.medium {
    background-color: #fef9e7;
    color: #7d6608;
    border: 1px solid #f7dc6f;
}

.scale-range.high {
    background-color: #fadbd8;
    color: #a93226;
    border: 1px solid #f1948a;
}

[data-theme="dark"] .scale-range.low {
    background-color: #0e4b42;
    color: #a3d5ca;
    border: 1px solid #16a085;
}

[data-theme="dark"] .scale-range.medium {
    background-color: #4d4417;
    color: #f4e4a6;
    border: 1px solid #d4ac0d;
}

[data-theme="dark"] .scale-range.high {
    background-color: #6b2c28;
    color: #f5b7b1;
    border: 1px solid #e74c3c;
}

.scale-desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.4;
    margin-top:0.2rem;
}

/* Tips Section - Contextual Info */
.guide-tips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

.tip-item {
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--text-secondary);
    padding: var(--space-md);
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent-primary);
}

.tip-item strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Medical Notice */
.medical-notice {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-top: var(--space-lg);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    text-align: center;
    font-style: italic;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .guide-content {
        gap: var(--space-lg);
    }
    
    .key-metrics {
        flex-direction: column;
        align-items: center;
    }
    
    .metric {
        min-width: 200px;
    }
    
    .scale-items {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
    
    .guide-tips {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .purine-scale {
        padding: var(--space-lg);
    }
}

@media (max-width: 480px) {
    .reference-guide {
        padding: var(--space-lg) 0;
    }
    
    .metric {
        min-width: 160px;
        padding: var(--space-md) var(--space-lg);
    }
    
    .metric-value {
        font-size: var(--text-xl);
    }
}
/* Portion Size Guide */
.portion-guide {
    margin-bottom: var(--space-2xl);
    padding: var(--space-xl) 0;
}

.portion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-xl);
}

.portion-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.portion-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    transition: all 0.3s ease;
}

.portion-card.high-purine::before {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.portion-card.medium-purine::before {
    background: linear-gradient(90deg, #f39c12, #e67e22);
}

.portion-card.low-purine::before {
    background: linear-gradient(90deg, #16a085, #1abc9c);
}

.portion-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow-lg);
}

.portion-card h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin: 0 0 var(--space-lg) 0;
    color: var(--text-primary);
}

.portion-visual {
    margin-bottom: var(--space-lg);
    padding: var(--space-lg);
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.portion-size {
    font-size: var(--text-2xl);
    font-weight: 200;
    color: var(--accent-primary);
    margin-bottom: var(--space-xs);
}

.portion-desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-style: italic;
}

.portion-frequency {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    padding: var(--space-sm);
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
}

.portion-examples {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Emergency Guide - Fixed */
.emergency-guide {
    margin-bottom: var(--space-2xl);
    padding: var(--space-xl);
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    /* Remove the padding from section header inside this */
}

.emergency-guide .section-header {
    margin-bottom: var(--space-lg); /* Reduced from xl */
}

.emergency-content {
    margin-top: var(--space-lg); /* Reduced from xl */
}

/* Fix mobile spacing */
@media (max-width: 768px) {
    .emergency-guide {
        padding: var(--space-lg);
        margin-bottom: var(--space-xl);
        border-radius: var(--radius-lg);
    }
}

.action-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
}

.action-card.urgent {
    border-left: 4px solid #e74c3c;
}

.action-card.safe-foods {
    border-left: 4px solid #16a085;
}

.action-card h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-lg) 0;
}

.action-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.action-list li {
    padding: var(--space-sm) 0;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.5;
    border-bottom: 1px solid var(--border-light);
}

.action-list li:last-child {
    border-bottom: none;
}

.action-list li::before {
    content: '•';
    color: var(--accent-primary);
    font-weight: bold;
    margin-right: var(--space-sm);
}

.safe-food-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.safe-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* Medical Guidance */
.medical-guidance {
    margin-bottom: var(--space-2xl);
    padding: var(--space-xl) 0;
}

.warning-signs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-xl);
}

.warning-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all 0.3s ease;
}

.warning-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-md);
}

.warning-icon {
    font-size: var(--text-xl);
    line-height: 1;
    flex-shrink: 0;
}

.warning-content h4 {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-xs) 0;
}

.warning-content p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .portion-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .emergency-actions {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    
    .warning-signs {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .portion-guide,
    .medical-guidance {
        padding: var(--space-lg) 0;
        margin-bottom: var(--space-xl);
    }
    
    .portion-card,
    .action-card,
    .warning-item {
        padding: var(--space-lg);
    }
}

@media (max-width: 480px) {
    .safe-food-list {
        flex-direction: column;
    }
    
    .warning-item {
        flex-direction: column;
        text-align: center;
        gap: var(--space-sm);
    }
    
    .warning-icon {
        font-size: var(--text-2xl);
    }
}