:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --primary-light: #d1fae5;
    --secondary: #6366f1;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #22c55e;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 0.5rem;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--gray-50); color: var(--gray-800); line-height: 1.5; }

/* Layout */
.app-container { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: white; border-right: 1px solid var(--gray-200); padding: 1.5rem; position: fixed; height: 100vh; overflow-y: auto; z-index: 100; }
.sidebar-logo { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin-bottom: 2rem; display: flex; align-items: center; gap: 0.5rem; }
.sidebar-nav { list-style: none; }
.sidebar-nav a { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; color: var(--gray-600); text-decoration: none; border-radius: var(--radius); margin-bottom: 0.25rem; transition: all 0.2s; }
.sidebar-nav a:hover { background: var(--gray-100); color: var(--gray-800); }
.sidebar-nav a.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 500; }
.main-content { flex: 1; margin-left: 260px; padding: 2rem; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; }
.page-title { font-size: 1.75rem; font-weight: 700; color: var(--gray-900); }

/* Cards */
.card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 1.5rem; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--gray-200); }
.card-title { font-size: 1.125rem; font-weight: 600; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.625rem 1.25rem; border-radius: var(--radius); font-weight: 500; font-size: 0.875rem; cursor: pointer; border: none; transition: all 0.2s; text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.813rem; }
.btn-block { width: 100%; justify-content: center; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-weight: 500; margin-bottom: 0.375rem; color: var(--gray-700); font-size: 0.875rem; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 0.625rem 0.875rem; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: 0.875rem; transition: border-color 0.2s, box-shadow 0.2s; }
.form-input:focus, .form-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* Grid */
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Week Planner */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.5rem; overflow-x: auto; }
.day-column { background: white; border-radius: var(--radius); padding: 1rem; min-height: 300px; min-width: 140px; }
.day-header { font-weight: 600; text-align: center; padding-bottom: 0.75rem; border-bottom: 2px solid var(--primary); margin-bottom: 0.75rem; }
.day-date { font-size: 0.75rem; color: var(--gray-500); font-weight: normal; display: block; }
.meal-slot { margin-bottom: 0.75rem; }
.meal-slot-label { font-size: 0.7rem; font-weight: 500; color: var(--gray-500); text-transform: uppercase; margin-bottom: 0.25rem; }
.meal-card { background: var(--gray-50); border-radius: calc(var(--radius) / 2); padding: 0.5rem; font-size: 0.8rem; cursor: pointer; transition: all 0.2s; border: 1px solid transparent; position: relative; }
.meal-card:hover { border-color: var(--primary); background: var(--primary-light); }
.meal-card-empty { border: 2px dashed var(--gray-300); text-align: center; color: var(--gray-400); padding: 0.75rem 0.5rem; cursor: pointer; }
.meal-card-empty:hover { border-color: var(--primary); color: var(--primary); }
.meal-card .delete-btn { position: absolute; top: 2px; right: 2px; opacity: 0; background: var(--danger); color: white; border: none; border-radius: 50%; width: 18px; height: 18px; font-size: 12px; cursor: pointer; }
.meal-card:hover .delete-btn { opacity: 1; }

/* Recipe Cards */
.recipe-card { background: white; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform 0.2s, box-shadow 0.2s; cursor: pointer; }
.recipe-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.recipe-card-image { height: 140px; background: linear-gradient(135deg, var(--primary-light), var(--gray-200)); background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; font-size: 3rem; }
.recipe-card-body { padding: 1rem; }
.recipe-card-title { font-weight: 600; margin-bottom: 0.5rem; font-size: 0.95rem; }
.recipe-card-meta { display: flex; gap: 1rem; font-size: 0.75rem; color: var(--gray-500); }

/* Shopping List */
.shopping-category { margin-bottom: 1.5rem; }
.shopping-category-header { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; margin-bottom: 0.75rem; color: var(--gray-700); }
.shopping-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background: white; border-radius: var(--radius); margin-bottom: 0.5rem; cursor: pointer; transition: background 0.2s; }
.shopping-item:hover { background: var(--gray-50); }
.shopping-item.checked { background: var(--gray-100); }
.shopping-item.checked .shopping-item-name { text-decoration: line-through; color: var(--gray-400); }
.shopping-checkbox { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--gray-300); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.2s; }
.shopping-item.checked .shopping-checkbox { background: var(--primary); border-color: var(--primary); color: white; }
.shopping-item-name { flex: 1; }
.shopping-item-qty { color: var(--gray-500); font-size: 0.875rem; }
.shopping-item-note { font-size: 0.75rem; color: var(--gray-400); }

/* Batch Tasks */
.task-list { list-style: none; }
.task-item { display: flex; align-items: flex-start; gap: 1rem; padding: 1rem; background: white; border-radius: var(--radius); margin-bottom: 0.75rem; border-left: 4px solid var(--gray-300); cursor: pointer; transition: all 0.2s; }
.task-item:hover { box-shadow: var(--shadow); }
.task-item.pending { border-left-color: var(--gray-400); }
.task-item.in_progress { border-left-color: var(--warning); background: #fffbeb; }
.task-item.completed { border-left-color: var(--success); background: var(--gray-50); opacity: 0.7; }
.task-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--gray-100); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; }
.task-content { flex: 1; }
.task-title { font-weight: 600; margin-bottom: 0.25rem; }
.task-recipes { font-size: 0.813rem; color: var(--gray-500); }
.task-duration { font-size: 0.813rem; color: var(--gray-600); margin-top: 0.5rem; display: flex; align-items: center; gap: 0.25rem; }
.task-status-btn { padding: 0.375rem 0.75rem; border-radius: var(--radius); border: 1px solid var(--gray-300); background: white; font-size: 0.75rem; cursor: pointer; }
.task-status-btn:hover { background: var(--gray-50); }

/* Timer Widget */
.timer-widget { position: fixed; bottom: 2rem; right: 2rem; background: white; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 1rem; min-width: 220px; z-index: 1000; }
.timer-display { font-size: 2.5rem; font-weight: 700; font-family: 'SF Mono', 'Consolas', monospace; text-align: center; color: var(--gray-800); }
.timer-label { text-align: center; color: var(--gray-500); font-size: 0.875rem; margin-bottom: 0.5rem; }
.timer-controls { display: flex; gap: 0.5rem; justify-content: center; margin-top: 0.75rem; }
.timer-list { max-height: 200px; overflow-y: auto; }
.timer-item { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem; background: var(--gray-50); border-radius: calc(var(--radius) / 2); margin-bottom: 0.5rem; font-size: 0.875rem; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 0.25rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-success { background: #dcfce7; color: #166534; }

/* Alerts */
.alert { padding: 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: all 0.2s; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal { background: white; border-radius: var(--radius); width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; transform: scale(0.95); transition: transform 0.2s; }
.modal-overlay.active .modal { transform: scale(1); }
.modal-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-weight: 600; font-size: 1.125rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--gray-400); line-height: 1; }
.modal-close:hover { color: var(--gray-600); }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-200); display: flex; gap: 0.75rem; justify-content: flex-end; }

/* Progress */
.progress { height: 8px; background: var(--gray-200); border-radius: 9999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); transition: width 0.3s; }

/* Empty State */
.empty-state { text-align: center; padding: 3rem; color: var(--gray-500); }
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state-title { font-size: 1.125rem; font-weight: 600; color: var(--gray-700); margin-bottom: 0.5rem; }

/* Tabs */
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--gray-200); }
.tab { padding: 0.75rem 1rem; border: none; background: none; cursor: pointer; font-size: 0.875rem; font-weight: 500; color: var(--gray-500); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Auth Pages */
.auth-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-box { background: white; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 2rem; width: 100%; max-width: 400px; }
.auth-logo { text-align: center; font-size: 2rem; font-weight: 700; color: var(--primary); margin-bottom: 2rem; }
.auth-title { text-align: center; font-size: 1.25rem; font-weight: 600; margin-bottom: 1.5rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; color: var(--gray-500); font-size: 0.875rem; }
.auth-footer a { color: var(--primary); text-decoration: none; }

/* Mobile */
.mobile-header { display: none; background: white; padding: 1rem; border-bottom: 1px solid var(--gray-200); position: fixed; top: 0; left: 0; right: 0; z-index: 99; }
.mobile-menu-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 1rem; padding-top: 5rem; }
    .mobile-header { display: flex; justify-content: space-between; align-items: center; }
    .week-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }

/* Loading */
.loading { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.loading-spinner { width: 32px; height: 32px; border: 3px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
