/* ============================================================
   SHM Food Corner — Sidebar Layout
   ============================================================ */

:root {
    --sidebar-w: 240px;
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: #16213e;
    --sidebar-active: #e63946;
    --topbar-h: 56px;
    --accent: #e63946;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', sans-serif;
    background: #f0f2f5;
    margin: 0;
}

/* ── SIDEBAR ─────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.25s ease;
    overflow: hidden;
    scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}
.sidebar-brand-icon {
    width: 42px; height: 42px;
    background: var(--accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #fff;
    flex-shrink: 0;
}
.sidebar-brand-name {
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.2;
}
.sidebar-brand-sub {
    color: rgba(255,255,255,.45);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
    scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }
.sidebar-section-label {
    color: rgba(255,255,255,.3);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 14px 8px 4px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,.7);
    text-decoration: none;
    font-size: 13.5px;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.sidebar-link i { font-size: 16px; }
.sidebar-link:hover {
    background: rgba(255,255,255,.07);
    color: #fff;
}
.sidebar-link.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* Footer */
.sidebar-footer {
    padding: 14px 14px;
    border-top: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.sidebar-user-icon { font-size: 28px; color: rgba(255,255,255,.5); }
.sidebar-user-name { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-user-role { color: rgba(255,255,255,.4); font-size: 11px; }
.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e63946;
    text-decoration: none;
    font-size: 13px;
    padding: 7px 10px;
    border-radius: 8px;
    transition: background .15s;
}
.sidebar-logout:hover { background: rgba(230,57,70,.12); color: #c0392b; }

/* ── TOPBAR ──────────────────────────────── */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    z-index: 999;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.topbar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #374151;
    padding: 4px 6px;
    border-radius: 6px;
}
.topbar-toggle:hover { background: #f3f4f6; }
.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    flex: 1;
}
.topbar-right { font-size: 13px; color: #6b7280; }
.topbar-user { display: flex; align-items: center; gap: 6px; }

/* ── MAIN WRAPPER ────────────────────────── */
.main-wrapper {
    margin-left: var(--sidebar-w);
}
.main-content {
    padding: 24px;
    min-height: calc(100vh - var(--topbar-h));
    margin-top: var(--topbar-h);
}

/* ── MOBILE OVERLAY ──────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 999;
}
.sidebar-overlay.show { display: block; }

/* ── COMPONENTS ──────────────────────────── */
.stat-card {
    border: none;
    border-radius: 14px;
    transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.13);
}
.stat-card .display-6 { font-weight: 700; }
.stat-card .stat-icon { font-size: 2.5rem; opacity: .85; }

.page-header {
    border-bottom: 2px solid var(--accent);
    padding-bottom: 8px;
    margin-bottom: 24px;
    color: var(--accent);
}

.table thead {
    background-color: var(--accent);
    color: #fff;
}
.table-hover tbody tr:hover { background-color: #fff3f3; }

.table-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    white-space: nowrap;
}
.table-actions .btn {
    height: 34px;
    min-width: 34px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    line-height: 1;
    border-radius: 6px;
}
.table-actions .btn-icon {
    width: 34px;
    min-width: 34px;
    padding: 0;
}
.table-actions form {
    display: inline-flex;
    margin: 0;
}
.table-actions-cell {
    white-space: nowrap;
    vertical-align: middle;
}
.money-cell {
    white-space: nowrap;
    word-break: normal;
}
.canteen-orders-table {
    min-width: 1180px;
}
.canteen-orders-table th,
.canteen-orders-table td {
    vertical-align: middle;
}
.canteen-orders-table th:nth-child(1),
.canteen-orders-table td:nth-child(1) {
    width: 110px;
    white-space: nowrap;
}
.canteen-orders-table th:nth-child(2),
.canteen-orders-table td:nth-child(2) {
    width: 170px;
    white-space: nowrap;
}
.canteen-orders-table th:nth-child(3),
.canteen-orders-table td:nth-child(3),
.canteen-orders-table th:nth-child(6),
.canteen-orders-table td:nth-child(6) {
    width: 160px;
}
.canteen-orders-table th:nth-child(4),
.canteen-orders-table td:nth-child(4) {
    width: 130px;
}
.canteen-orders-table th:nth-child(5),
.canteen-orders-table td:nth-child(5) {
    min-width: 210px;
}
.canteen-orders-table th:nth-child(7),
.canteen-orders-table td:nth-child(7) {
    width: 110px;
    white-space: nowrap;
}
.canteen-orders-table th:nth-child(8),
.canteen-orders-table td:nth-child(8) {
    width: 130px;
    white-space: nowrap;
}
.canteen-orders-table th:nth-child(9),
.canteen-orders-table td:nth-child(9) {
    width: 90px;
    white-space: nowrap;
}

.form-label { font-weight: 500; }

.card { border: none; box-shadow: 0 2px 10px rgba(0,0,0,.06); border-radius: 12px; }

.bg-platinum { background-color: #78909c !important; color: #fff; }

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(calc(-1 * var(--sidebar-w)));
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-wrapper { margin-left: 0; }
    .topbar { left: 0; }
    .topbar-toggle { display: inline-flex; }
}

/* ── PRINT ───────────────────────────────── */
@media print {
    .sidebar, .topbar, .sidebar-overlay { display: none !important; }
    .main-wrapper { margin-left: 0 !important; }
    .main-content { margin-top: 0 !important; padding: 0 !important; }
    body { background: #fff; }
}

/* ── LOGIN ───────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #e63946 100%);
}
.login-card {
    width: 100%;
    max-width: 420px;
    border: none;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0,0,0,.35);
}

/* Dashboard */
.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, .9fr);
    gap: 20px;
    padding: 28px;
    border-radius: 24px;
    background:
        radial-gradient(circle at top right, rgba(255,255,255,.18), transparent 32%),
        linear-gradient(135deg, #17172a 0%, #24243e 50%, #e63946 140%);
    color: #fff;
    box-shadow: 0 18px 45px rgba(18, 20, 38, .18);
}
.dashboard-kicker,
.dashboard-section-kicker {
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: 11px;
    font-weight: 700;
}
.dashboard-kicker { color: rgba(255,255,255,.68); margin-bottom: 12px; }
.dashboard-hero-title {
    font-size: clamp(2rem, 3vw, 3rem);
    line-height: 1.05;
    margin: 0 0 14px;
    font-weight: 800;
}
.dashboard-hero-text {
    max-width: 680px;
    color: rgba(255,255,255,.78);
    font-size: 15px;
    margin-bottom: 24px;
}
.dashboard-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.dashboard-hero-secondary {
    border-color: rgba(255,255,255,.24);
    color: #fff;
    background: rgba(255,255,255,.08);
}
.dashboard-hero-secondary:hover {
    background: rgba(255,255,255,.16);
    color: #fff;
    border-color: rgba(255,255,255,.24);
}
.dashboard-hero-panel {
    padding: 22px;
    border-radius: 20px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.12);
    backdrop-filter: blur(4px);
}
.dashboard-panel-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .16em;
    color: rgba(255,255,255,.68);
    margin-bottom: 12px;
}
.dashboard-panel-value {
    font-size: 3rem;
    line-height: 1;
    font-weight: 800;
    margin-bottom: 8px;
}
.dashboard-panel-copy {
    color: rgba(255,255,255,.86);
    font-size: 15px;
    margin-bottom: 16px;
}
.dashboard-panel-meta {
    display: grid;
    gap: 10px;
    color: rgba(255,255,255,.82);
    font-size: 13px;
}
.dashboard-panel-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}
.dashboard-stat-card {
    position: relative;
    overflow: hidden;
    min-height: 214px;
    padding: 22px;
    border-radius: 22px;
    color: #fff;
    box-shadow: 0 14px 36px rgba(17, 24, 39, .08);
}
.dashboard-stat-card::after {
    content: "";
    position: absolute;
    width: 110px;
    height: 110px;
    right: -18px;
    top: -18px;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
}
.dashboard-stat-red { background: linear-gradient(135deg, #ea3946 0%, #ff6a61 100%); }
.dashboard-stat-amber { background: linear-gradient(135deg, #ffba08 0%, #ffcf48 100%); color: #172032; }
.dashboard-stat-green { background: linear-gradient(135deg, #178f5d 0%, #27b36f 100%); }
.dashboard-stat-dark { background: linear-gradient(135deg, #22253d 0%, #3a3f65 100%); }
.dashboard-stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}
.dashboard-stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    background: rgba(255,255,255,.14);
}
.dashboard-stat-amber .dashboard-stat-icon,
.dashboard-stat-amber .dashboard-stat-chip { background: rgba(255,255,255,.3); }
.dashboard-stat-chip {
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    background: rgba(255,255,255,.12);
}
.dashboard-stat-number {
    font-size: 3rem;
    line-height: 1;
    font-weight: 800;
    margin-bottom: 10px;
}
.dashboard-stat-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.dashboard-stat-note {
    max-width: 220px;
    font-size: 13px;
    color: rgba(255,255,255,.82);
}
.dashboard-stat-amber .dashboard-stat-note { color: rgba(23, 32, 50, .82); }

.dashboard-surface {
    background: linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(255,255,255,.92) 100%);
    border: 1px solid rgba(226,232,240,.9);
    border-radius: 24px;
    padding: 22px;
    box-shadow: 0 14px 40px rgba(15, 23, 42, .06);
}
.dashboard-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.dashboard-section-kicker { color: #e63946; margin-bottom: 6px; }
.dashboard-section-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #172032;
    margin: 0;
}

.dashboard-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.dashboard-action-card {
    display: block;
    padding: 20px;
    border-radius: 20px;
    text-decoration: none;
    background:
        radial-gradient(circle at top right, rgba(230,57,70,.08), transparent 34%),
        linear-gradient(180deg, #fff 0%, #fbfcff 100%);
    border: 1px solid #edf0f7;
    color: #172032;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.dashboard-action-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 28px rgba(15, 23, 42, .08);
    border-color: rgba(230,57,70,.18);
    color: #172032;
}
.dashboard-action-icon {
    display: inline-flex;
    width: 52px;
    height: 52px;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: #f7f8fc;
    font-size: 24px;
    margin-bottom: 14px;
}
.dashboard-action-card strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 8px;
}
.dashboard-action-card span:last-child {
    display: block;
    font-size: 13px;
    color: #667085;
    line-height: 1.5;
}

.dashboard-package-list {
    display: grid;
    gap: 18px;
}
.dashboard-package-item {
    padding: 14px 16px;
    background: #fafbff;
    border-radius: 18px;
    border: 1px solid #edf0f7;
}
.dashboard-package-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #172032;
    margin-bottom: 10px;
}
.dashboard-package-row span {
    color: #667085;
    font-size: 13px;
}
.dashboard-package-bar {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: #eaedf6;
}
.dashboard-package-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #e63946 0%, #ff8a5b 100%);
}

.dashboard-table thead {
    background: transparent;
    color: #667085;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 11px;
}
.dashboard-table thead th {
    border-bottom: 1px solid #e9edf5;
    padding-top: 0;
    padding-bottom: 14px;
}
.dashboard-table tbody td {
    padding-top: 16px;
    padding-bottom: 16px;
    border-color: #eff2f8;
}
.dashboard-order-id {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f4f6fb;
    font-weight: 700;
    color: #172032;
}

@media (max-width: 1200px) {
    .dashboard-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 992px) {
    .dashboard-hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-hero {
        padding: 22px;
    }
    .dashboard-actions-grid,
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    .dashboard-section-head {
        align-items: flex-start;
        flex-direction: column;
    }
}
