:root {
    --primary: #ef4444;
    --secondary: #111827;
    --background: #fafafa;
    --card-bg: #ffffff;
    --text-main: #111827;
    --text-muted: #9ca3af;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.4);
    /* Macro Circle Colors (Soft versions) */
    --clr-circle-protein: #f87171;
    --clr-circle-carbs: #fdba74;
    --clr-circle-fat: #7dd3fc;
}

body.dark {
    --secondary: #f9fafb;
    --background: #0a0a0a;
    --card-bg: #171717;
    --text-main: #f9fafb;
    --text-muted: #737373;
    --glass-bg: rgba(23, 23, 23, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.06);
}

.item-card {
    background-color: var(--card-bg);
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    transform: translateY(25px);
    border-color: var(--glass-border);
}
.item-card.visible {
    opacity: 1;
    transform: translateY(0);
}
.item-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 35px -8px rgba(0, 0, 0, 0.15);
}

.category-tab, .sort-btn, .size-tab-btn {
    position: relative;
    transition: color 0.4s ease;
    white-space: nowrap;
    text-transform: uppercase;
    font-weight: 800;
    z-index: 10;
}

.category-tab {
    letter-spacing: 0.12em;
    font-size: 0.65rem;
    padding: 0.6rem 0.75rem;
}

.active-tab, .active-sort, .active-size { color: white !important; }

#nav-indicator, #sort-indicator, #size-indicator {
    position: absolute;
    background-color: var(--primary);
    border-radius: 9999px;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1;
    pointer-events: none;
}

#nav-indicator { height: 34px; top: 0; }
#sort-indicator { height: calc(100% - 2px); top: 1px; }
#size-indicator { height: calc(100% - 8px); top: 4px; }
#view-indicator {
    position: absolute;
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 1;
    pointer-events: none;
    height: calc(100% - 8px);
    top: 4px;
}

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Scroll-fade masks for horizontal scrollable areas */
.scroll-mask-container {
    position: relative;
}
.scroll-mask-container::before,
.scroll-mask-container::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 32px;
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.scroll-mask-container::before {
    left: 0;
    background: linear-gradient(to right, var(--glass-bg), transparent);
    border-radius: 2rem 0 0 2rem;
}
.scroll-mask-container::after {
    right: 0;
    background: linear-gradient(to left, var(--glass-bg), transparent);
    border-radius: 0 2rem 2rem 0;
}
.scroll-mask-container.fade-left::before { opacity: 1; }
.scroll-mask-container.fade-right::after { opacity: 1; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.item-card:focus-visible, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

@keyframes nudge-swipe {
    0% { transform: translateX(0); }
    30% { transform: translateX(60px); }
    100% { transform: translateX(0); }
}
.nudge-active {
    animation: nudge-swipe 1.2s cubic-bezier(0.45, 0, 0.55, 1);
}

/* Logo Shimmer Animation */
.logo-animated {
    width: 240px;
    height: 52px;
    background: linear-gradient(90deg, #ef4444 0%, #facc15 25%, #4ade80 50%, #38bdf8 75%, #ef4444 100%);
    background-size: 300% 100%;
    -webkit-mask: url("https://images.prismic.io/worldclass/aVxQ23NYClf9ozTn_WorldClass%2B_Logo_black.png?auto=format,compress") no-repeat center;
    mask: url("https://images.prismic.io/worldclass/aVxQ23NYClf9ozTn_WorldClass%2B_Logo_black.png?auto=format,compress") no-repeat center;
    -webkit-mask-size: contain;
    mask-size: contain;
    animation: shimmerLogo 6s linear infinite;
}

body.dark .logo-animated {
    background: linear-gradient(90deg, #ef4444 0%, #ffffff 25%, #4ade80 50%, #38bdf8 75%, #ef4444 100%);
    background-size: 300% 100%;
}

@keyframes shimmerLogo {
    0% { background-position: 0% 0%; }
    100% { background-position: 300% 0%; }
}

/* Background Energy Blobs Styles */
.blob-container {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    mix-blend-mode: multiply;
    transition: background-color 0.8s ease;
}

body.dark .blob {
    opacity: 0.1;
    mix-blend-mode: screen;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background-color: #ef4444;
    top: -100px;
    left: -100px;
    animation: blob-float-1 25s infinite alternate ease-in-out;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background-color: #38bdf8;
    bottom: -50px;
    right: -100px;
    animation: blob-float-2 30s infinite alternate ease-in-out;
}

.blob-3 {
    width: 350px;
    height: 350px;
    background-color: #facc15;
    top: 40%;
    left: 60%;
    animation: blob-float-3 20s infinite alternate ease-in-out;
}

@keyframes blob-float-1 {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(150px, 100px) scale(1.1); }
    66% { transform: translate(-80px, 200px) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

@keyframes blob-float-2 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-100px, -150px) scale(1.2); }
    100% { transform: translate(50px, -50px) scale(1); }
}

@keyframes blob-float-3 {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-150px, 50px) rotate(180deg); }
}

.macro-circle { transform-origin: center; }

/* Mobile bottom-sheet modal */
@media (max-width: 640px) {
    #item-modal {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    #modal-content {
        border-radius: 2.5rem 2.5rem 0 0 !important;
        max-height: 92vh;
        overflow-y: auto;
        transform: translateY(100%) !important;
    }
    #modal-content.modal-visible {
        transform: translateY(0) !important;
    }
    #modal-content .sheet-handle {
        display: block !important;
    }
}
@media (min-width: 641px) {
    #modal-content.modal-visible {
        opacity: 1 !important;
        transform: scale(1) !important;
    }
}
.sheet-handle {
    display: none !important;
    width: 36px;
    height: 4px;
    background: var(--text-muted);
    opacity: 0.3;
    border-radius: 2px;
    margin: 12px auto 0;
}

/* Card exit animation */
.item-card.exiting {
    opacity: 0 !important;
    transform: translateY(-15px) scale(0.97) !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 1, 1) !important;
}

/* Macro mini-bars on cards */
.macro-mini-bar {
    height: 3px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-top: 4px;
}
body.dark .macro-mini-bar {
    background: rgba(255, 255, 255, 0.1);
}
.macro-mini-fill {
    height: 100%;
    border-radius: 2px;
    min-width: 2px;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.75rem;
    width: 220px;
    background: var(--card-bg);
    border-radius: 2rem;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    z-index: 100;
    transform-origin: top right;
    animation: dropdownScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes dropdownScale {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.dropdown-menu.active { display: block; }

.card-macro-grid {
    border-top: 1px solid var(--glass-border);
    padding-top: 1rem;
    margin-top: 1rem;
}

/* Sticky filter wrapper — transparent layout container */
.sticky-filter-bar {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
}
/* Shadow on category glass pill when stuck */
.sticky-filter-bar.stuck #category-container .glass {
    box-shadow: 0 8px 32px -8px rgba(0, 0, 0, 0.12);
}
/* Gap between category bar and sort row */
.sticky-filter-bar #category-container {
    margin-bottom: 0.25rem;
}
/* Sort row — flat, understated, no glass */
.sticky-filter-bar #sort-bar {
    padding: 0.4rem 0.75rem 0.25rem;
}
.sticky-filter-bar .sort-pill {
    background: transparent;
    border: none;
    padding: 0.2rem 0;
}
/* Themes mode: sort bar alone gets subtle glass when stuck */
.sticky-filter-bar.stuck.sort-only #sort-bar {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 1.5rem;
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    box-shadow: 0 4px 20px -6px rgba(0, 0, 0, 0.08);
}

#loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--background);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.sort-arrow-svg {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: 4px;
    transition: transform 0.3s ease;
    vertical-align: middle;
}
.sort-arrow-svg.desc {
    transform: rotate(180deg);
}

/* --- Admin Styles --- */
.admin-only { display: none !important; }
body.is-admin .admin-only { display: flex !important; }
body.is-admin .admin-block { display: block !important; }

.admin-input {
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s;
    width: 100%;
    background: var(--card-bg);
    color: var(--text-main);
}
/* Input wrapper with icon prefix */
.admin-input-wrap {
    position: relative;
}
.admin-input-wrap .admin-input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.2s;
}
.admin-input-wrap .admin-input {
    padding-left: 2.25rem;
}
.admin-input-wrap:focus-within .admin-input-icon {
    opacity: 0.8;
    color: #ef4444;
}
/* Field group card */
.admin-field-group {
    background: rgba(0, 0, 0, 0.015);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 1rem;
    padding: 1rem;
}
body.dark .admin-field-group {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.04);
}
.admin-input:hover {
    border-color: rgba(156, 163, 175, 0.6);
}
body.dark .admin-input:hover {
    border-color: rgba(115, 115, 115, 0.6);
}
.admin-input:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1), 0 2px 8px rgba(239, 68, 68, 0.06);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
textarea.admin-input {
    resize: vertical;
    min-height: 70px;
}
select.admin-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 2rem;
}
.admin-input.input-error {
    border-color: #ef4444;
    animation: shake 0.4s ease;
}

.admin-label {
    display: block;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    margin-left: 0.25rem;
}

.size-mode-btn {
    flex: 1;
    padding: 0.5rem;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    border-radius: 0.75rem;
    transition: all 0.3s;
}

/* Admin/Login modal open/close animations */
#admin-modal .admin-modal-inner,
#login-modal .login-modal-inner {
    transform: scale(0.95) translateY(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
#admin-modal.modal-open .admin-modal-inner,
#login-modal.modal-open .login-modal-inner {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Admin modal glassmorphism & glow */
#admin-modal .admin-modal-inner {
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.08),
        0 0 80px -20px rgba(239, 68, 68, 0.15),
        0 30px 60px -15px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    background: linear-gradient(160deg, rgba(255,255,255,0.97) 0%, rgba(250,250,250,0.95) 100%);
}
body.dark #admin-modal .admin-modal-inner {
    background: linear-gradient(160deg, rgba(30,30,30,0.97) 0%, rgba(23,23,23,0.95) 100%);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 0 80px -20px rgba(239, 68, 68, 0.12),
        0 30px 60px -15px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
@media (max-width: 640px) {
    #admin-modal .admin-modal-inner {
        transform: translateY(100%);
        opacity: 1;
        border-radius: 2rem 2rem 0 0;
        max-height: 95vh;
    }
    #admin-modal.modal-open .admin-modal-inner {
        transform: translateY(0);
    }
    #admin-modal {
        align-items: flex-end;
        padding: 0;
    }
    .admin-header { padding: 1rem 1rem 0; border-radius: 2rem 2rem 0 0; }
    .admin-scroll-area { padding-left: 1rem; padding-right: 1rem; }
    .admin-footer { padding: 1rem; padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
    .admin-footer .flex { flex-wrap: wrap; }
    .admin-nav-btn, .admin-save-btn { flex: 1; min-width: 0; }
    .admin-allergen-toggle { font-size: 9px; padding: 0.6rem 0.75rem; }
    .admin-tab-btn { font-size: 8px; letter-spacing: 0.08em; }
    .admin-tab-icon { display: none; }
}

/* Confirm dialog animation */
#confirm-dialog .confirm-inner {
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
#confirm-dialog.modal-open .confirm-inner {
    transform: scale(1);
    opacity: 1;
}

/* Shake animation for errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
.shake { animation: shake 0.4s ease; }

/* Loading spinner for buttons */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Custom Alert Notification — supports success (green) and error (red) */
#custom-alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 2000;
    background: #ef4444;
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 8px;
}
#custom-alert.show {
    transform: translateX(-50%) translateY(0);
}
#custom-alert.success {
    background: #16a34a;
}

/* Admin section header with icon + colored accent */
.admin-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    position: relative;
    padding-left: 0.75rem;
}
.admin-section-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 14px;
    border-radius: 2px;
    background: linear-gradient(135deg, #ef4444, #f97316);
}
.admin-section-header svg {
    width: 14px;
    height: 14px;
    opacity: 0.5;
}

/* --- Admin Tab System --- */
.admin-tab-btn {
    position: relative;
    transition: color 0.4s ease;
    white-space: nowrap;
    z-index: 10;
    color: var(--text-muted);
}
.admin-tab-btn.active-admin-tab { color: white !important; }
#admin-tab-indicator {
    position: absolute;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-radius: 0.75rem;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    z-index: 1;
    pointer-events: none;
    height: calc(100% - 8px);
    top: 4px;
}
.admin-tab-panel {
    animation: adminTabIn 0.3s ease forwards;
}
.admin-tab-panel.hidden { display: none !important; }
@keyframes adminTabIn {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}
.admin-tab-dot.filled {
    background-color: var(--primary) !important;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}
/* Step number badges in tab buttons */
.admin-tab-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 8px;
    font-weight: 900;
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-muted);
    transition: all 0.3s ease;
    flex-shrink: 0;
}
body.dark .admin-tab-step {
    background: rgba(255, 255, 255, 0.08);
}
.active-admin-tab .admin-tab-step {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* Required / Optional field labels */
.admin-required::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #ef4444;
    border-radius: 50%;
    margin-left: 4px;
    vertical-align: middle;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
}
.admin-optional {
    font-weight: 500;
    font-size: 8px;
    color: var(--text-muted);
    opacity: 0.7;
    text-transform: none;
    letter-spacing: normal;
}

/* --- Sticky Header + Footer --- */
.admin-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--card-bg);
    border-radius: 2rem 2rem 0 0;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.admin-header.scrolled {
    border-bottom-color: var(--glass-border);
    box-shadow: 0 4px 20px -8px rgba(0, 0, 0, 0.06);
}
.admin-footer {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: var(--card-bg);
    border-radius: 0 0 2rem 2rem;
}
#admin-modal.modal-open .admin-footer {
    animation: adminFooterIn 0.5s 0.15s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes adminFooterIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.admin-scroll-area {
    scroll-behavior: smooth;
    padding-top: 0.5rem;
    padding-bottom: 1rem;
}

/* --- Toggle Switches --- */
.admin-toggle-track {
    width: 40px;
    height: 22px;
    background: #d1d5db;
    border-radius: 11px;
    position: relative;
    transition: background-color 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    cursor: pointer;
}
body.dark .admin-toggle-track { background: #404040; }
.admin-toggle-thumb {
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.admin-toggle-input:checked ~ .admin-toggle-track {
    background: #ef4444;
}
.admin-toggle-input:checked ~ .admin-toggle-track .admin-toggle-thumb {
    transform: translateX(18px);
}
.admin-toggle-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 0 0.75rem;
    background: var(--card-bg);
    height: 48px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.admin-toggle-card:hover { border-color: rgba(156, 163, 175, 0.6); }

/* --- Allergen Toggle Cards --- */
.admin-allergen-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
}
.admin-allergen-toggle:hover { border-color: rgba(239, 68, 68, 0.3); }
.admin-allergen-toggle::before {
    content: attr(data-emoji);
    font-size: 16px;
}
.admin-allergen-toggle:has(.admin-toggle-input:checked) {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
    color: var(--text-main);
}
body.dark .admin-allergen-toggle:has(.admin-toggle-input:checked) {
    background: rgba(239, 68, 68, 0.1);
}
/* Fallback for browsers without :has() */
.admin-allergen-toggle.active {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
    color: var(--text-main);
}
body.dark .admin-allergen-toggle.active {
    background: rgba(239, 68, 68, 0.1);
}

/* --- Location Pills --- */
.admin-loc-pill {
    cursor: pointer;
    display: inline-flex;
    user-select: none;
}
.admin-loc-pill span {
    display: inline-block;
    padding: 0.65rem 1.25rem;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 2px solid var(--glass-border);
    color: var(--text-muted);
    background: var(--card-bg);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.admin-loc-pill:hover span {
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--text-main);
}
.admin-loc-pill input:checked + span {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* --- Colored Macro Inputs --- */
.macro-input-kcal   { border-left: 3px solid #404040 !important; }
body.dark .macro-input-kcal { border-left-color: #a3a3a3 !important; }
.macro-input-protein { border-left: 3px solid #f87171 !important; }
.macro-input-carbs   { border-left: 3px solid #fdba74 !important; }
.macro-input-fat     { border-left: 3px solid #7dd3fc !important; }
.macro-input-fiber   { border-left: 3px solid #4ade80 !important; }
.admin-size-card-header {
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    color: white;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    letter-spacing: 0.1em;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

/* --- Image Preview --- */
#admin-image-preview {
    transition: all 0.3s ease;
    overflow: hidden;
}
#admin-image-preview.has-image { border-color: rgba(239, 68, 68, 0.2); }
#admin-image-img.loaded {
    animation: adminImageFadeIn 0.4s ease;
}
@keyframes adminImageFadeIn {
    from { opacity: 0; transform: scale(1.05); }
    to   { opacity: 1; transform: scale(1); }
}

/* --- Admin Nav Buttons --- */
.admin-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 1.5rem;
    border-radius: 1rem;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: var(--card-bg);
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
    transition: all 0.2s;
    cursor: pointer;
}
.admin-nav-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
}
.admin-save-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex: 1;
    padding: 0.9rem 1.5rem;
    border-radius: 1rem;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 24px -4px rgba(239, 68, 68, 0.4);
}
.admin-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px -4px rgba(239, 68, 68, 0.5);
}
.admin-save-btn:active { transform: scale(0.97); }
