/* ============================================
   Police Communications ERP — Bootstrap Theme
   Version: 1.0.0
   ============================================ */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --command-bar-height: 64px;
    --navy: #0f2444;
    --navy-light: #1a3a6b;
    --navy-lighter: #2454a0;
    --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
}

*, *::before, *::after { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono) !important; }

/* ─── SIDEBAR ─── */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--navy);
    color: #c8d6e5;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease, transform 0.2s ease;
    overflow-x: hidden;
    overflow-y: auto;
}
.sidebar .brand-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--navy-lighter);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.1rem;
    flex-shrink: 0;
}
.sidebar .brand-text h6 { color: #fff; font-size: 0.85rem; }
.sidebar .brand-text small { font-size: 0.65rem; }
.sidebar-nav .nav-link {
    color: #8fa3bf;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    white-space: nowrap;
}
.sidebar-nav .nav-link:hover { color: #e2e8f0; background: rgba(255,255,255,0.06); }
.sidebar-nav .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
    border-left-color: #60a5fa;
    border-radius: 0 6px 6px 0 !important;
}
.sidebar-nav .nav-link i { width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-footer .user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--navy-lighter);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; color: #c8d6e5;
    flex-shrink: 0;
}
/* Collapsed */
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .sidebar-nav span,
.sidebar.collapsed .sidebar-footer .flex-grow-1,
.sidebar.collapsed .sidebar-footer span { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; }
.sidebar.collapsed .nav-link { justify-content: center; padding-left: 0 !important; padding-right: 0 !important; }
.sidebar.collapsed .sidebar-footer > div { justify-content: center; }

/* ─── MAIN WRAPPER ─── */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex; flex-direction: column;
    transition: margin-left 0.2s ease;
    background: #f8f9fc;
}
.sidebar.collapsed ~ .main-wrapper { margin-left: var(--sidebar-collapsed); }

/* ─── COMMAND BAR ─── */
.command-bar {
    height: var(--command-bar-height);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky; top: 0; z-index: 1040;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* ─── MAIN CONTENT ─── */
.main-content { padding: 1.5rem; flex: 1; }

/* ─── PAGE HEADER ─── */
.page-header h1 { font-size: 1.5rem; font-weight: 700; color: #1e293b; margin-bottom: 0; }
.page-header p   { font-size: 0.85rem; color: #64748b; margin-bottom: 0; }

/* ─── KPI CARDS ─── */
.kpi-card {
    background: #fff; border: 1px solid #e5e7eb;
    border-radius: 10px; padding: 1.25rem;
    transition: box-shadow 0.2s ease;
}
.kpi-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.kpi-label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #64748b; margin-bottom: 0.5rem; }
.kpi-value { font-size: 1.75rem; font-weight: 700; color: #1e293b; line-height: 1; }
.kpi-trend { font-size: 0.75rem; font-weight: 600; }
.kpi-trend.up { color: #16a34a; }
.kpi-trend.down { color: #64748b; }
.kpi-trend.alert { color: #dc2626; }

/* ─── CARDS ─── */
.card { border: 1px solid #e5e7eb; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.card-header { background: transparent; border-bottom: 1px solid #f1f5f9; }
.card-title { font-weight: 600; font-size: 0.95rem; color: #1e293b; }

/* ─── TABLES ─── */
.table-section-head th {
    font-size: 0.65rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; color: #64748b; background: #f8f9fc;
    border-bottom: 1px solid #e5e7eb; padding: 0.6rem 0.75rem; white-space: nowrap;
}
.table > tbody > tr { transition: background 0.1s ease; }
.table > tbody > tr:hover { background: #f8f9fc; }
.table > tbody > tr > td { padding: 0.65rem 0.75rem; vertical-align: middle; font-size: 0.85rem; color: #334155; }
.table-striped > tbody > tr:nth-of-type(odd) { background: rgba(248,249,252,0.5); }

/* ─── BADGES ─── */
.badge-status { font-size: 0.7rem; font-weight: 600; padding: 0.3em 0.65em; border-radius: 5px; }
.badge-success-soft { background: rgba(34,197,94,0.1); color: #16a34a; }
.badge-danger-soft  { background: rgba(239,68,68,0.1); color: #dc2626; }
.badge-warning-soft { background: rgba(245,158,11,0.1); color: #d97706; }
.badge-primary-soft { background: rgba(37,99,235,0.1); color: #2563eb; }
.badge-muted-soft   { background: #f1f5f9; color: #64748b; }

/* ─── FILTER BAR ─── */
.filter-bar { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 1rem; }
.filter-label { font-size: 0.6rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #64748b; margin-bottom: 0.35rem; }
.form-control.filter-input,
.form-select.filter-input { background: #f8f9fc; border: none; font-size: 0.85rem; height: 38px; }
.form-control.filter-input:focus,
.form-select.filter-input:focus { background: #fff; box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }

/* ─── TABS ─── */
.nav-tabs-custom { background: #f1f5f9; border-radius: 8px; padding: 4px; gap: 4px; border: none; }
.nav-tabs-custom .nav-link { border: none; border-radius: 6px; font-size: 0.85rem; font-weight: 500; color: #64748b; padding: 0.45rem 1rem; }
.nav-tabs-custom .nav-link.active { background: #fff; color: #1e293b; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* ─── STEPPER ─── */
.stepper { display: flex; align-items: center; }
.stepper-step { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.stepper-circle { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; }
.stepper-circle.completed { background: #16a34a; color: #fff; }
.stepper-circle.active    { background: var(--navy-lighter); color: #fff; }
.stepper-circle.pending   { background: #f1f5f9; color: #94a3b8; }
.stepper-line { flex: 1; height: 2px; margin: 0 12px; border-radius: 2px; }
.stepper-line.completed { background: #16a34a; }
.stepper-line.pending   { background: #e5e7eb; }
.stepper-label { font-size: 0.7rem; font-weight: 500; }

/* ─── CATEGORY STRIP ─── */
.category-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 0.65rem 1rem; border-radius: 8px;
    border: 1px solid #e5e7eb; background: #fff;
    cursor: pointer; transition: all 0.15s; white-space: nowrap; min-width: 130px;
}
.category-chip:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.06); color: inherit; }
.category-chip.active { border-left: 3px solid var(--navy-lighter); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.category-chip .chip-icon { font-size: 1.2rem; }
.category-chip .chip-label { font-size: 0.75rem; font-weight: 600; }
.category-chip .chip-count { font-size: 0.7rem; color: #64748b; }

/* ─── QR SCAN AREA ─── */
.qr-scan-area { background: #f8f9fc; border: 2px dashed rgba(37,99,235,0.2); border-radius: 12px; padding: 2rem; text-align: center; }
.qr-scan-icon { width: 80px; height: 80px; border-radius: 16px; background: rgba(37,99,235,0.05); display: flex; align-items: center; justify-content: center; margin: 0 auto 0.75rem; }

/* ─── TIMELINE ─── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 10px; top: 8px; bottom: 8px; width: 2px; background: #e5e7eb; }
.timeline-item { position: relative; padding-bottom: 1.25rem; }
.timeline-dot { position: absolute; left: -20px; top: 4px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; }
.timeline-dot.primary { background: var(--navy-lighter); }
.timeline-dot.muted { background: #e5e7eb; }

/* ─── MASTER PAGE ─── */
.master-nav .list-group-item { border: none; font-size: 0.85rem; font-weight: 500; padding: 0.6rem 0.75rem; border-radius: 6px; color: #64748b; cursor: pointer; }
.master-nav .list-group-item:hover { background: #f8f9fc; color: #1e293b; }
.master-nav .list-group-item.active { background: rgba(37,99,235,0.1); color: var(--navy-lighter); font-weight: 600; }

/* ─── LOGIN PAGE ─── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, rgba(15,36,68,0.06), #f8f9fc, rgba(15,36,68,0.04)); position: relative; }
.login-page::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(229,231,235,0.4) 1px, transparent 1px), linear-gradient(90deg, rgba(229,231,235,0.4) 1px, transparent 1px); background-size: 48px 48px; pointer-events: none; }
.login-card { width: 100%; max-width: 420px; position: relative; z-index: 1; }
.login-brand-icon { width: 64px; height: 64px; border-radius: 16px; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin: 0 auto 1rem; box-shadow: 0 4px 12px rgba(15,36,68,0.3); }

/* ─── UTILITIES ─── */
.text-section-label { font-size: 0.6rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #64748b; }
.tabular-nums { font-variant-numeric: tabular-nums; }
.cursor-pointer { cursor: pointer; }
.condition-good { color: #16a34a; }
.condition-damaged { color: #dc2626; }
.condition-repair { color: #d97706; }

/* ─── RESPONSIVE ─── */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); width: var(--sidebar-width); }
    .sidebar.show { transform: translateX(0); }
    .main-wrapper { margin-left: 0 !important; }
    .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1049; display: none; }
    .sidebar-overlay.show { display: block; }
}

/* ─── ANIMATIONS ─── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.animate-fadein { animation: fadeIn 0.3s ease-out; }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ─── PRINT ─── */
@media print {
    .sidebar, .command-bar, .sidebar-overlay { display: none !important; }
    .main-wrapper { margin-left: 0 !important; }
    .main-content { padding: 0 !important; }
}
