/* File: assets/css/style.css
 * Design system for the MikroTik Billing console.
 * Identity: a calm network-operations console — cool slate shell,
 * a teal "signal" accent, and a monospace face for technical values
 * (router IPs, invoice numbers, uptime). Loaded on every page.
 */

:root {
    /* Palette */
    --bg:            #f4f6fb;
    --surface:       #ffffff;
    --sidebar:       #0f1b2d;   /* deep slate-navy */
    --sidebar-2:     #16273f;
    --border:        #e4e8f0;

    --ink:           #1b2537;   /* primary text */
    --ink-muted:     #667089;   /* secondary text */
    --ink-invert:    #eaf0f8;

    --primary:       #0d9488;   /* teal — the signal accent */
    --primary-600:   #0b8177;
    --primary-050:   #e6f5f3;

    --success:       #15a34a;
    --danger:        #dc2626;
    --warning:       #d97706;
    --info:          #0891b2;

    --radius:        12px;
    --radius-sm:     8px;
    --shadow:        0 1px 2px rgba(16,26,45,.06), 0 8px 24px rgba(16,26,45,.06);

    --sidebar-w:     248px;
    --font-ui:       'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono:     'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

/* Bootstrap variable overrides so components inherit the identity */
:root {
    --bs-primary: var(--primary);
    --bs-primary-rgb: 13,148,136;
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--ink);
    --bs-body-font-family: var(--font-ui);
    --bs-border-color: var(--border);
    --bs-link-color: var(--primary-600);
    --bs-link-hover-color: var(--primary);
}

* { -webkit-font-smoothing: antialiased; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-ui); }

/* Monospace utility for technical values */
.mono { font-family: var(--font-mono); font-feature-settings: 'tnum' 1; letter-spacing: -.01em; }

/* ---------------- App shell ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.app-content {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-w);
    transition: margin-left .2s ease;
}
.app-content.is-full { margin-left: 0; }   /* guest pages (no sidebar) */

/* ---------------- Sidebar ---------------- */
.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    color: var(--ink-invert);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .2s ease;
}
.app-sidebar .brand {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.15rem 1.25rem;
    font-weight: 700; letter-spacing: -.02em; font-size: 1.05rem;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.app-sidebar .brand .glyph {
    width: 30px; height: 30px; border-radius: 8px;
    display: grid; place-items: center;
    background: var(--primary); color: #04201d; font-size: 1rem;
    box-shadow: 0 0 0 4px rgba(13,148,136,.18);
}
.app-sidebar .nav-section {
    padding: 1rem 1rem .35rem;
    font-size: .7rem; text-transform: uppercase; letter-spacing: .09em;
    color: #63799a; font-weight: 600;
}
.app-sidebar .nav-link {
    display: flex; align-items: center; gap: .7rem;
    margin: 2px .6rem; padding: .55rem .75rem;
    border-radius: var(--radius-sm);
    color: #b7c4d8; font-size: .92rem; font-weight: 500;
    transition: background .12s ease, color .12s ease;
}
.app-sidebar .nav-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.app-sidebar .nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.app-sidebar .nav-link.active {
    background: rgba(13,148,136,.16);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--primary);
}
.app-sidebar .sidebar-foot {
    margin-top: auto; padding: 1rem 1.25rem;
    font-size: .72rem; color: #5f7396;
    border-top: 1px solid rgba(255,255,255,.06);
}

/* ---------------- Top navbar ---------------- */
.app-navbar {
    height: 62px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1.25rem;
    position: sticky; top: 0; z-index: 1030;
}
.app-navbar .page-title { font-weight: 650; letter-spacing: -.01em; margin: 0; font-size: 1.05rem; }
.app-navbar .sidebar-toggle {
    border: 1px solid var(--border); background: #fff; color: var(--ink);
    width: 38px; height: 38px; border-radius: var(--radius-sm);
    display: none; align-items: center; justify-content: center;
}
.app-navbar .user-chip {
    display: flex; align-items: center; gap: .55rem;
    padding: .3rem .5rem .3rem .3rem; border-radius: 999px;
    border: 1px solid var(--border); background: #fff;
}
.app-navbar .user-chip .avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--primary-050); color: var(--primary-600);
    display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}

/* ---------------- Main ---------------- */
.app-main { padding: 1.5rem 1.75rem; flex: 1 1 auto; }

/* ---------------- Cards / stat cards ---------------- */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); font-weight: 600; }

.stat-card { position: relative; overflow: hidden; }
.stat-card .stat-label { color: var(--ink-muted); font-size: .82rem; font-weight: 500; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.stat-card .stat-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: grid; place-items: center; font-size: 1.25rem;
    background: var(--primary-050); color: var(--primary-600);
}

/* ---------------- Buttons ---------------- */
.btn-primary {
    --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-600); --bs-btn-hover-border-color: var(--primary-600);
    --bs-btn-active-bg: var(--primary-600); --bs-btn-active-border-color: var(--primary-600);
}
.btn-outline-primary {
    --bs-btn-color: var(--primary-600); --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary);
}

/* ---------------- Tables ---------------- */
.table { --bs-table-border-color: var(--border); }
.table > thead th {
    font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--ink-muted); font-weight: 600; border-bottom-width: 1px;
}
.table td, .table th { vertical-align: middle; }

/* ---------------- Badges ---------------- */
.badge-status { font-weight: 600; padding: .35em .7em; border-radius: 999px; font-size: .72rem; }
.badge-active   { background: #e6f6ec; color: #157f3c; }
.badge-disabled { background: #fdeaea; color: #b81c1c; }
.badge-expired  { background: #fdf1e3; color: #b26a06; }
.badge-suspended{ background: #f0ecfd; color: #6d3fd1; }

/* ---------------- Auth pages ---------------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
    background: radial-gradient(1200px 500px at 50% -10%, #17324f 0%, #0f1b2d 55%); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface);
    border-radius: 16px; box-shadow: 0 20px 60px rgba(4,12,24,.35); padding: 2rem; }

/* ---------------- Health / setup notice (Phase 1) ---------------- */
.check-row { display: flex; align-items: center; justify-content: space-between;
    padding: .7rem .25rem; border-bottom: 1px solid var(--border); }
.check-row:last-child { border-bottom: 0; }
.check-ok  { color: var(--success); }
.check-bad { color: var(--danger); }

/* ---------------- Responsive ---------------- */
@media (max-width: 991.98px) {
    .app-content { margin-left: 0; }
    .app-sidebar { transform: translateX(-100%); }
    .app-shell.sidebar-open .app-sidebar { transform: translateX(0); }
    .app-navbar .sidebar-toggle { display: inline-flex; }
    .sidebar-backdrop { position: fixed; inset: 0; background: rgba(9,15,26,.45);
        z-index: 1035; display: none; }
    .app-shell.sidebar-open .sidebar-backdrop { display: block; }
}

/* Toast container */
.toast-container { z-index: 1090; }
