/* NutriCheck - App CSS */

/* Base */
*, *::before, *::after { box-sizing: border-box; }
body { scroll-behavior: smooth; }

/* Nav links */
.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    transition: color 0.15s, background 0.15s;
    text-decoration: none;
}
.nav-link:hover, .nav-link.active {
    color: #16a34a;
    background: #f0fdf4;
}
.dark .nav-link:hover, .dark .nav-link.active {
    background: #14532d30;
    color: #4ade80;
}
.mobile-nav-link {
    display: block;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: background 0.15s;
}
.mobile-nav-link:hover { background: #f3f4f6; }
.dark .mobile-nav-link { color: #d1d5db; }
.dark .mobile-nav-link:hover { background: #374151; }

/* Buttons */
.btn-primary {
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: #16a34a; color: #fff; font-weight: 600;
    padding: 0.625rem 1.25rem; border-radius: 0.625rem;
    text-decoration: none; border: none; cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    font-size: 0.9375rem; line-height: 1.25;
}
.btn-primary:hover { background: #15803d; box-shadow: 0 4px 14px rgba(22,163,74,.35); }
.btn-primary:active { transform: scale(.98); }

.btn-secondary {
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: #f3f4f6; color: #374151; font-weight: 600;
    padding: 0.625rem 1.25rem; border-radius: 0.625rem;
    text-decoration: none; border: none; cursor: pointer;
    transition: background 0.15s; font-size: 0.9375rem;
}
.btn-secondary:hover { background: #e5e7eb; }
.dark .btn-secondary { background: #374151; color: #f9fafb; }
.dark .btn-secondary:hover { background: #4b5563; }

.btn-danger {
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: #ef4444; color: #fff; font-weight: 600;
    padding: 0.625rem 1.25rem; border-radius: 0.625rem;
    text-decoration: none; border: none; cursor: pointer;
    transition: background 0.15s; font-size: 0.9375rem;
}
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.8125rem; }

/* Cards */
.card {
    background: #fff;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    transition: box-shadow 0.2s;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.dark .card {
    background: #1f2937;
    border-color: #374151;
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}

/* Stat card */
.stat-card {
    background: #fff; border-radius: 1rem;
    border: 1px solid #e5e7eb; padding: 1.25rem;
    display: flex; align-items: center; gap: 1rem;
}
.dark .stat-card { background: #1f2937; border-color: #374151; }
.stat-icon {
    width: 3rem; height: 3rem; border-radius: 0.75rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 1.375rem;
}

/* Score badge */
.score-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 3rem; height: 3rem; border-radius: 50%;
    font-weight: 700; font-size: 1rem; flex-shrink: 0;
}
.score-excellent { background: #dcfce7; color: #15803d; }
.score-good      { background: #dbeafe; color: #1d4ed8; }
.score-average   { background: #fef9c3; color: #a16207; }
.score-poor      { background: #fee2e2; color: #b91c1c; }
.dark .score-excellent { background: #14532d40; color: #4ade80; }
.dark .score-good      { background: #1e3a8a40; color: #60a5fa; }
.dark .score-average   { background: #78350f40; color: #fbbf24; }
.dark .score-poor      { background: #7f1d1d40; color: #f87171; }

/* Progress bar */
.progress-bar-wrap {
    background: #e5e7eb; border-radius: 999px; overflow: hidden; height: 8px;
}
.dark .progress-bar-wrap { background: #374151; }
.progress-bar {
    height: 100%; border-radius: 999px;
    transition: width 0.6s cubic-bezier(.4,0,.2,1);
}

/* Form elements */
.form-input {
    width: 100%; padding: 0.625rem 0.875rem;
    border: 1.5px solid #d1d5db; border-radius: 0.625rem;
    background: #fff; color: #111827; font-size: 0.9375rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
.form-input:focus { border-color: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.dark .form-input {
    background: #111827; border-color: #374151;
    color: #f9fafb;
}
.dark .form-input:focus { border-color: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.1); }

.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1.25rem; padding-right: 2.5rem; }

.form-label {
    display: block; font-size: 0.875rem; font-weight: 500;
    color: #374151; margin-bottom: 0.375rem;
}
.dark .form-label { color: #d1d5db; }

/* Autocomplete dropdown */
.autocomplete-list {
    position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; border: 1.5px solid #e5e7eb;
    border-radius: 0.625rem; margin-top: 0.25rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 100; max-height: 280px; overflow-y: auto;
}
.dark .autocomplete-list { background: #1f2937; border-color: #374151; }
.autocomplete-item {
    padding: 0.625rem 1rem; cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    display: flex; align-items: center; justify-content: space-between;
    transition: background 0.1s;
}
.autocomplete-item:hover { background: #f0fdf4; }
.dark .autocomplete-item:hover { background: #14532d20; }
.dark .autocomplete-item { border-bottom-color: #374151; }

/* Meal type badge */
.meal-badge {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.25rem 0.625rem; border-radius: 999px;
    font-size: 0.75rem; font-weight: 600;
}
.meal-badge-dorucak  { background: #fef3c7; color: #92400e; }
.meal-badge-rucak    { background: #dcfce7; color: #166534; }
.meal-badge-vecera   { background: #dbeafe; color: #1e40af; }
.meal-badge-uzina    { background: #fce7f3; color: #9d174d; }
.meal-badge-napitak  { background: #e0f2fe; color: #0c4a6e; }
.meal-badge-ostalo   { background: #f3f4f6; color: #4b5563; }

/* Alert */
.alert {
    border-radius: 0.75rem; padding: 1rem 1.25rem;
    display: flex; align-items: flex-start; gap: 0.75rem;
    font-size: 0.9375rem;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fef9c3; color: #92400e; border: 1px solid #fde68a; }
.dark .alert-success { background: #14532d30; color: #4ade80; border-color: #166534; }
.dark .alert-error   { background: #7f1d1d30; color: #f87171; border-color: #991b1b; }
.dark .alert-info    { background: #1e3a8a30; color: #60a5fa; border-color: #1d4ed8; }

/* Spinner */
.spinner {
    width: 1.5rem; height: 1.5rem; border-radius: 50%;
    border: 3px solid #e5e7eb; border-top-color: #16a34a;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Table */
.table { width: 100%; border-collapse: collapse; }
.table th {
    padding: 0.75rem 1rem; text-align: left;
    font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
}
.table td {
    padding: 0.875rem 1rem; font-size: 0.875rem;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
}
.dark .table th { color: #9ca3af; border-bottom-color: #374151; }
.dark .table td { color: #d1d5db; border-bottom-color: #374151; }
.table tr:hover td { background: #f9fafb; }
.dark .table tr:hover td { background: #111827; }

/* Pie chart macro colors */
.macro-protein { color: #3b82f6; }
.macro-fat     { color: #f59e0b; }
.macro-carbs   { color: #8b5cf6; }
.macro-fiber   { color: #10b981; }

/* Page header */
.page-header {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-bottom: 1px solid #bbf7d0;
    padding: 2rem 0;
}
.dark .page-header {
    background: linear-gradient(135deg, #14532d20 0%, #14532d40 100%);
    border-bottom-color: #166534;
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.animate-fade-in { animation: fadeIn 0.3s ease forwards; }

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.5rem;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
.dark ::-webkit-scrollbar-thumb { background: #4b5563; }
