/* ============================================================
   assets/css/style.css
   Cyber Café Management System — Global Stylesheet
   Palette: Bluish (Deep Navy → Sky Accent)
   ============================================================ */

/* ── Google Fonts ────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Custom Properties (Design Tokens) ──────────────── */
:root {
    /* Primary palette */
    --color-primary:        #1565C0;
    --color-primary-dark:   #0D47A1;
    --color-primary-light:  #1976D2;
    --color-primary-ghost:  rgba(21, 101, 192, 0.08);
    --color-accent:         #29B6F6;
    --color-accent-dark:    #0288D1;

    /* Semantic */
    --color-success:        #00897B;
    --color-success-bg:     rgba(0, 137, 123, 0.10);
    --color-danger:         #E53935;
    --color-danger-bg:      rgba(229, 57, 53, 0.10);
    --color-warning:        #F9A825;
    --color-warning-bg:     rgba(249, 168, 37, 0.10);
    --color-info:           #0288D1;
    --color-info-bg:        rgba(2, 136, 209, 0.10);

    /* Surfaces */
    --color-bg:             #EFF3FB;
    --color-bg-alt:         #E4EAF8;
    --color-surface:        #FFFFFF;
    --color-surface-raised: #F7F9FF;
    --color-border:         #D0DAEA;
    --color-border-focus:   #1565C0;

    /* Text */
    --color-text:           #1A2744;
    --color-text-muted:     #5A729A;
    --color-text-light:     #8EA3C0;

    /* Sidebar */
    --sidebar-width:        240px;
    --sidebar-bg:           #0D2752;
    --sidebar-text:         #C5D5EE;
    --sidebar-active-bg:    rgba(41, 182, 246, 0.15);
    --sidebar-active-text:  #29B6F6;
    --sidebar-hover-bg:     rgba(255,255,255,0.06);
    --topbar-height:        60px;

    /* Shadows */
    --shadow-sm:  0 1px 3px rgba(13,47,82,0.08), 0 1px 2px rgba(13,47,82,0.04);
    --shadow-md:  0 4px 16px rgba(13,47,82,0.10), 0 2px 6px rgba(13,47,82,0.06);
    --shadow-lg:  0 10px 40px rgba(13,47,82,0.14), 0 4px 12px rgba(13,47,82,0.08);
    --shadow-card:0 2px 8px rgba(21,101,192,0.08);

    /* Radius */
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  16px;
    --radius-xl:  24px;

    /* Transitions */
    --transition: all 0.2s ease;

    /* Typography */
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ── Layout Shell ────────────────────────────────────────── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    text-decoration: none;
    flex-shrink: 0;
    background: #0d6efd;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: #0d6efd;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    padding: 6px;
}

.sidebar-brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-brand-name {
    font-size: .9rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-brand-sub {
    font-size: .68rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

/* Nav sections */
.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-section-label {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--color-text-light);
    padding: 16px 20px 4px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--sidebar-text);
    font-size: .85rem;
    font-weight: 500;
    border-radius: 0;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
    position: relative;
}

.sidebar-nav .nav-link .nav-icon {
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover-bg);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--color-accent);
    border-radius: 0 3px 3px 0;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: .75rem;
    color: var(--color-text-light);
    flex-shrink: 0;
}
/* ── Main Content Area ───────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
}

.topbar-breadcrumb {
    font-size: .78rem;
    color: var(--color-text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-date {
    font-size: .8rem;
    color: var(--color-text-muted);
    background: var(--color-bg);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--color-border);
}

/* ── Page Content ────────────────────────────────────────── */
.page-content {
    flex: 1;
    padding: 24px;
}

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
    margin-bottom: 22px;
}

.page-header h1,
.page-header .page-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-text);
    margin: 0;
    line-height: 1.2;
}

.page-header .page-subtitle {
    font-size: .82rem;
    color: var(--color-text-muted);
    margin-top: 3px;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.card-header {
    background: var(--color-surface-raised);
    border-bottom: 1px solid var(--color-border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    padding: 14px 20px;
    font-weight: 700;
    font-size: .88rem;
    color: var(--color-text);
}

.card-body {
    padding: 20px;
}

/* KPI / Stat cards */
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--card-accent, var(--color-primary));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.card-sales    { --card-accent: var(--color-primary-light); }
.stat-card.card-expenses { --card-accent: var(--color-danger); }
.stat-card.card-profit   { --card-accent: var(--color-success); }
.stat-card.card-arrears  { --card-accent: var(--color-warning); }

.stat-card-label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.stat-card-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1.1;
    font-family: var(--font-mono);
}

.stat-card-sub {
    font-size: .75rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.stat-card-icon {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.2rem;
    opacity: .12;
}

/* Profit positive / negative */
.profit-positive { color: var(--color-success) !important; }
.profit-negative { color: var(--color-danger)  !important; }
.profit-positive.stat-card-value,
.profit-negative.stat-card-value { color: inherit; }

/* ── Tables ──────────────────────────────────────────────── */
.table {
    font-size: .84rem;
    color: var(--color-text);
    margin-bottom: 0;
}

.table thead th {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    background: var(--color-surface-raised);
    border-bottom: 2px solid var(--color-border);
    padding: 10px 14px;
    white-space: nowrap;
}

.table tbody td {
    padding: 10px 14px;
    vertical-align: middle;
    border-bottom: 1px solid var(--color-bg-alt);
}

.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr:hover { background: var(--color-primary-ghost); }

.table-footer-row td {
    background: var(--color-surface-raised);
    font-weight: 700;
    border-top: 2px solid var(--color-border);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    font-family: var(--font-body);
    font-size: .83rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: #fff;
}

.btn-outline-primary {
    color: var(--color-primary);
    border-color: var(--color-primary);
}
.btn-outline-primary:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-sm { font-size: .78rem; padding: 4px 10px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 5px;
}

.form-control,
.form-select {
    font-size: .85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
    background: var(--color-surface);
    color: var(--color-text);
}

.form-control::placeholder { color: var(--color-text-light); }

.input-group-text {
    background: var(--color-surface-raised);
    border-color: var(--color-border);
    color: var(--color-text-muted);
    font-size: .82rem;
    font-weight: 600;
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .03em;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Override Bootstrap badge colours to match our palette */
.badge.bg-success  { background-color: var(--color-success) !important; }
.badge.bg-danger   { background-color: var(--color-danger)  !important; }
.badge.bg-warning  { background-color: var(--color-warning) !important; color: var(--color-text) !important; }
.badge.bg-info     { background-color: var(--color-info)    !important; }
.badge.bg-primary  { background-color: var(--color-primary) !important; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert { font-size: .84rem; }
.alert-success { background: var(--color-success-bg); color: var(--color-success); border-color: var(--color-success); }
.alert-danger  { background: var(--color-danger-bg);  color: var(--color-danger);  border-color: var(--color-danger); }
.alert-warning { background: var(--color-warning-bg); color: #7a4f00;              border-color: var(--color-warning); }
.alert-info    { background: var(--color-info-bg);    color: var(--color-info);    border-color: var(--color-info); }

/* ── Weekly cashflow bar ─────────────────────────────────── */
.cashflow-bar-wrap { background: var(--color-bg-alt); border-radius: var(--radius-md); padding: 4px; }
.cashflow-bar { height: 8px; border-radius: 8px; min-width: 4px; transition: width .4s ease; }
.cashflow-bar.inflow  { background: var(--color-primary-light); }
.cashflow-bar.outflow { background: var(--color-danger); }

/* ── Weekly summary table row coloring ──────────────────── */
.week-row-today { background: var(--color-primary-ghost) !important; }

/* ── Mobile sidebar toggle ───────────────────────────────── */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text);
    font-size: 1.2rem;
    padding: 4px 6px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: flex;
        align-items: center;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 1035;
    }
    .sidebar-overlay.open { display: block; }
}

@media (max-width: 575.98px) {
    .page-content { padding: 16px; }
    .stat-card-value { font-size: 1.3rem; }
}

/* ── Utility helpers ─────────────────────────────────────── */
.text-primary  { color: var(--color-primary)   !important; }
.text-muted    { color: var(--color-text-muted) !important; }
.text-success  { color: var(--color-success)    !important; }
.text-danger   { color: var(--color-danger)     !important; }
.text-warning  { color: var(--color-warning)    !important; }

.bg-primary-ghost { background: var(--color-primary-ghost) !important; }

.mono { font-family: var(--font-mono) !important; }

.rounded-app { border-radius: var(--radius-md) !important; }

.divider { border: none; border-top: 1px solid var(--color-border); margin: 18px 0; }

/* Action icon buttons in tables */
.btn-icon {
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    padding: 0;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
    transition: var(--transition);
    text-decoration: none;
}
.btn-icon:hover { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn-icon.danger:hover { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--color-text-muted);
}
.empty-state-icon { font-size: 3rem; opacity: .35; margin-bottom: 12px; }
.empty-state-text { font-size: .9rem; }

/* Loading spinner overlay */
.spinner-overlay {
    position: fixed; inset: 0;
    background: rgba(240,244,255,.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}