/* ============================================================
   Food Service Tracking System - Custom Styles
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
    --sidebar-w:       210px;
    --sidebar-w-col:    54px;
    --topbar-h:         52px;
    --sidebar-bg:      #0f172a;
    --sidebar-accent:  #198754;
    --body-bg:         #f0f4f8;
}

body {
    font-family: 'Sarabun', 'Segoe UI', sans-serif;
    background: var(--body-bg);
    color: #1e293b;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    transition: width .25s ease;
    z-index: 1000;
    overflow: hidden;
}

body.sidebar-collapsed .sidebar { width: var(--sidebar-w-col); }

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    font-size: .9rem;
    font-weight: 700;
    color: #4ade80;
    border-bottom: 1px solid rgba(255,255,255,.07);
    white-space: nowrap;
    min-height: var(--topbar-h);
}

.sidebar-nav { padding: 12px 0; overflow-y: auto; }

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 9px 16px;
    color: #94a3b8;
    text-decoration: none;
    font-size: .82rem;
    transition: background .15s, color .15s;
    white-space: nowrap;
    border-radius: 0;
}

.sidebar-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-link.active { background: rgba(25,135,84,.25); color: #4ade80; border-right: 3px solid #4ade80; }

body.sidebar-collapsed .sidebar-text { display: none; }
body.sidebar-collapsed .sidebar-link  { justify-content: center; padding: 12px; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 18px 12px; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,.07);
}

/* ── Main content ────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    transition: margin-left .25s ease;
    display: flex;
    flex-direction: column;
}
body.sidebar-collapsed .main-content { margin-left: var(--sidebar-w-col); }

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* ── Content area ────────────────────────────────────────── */
.content-area { flex: 1; }

/* ── Stat cards ──────────────────────────────────────────── */
.stat-card {
    background: #fff;
    border-radius: 16px;
    transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.1) !important; }

.stat-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 8px;
}
.stat-value { font-size: 1.6rem; font-weight: 700; color: #0f172a; line-height: 1.1; }
.stat-label { font-size: .75rem; color: #64748b; margin-top: 3px; }

/* ── Cards ───────────────────────────────────────────────── */
.card { border-radius: 10px; }

/* ── Tables ──────────────────────────────────────────────── */
.table th { font-weight: 600; font-size: .85rem; color: #475569; }
.table td { font-size: .875rem; }

/* ── Badges ──────────────────────────────────────────────── */
.badge { font-weight: 500; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn { border-radius: 8px; }
.btn-success { background: #198754; border-color: #198754; }

/* ── Forms ───────────────────────────────────────────────── */
.form-control:focus, .form-select:focus { border-color: #198754; box-shadow: 0 0 0 .2rem rgba(25,135,84,.2); }

/* ── Mobile / Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
    :root { --sidebar-w: 64px; }
    .sidebar-text { display: none; }
    .sidebar-link { justify-content: center; padding: 12px; }
    .sidebar-brand { justify-content: center; padding: 18px 12px; }
    .sidebar-footer .sidebar-text { display: none; }
    .main-content { margin-left: 64px; }
    .content-area { padding: 12px !important; }
    .stat-value { font-size: 1.5rem; }
}

@media (max-width: 480px) {
    .topbar { padding: 0 12px !important; }
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Animations ──────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.card, .alert { animation: fadeIn .3s ease; }

/* ── Print ───────────────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .btn, nav, .no-print { display: none !important; }
    .main-content { margin: 0 !important; }
    .content-area { padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}
