/* Smart Nutrition Tracker - gaya utama (mobile-first, Bootstrap 5.3) */
:root {
  --snt-primary: #0f766e;
  --snt-primary-rgb: 15, 118, 110;
  --snt-sidebar-w: 250px;
  --bs-primary: #0f766e;
  --bs-primary-rgb: 15, 118, 110;
  --bs-link-color: #0f766e;
  --bs-link-hover-color: #0b5f59;
}
[data-bs-theme="dark"] {
  --bs-body-bg: #0f1716;
  --bs-tertiary-bg: #16211f;
  --bs-secondary-bg: #1b2725;
  --bs-link-color: #5eead4;
}
.btn-primary { --bs-btn-bg: #0f766e; --bs-btn-border-color: #0f766e; --bs-btn-hover-bg: #0b5f59; --bs-btn-hover-border-color: #0b5f59; --bs-btn-active-bg: #0a524d; --bs-btn-disabled-bg: #0f766e; --bs-btn-disabled-border-color: #0f766e; }
.btn-outline-primary { --bs-btn-color: #0f766e; --bs-btn-border-color: #0f766e; --bs-btn-hover-bg: #0f766e; --bs-btn-hover-border-color: #0f766e; --bs-btn-active-bg: #0f766e; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #5eead4; --bs-btn-border-color: #5eead4; }
.text-bg-primary, .bg-primary { background-color: #0f766e !important; }
.nav-pills .nav-link.active { background-color: #0f766e; }
.page-item.active .page-link { background-color: #0f766e; border-color: #0f766e; }
.form-check-input:checked { background-color: #0f766e; border-color: #0f766e; }

body.app-body { background: var(--bs-tertiary-bg); min-height: 100vh; }
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-content { padding: 1rem; padding-bottom: 6rem; }
@media (min-width: 992px) { .app-content { padding: 1.5rem; } }

/* Sidebar */
.app-sidebar { width: var(--snt-sidebar-w); background: var(--bs-body-bg); border-right: 1px solid var(--bs-border-color); position: sticky; top: 0; height: 100vh; overflow-y: auto; flex-shrink: 0; }
.app-sidebar .brand, .offcanvas .brand { display: flex; align-items: center; gap: .5rem; padding: 1rem 1.25rem; font-weight: 700; color: var(--snt-primary); text-decoration: none; font-size: 1.05rem; }
[data-bs-theme="dark"] .app-sidebar .brand { color: #5eead4; }
.app-sidebar .brand i { font-size: 1.5rem; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); padding: 1rem 1.25rem .25rem; font-weight: 600; }
.app-sidebar .nav-link, .app-sidebar-mobile .nav-link { display: flex; align-items: center; gap: .75rem; color: var(--bs-body-color); padding: .55rem 1.25rem; border-radius: 0 2rem 2rem 0; margin-right: .75rem; font-size: .925rem; }
.app-sidebar .nav-link i, .app-sidebar-mobile .nav-link i { font-size: 1.1rem; width: 1.25rem; text-align: center; opacity: .8; }
.app-sidebar .nav-link:hover, .app-sidebar-mobile .nav-link:hover { background: rgba(var(--snt-primary-rgb), .08); }
.app-sidebar .nav-link.active, .app-sidebar-mobile .nav-link.active { background: rgba(var(--snt-primary-rgb), .14); color: var(--snt-primary); font-weight: 600; }
[data-bs-theme="dark"] .app-sidebar .nav-link.active { color: #5eead4; }

/* Topbar */
.app-topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem; background: var(--bs-body-bg); border-bottom: 1px solid var(--bs-border-color); min-height: 58px; }
.btn-icon { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 1.2rem; color: var(--bs-body-color); }
.btn-icon:hover { background: var(--bs-secondary-bg); }
.notif-badge { position: absolute; top: 2px; right: 0; font-size: .6rem; }

/* Bottom nav (mobile) */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; display: flex; justify-content: space-around; align-items: flex-end; background: var(--bs-body-bg); border-top: 1px solid var(--bs-border-color); padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(0,0,0,.05); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--bs-secondary-color); text-decoration: none; font-size: .7rem; padding: .25rem 0; min-height: 48px; justify-content: center; }
.bottom-nav a i { font-size: 1.35rem; }
.bottom-nav a.active { color: var(--snt-primary); font-weight: 600; }
[data-bs-theme="dark"] .bottom-nav a.active { color: #5eead4; }
.bottom-nav .bottom-nav-add { flex: 0 0 auto; width: 58px; height: 58px; border-radius: 50%; background: var(--snt-primary); color: #fff !important; margin-top: -26px; box-shadow: 0 6px 16px rgba(var(--snt-primary-rgb), .4); }
.bottom-nav .bottom-nav-add i { font-size: 1.7rem; }

/* Kad & komponen */
.card { border-radius: .85rem; }
.card-header:first-child { border-radius: .85rem .85rem 0 0; }
.stat-card:hover, .food-card:hover, .nutri-card:hover { transform: translateY(-1px); box-shadow: 0 .5rem 1rem rgba(0,0,0,.08) !important; }
.stat-card, .food-card, .nutri-card { transition: transform .12s, box-shadow .12s; }
.stat-mini { background: var(--bs-tertiary-bg); border-radius: .6rem; padding: .6rem; text-align: center; }
.progress-thin { height: 6px; border-radius: 3px; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 3px; }
.nutri-table tbody tr[data-nid] { cursor: pointer; }
.nutri-table tbody tr:hover { background: rgba(var(--snt-primary-rgb), .04); }
.chart-box { position: relative; height: 280px; }
.chart-box-sm { height: 200px; }
.min-w-0 { min-width: 0; }
.food-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: .6rem; flex-shrink: 0; }
.food-thumb-empty { display: flex; align-items: center; justify-content: center; background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); font-size: 1.4rem; }
.food-hero { max-height: 260px; object-fit: cover; }
.step-dot { width: 36px; height: 36px; border-radius: 50%; background: var(--snt-primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.sticky-actions { position: sticky; bottom: 70px; background: var(--bs-tertiary-bg); padding: .75rem 0; z-index: 10; }
@media (min-width: 992px) { .sticky-actions { bottom: 0; } }
.ac-list { z-index: 1050; max-height: 300px; overflow-y: auto; }
.limits-table input { min-width: 70px; }
.date-nav input[type=date] { max-width: 160px; }
.preset-list .list-group-item { cursor: pointer; }

/* Butang besar mesra sentuhan pada mobile */
@media (max-width: 767.98px) {
  .btn { min-height: 42px; }
  .btn-sm { min-height: 34px; }
  .form-control, .form-select { min-height: 44px; font-size: 16px; }
  .form-control-sm, .form-select-sm { min-height: 36px; font-size: 14px; }
  .nutri-table { font-size: .85rem; }
  .nutri-table th:nth-child(4), .nutri-table td:nth-child(4) { display: none; }
  .app-content { padding: .75rem; padding-bottom: 6.5rem; }
  .meal-card .list-group-item { padding: .65rem .75rem; }
}

/* Pengimbas barcode */
.scanner-box { position: relative; background: #000; border-radius: .75rem; overflow: hidden; aspect-ratio: 4/3; }
.scanner-box video { width: 100%; height: 100%; object-fit: cover; }
.scanner-frame { position: absolute; inset: 25% 12%; border: 3px solid rgba(94, 234, 212, .9); border-radius: .5rem; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); }
.scanner-msg { position: absolute; bottom: .5rem; left: 0; right: 0; text-align: center; color: #fff; font-size: .85rem; text-shadow: 0 1px 2px #000; }

/* Auth */
.auth-body { background: linear-gradient(135deg, #ecfdf5 0%, #f0f9ff 100%); min-height: 100vh; }
.auth-wrap { max-width: 440px; margin: 0 auto; padding: 2.5rem 1rem; }
.auth-logo { width: 64px; height: 64px; border-radius: 18px; background: var(--snt-primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 2rem; box-shadow: 0 8px 20px rgba(var(--snt-primary-rgb), .35); }

@media print {
  .app-sidebar, .app-topbar, .bottom-nav, .btn, form, .toast-container { display: none !important; }
  .app-content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}
