@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;600;700&family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

/* ===== CSS Variables ===== */
:root {
    --font-display: 'Space Grotesk', 'Noto Sans SC', sans-serif;
    --font-body: 'Noto Sans SC', 'Space Grotesk', sans-serif;

    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-card: rgba(26, 26, 38, 0.7);
    --bg-card-solid: #1a1a26;
    --bg-input: rgba(255, 255, 255, 0.04);
    --bg-hover: rgba(255, 255, 255, 0.06);
    --bg-active: rgba(255, 255, 255, 0.1);

    --text-primary: #f0f0f5;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-inverse: #0a0a0f;

    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --accent-secondary: #a855f7;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --shadow-color: rgba(0, 0, 0, 0.4);

    --meal-breakfast: #10b981;
    --meal-lunch: #f59e0b;
    --meal-dinner: #3b82f6;

    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-base: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-slow: 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
    --bg-primary: #f8f9fc;
    --bg-secondary: #eef0f5;
    --bg-card: rgba(255, 255, 255, 0.75);
    --bg-card-solid: #ffffff;
    --bg-input: rgba(0, 0, 0, 0.03);
    --bg-hover: rgba(0, 0, 0, 0.04);
    --bg-active: rgba(0, 0, 0, 0.06);

    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --text-inverse: #ffffff;

    --accent: #4f46e5;
    --accent-light: #6366f1;
    --accent-glow: rgba(79, 70, 229, 0.25);
    --accent-secondary: #7c3aed;

    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    --shadow-color: rgba(0, 0, 0, 0.08);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background var(--transition-base), color var(--transition-base);
}

::selection {
    background: var(--accent-glow);
    color: var(--text-primary);
}

/* ===== Layout ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 100px 24px 48px;
}

@media (max-width: 768px) {
    .container {
        padding: 88px 16px 32px;
    }
}

/* ===== Navigation ===== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 64px;
    background: transparent;
    border-bottom: 1px solid transparent;
    transition: background var(--transition-base), border-color var(--transition-base), backdrop-filter var(--transition-base);
}

.nav.scrolled {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom-color: var(--border-color);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-brand {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 24px;
}

.nav-brand .lucide {
    width: 22px;
    height: 22px;
    color: var(--accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background var(--transition-fast);
    position: relative;
}

.nav-links a .lucide {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.nav-links a:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-links a:hover .lucide {
    opacity: 1;
}

.nav-links a.active {
    color: var(--accent-light);
    background: rgba(99, 102, 241, 0.1);
}

.nav-links a.active .lucide {
    opacity: 1;
    color: var(--accent-light);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.btn-icon .lucide {
    width: 16px;
    height: 16px;
}

@media (max-width: 768px) {
    .nav-links a span {
        display: none;
    }
    .nav-links a {
        padding: 8px;
    }
    .nav-brand span {
        display: none;
    }
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 24px var(--shadow-color);
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 8px 32px var(--shadow-color), 0 0 0 1px var(--border-hover);
}

.card-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title .lucide {
    width: 18px;
    height: 18px;
    color: var(--accent-light);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 12px var(--accent-glow);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.btn:hover::after {
    opacity: 1;
}

.btn:active {
    transform: scale(0.97) translateY(0);
}

.btn .lucide {
    width: 16px;
    height: 16px;
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    box-shadow: none;
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-active);
    box-shadow: none;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 2px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-sm .lucide {
    width: 14px;
    height: 14px;
}

/* ===== Inputs ===== */
.input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    outline: none;
}

.input::placeholder {
    color: var(--text-muted);
}

.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--bg-hover);
}

/* ===== Lists ===== */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    border: 1px solid transparent;
    margin-bottom: 8px;
    transition: all var(--transition-fast);
    animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.list-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-color);
    transform: translateX(4px);
}

.list-item:last-child {
    margin-bottom: 0;
}

.list-item-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: var(--text-primary);
}

.list-item-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.list-item:hover .list-item-actions {
    opacity: 1;
}

/* ===== Tags ===== */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-light);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.tag .lucide {
    width: 10px;
    height: 10px;
}

/* ===== Meal Labels ===== */
.meal-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.meal-label .lucide {
    width: 12px;
    height: 12px;
}

.meal-breakfast {
    background: rgba(245, 158, 11, 0.12);
    color: var(--meal-breakfast);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.meal-lunch {
    background: rgba(16, 185, 129, 0.12);
    color: var(--meal-lunch);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.meal-dinner {
    background: rgba(59, 130, 246, 0.12);
    color: var(--meal-dinner);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

.modal-overlay.closing {
    animation: fadeOut 0.2s ease forwards;
}

.modal {
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 90%;
    max-width: 420px;
    max-height: 80vh;
    overflow: auto;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
    transform: scale(0.95) translateY(10px);
    animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-overlay.closing .modal {
    animation: modalOut 0.2s ease forwards;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-title .lucide {
    width: 20px;
    height: 20px;
    color: var(--accent-light);
}

/* ===== Sheet (Bottom Panel) ===== */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

.sheet-overlay.closing {
    animation: fadeOut 0.2s ease forwards;
}

.sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card-solid);
    border-top: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 24px;
    max-height: 70vh;
    overflow: auto;
    z-index: 1001;
    transform: translateY(100%);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.sheet-overlay.closing + .sheet,
.sheet-overlay.closing ~ .sheet,
.sheet.closing {
    animation: slideDown 0.3s ease forwards;
}

.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.sheet-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.sheet-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--bg-hover);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sheet-close:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

.sheet-close .lucide {
    width: 16px;
    height: 16px;
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px var(--shadow-color);
    font-size: 14px;
    color: var(--text-primary);
    animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
    max-width: 320px;
}

.toast.hiding {
    animation: toastOut 0.3s ease forwards;
}

.toast .lucide {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast-success {
    border-left: 3px solid var(--success);
}

.toast-error {
    border-left: 3px solid var(--error);
}

.toast-warning {
    border-left: 3px solid var(--warning);
}

/* ===== Empty State ===== */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    gap: 12px;
}

.empty .lucide {
    width: 48px;
    height: 48px;
    opacity: 0.4;
    margin-bottom: 8px;
}

.empty-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ===== Dish Options ===== */
.dish-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 6px;
    border: 1px solid transparent;
}

.dish-option:hover {
    background: var(--bg-hover);
    border-color: var(--border-color);
    transform: translateX(4px);
}

.dish-option:last-child {
    margin-bottom: 0;
}

/* ===== Animations ===== */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modalOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(100%);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ===== Utility ===== */
.text-gradient {
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glow-border {
    position: relative;
}

.glow-border::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    opacity: 0;
    z-index: -1;
    transition: opacity var(--transition-base);
    filter: blur(8px);
}

.glow-border:hover::before {
    opacity: 0.5;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== Section Title ===== */
.section-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeUp 0.5s 0.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.section-title .lucide {
    width: 20px;
    height: 20px;
    color: var(--accent-light);
}

/* ===== Grid helpers ===== */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.grid-7 {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

@media (max-width: 1024px) {
    .grid-7 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-3 {
        grid-template-columns: 1fr;
    }
    .grid-7 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .grid-7 {
        grid-template-columns: 1fr;
    }
}
