/* ===========================================================
   BNI Ottrumai Connections CRM – UI/UX Overhaul
   Primary: BNI BLUE   Secondary: BNI RED
   =========================================================== */

:root {
    --bni-blue: #0d6efd;
    --bni-blue-dark: #0a58ca;
    --bni-blue-light: #e7f1ff;
    --bni-red: #d6202e;
    --bni-red-dark: #a81823;
    --bni-bg: #f4f6fa;
    --bni-sidebar: #1e293b;
    --bni-sidebar-hover: #334155;
    --bni-text: #1f2937;
    --bni-text-muted: #64748b;
    --bni-border: #e2e8f0;
    --bni-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --bni-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

/* ---- Base ---- */
body.app-body {
    background: var(--bni-bg);
    font-family: 'Inter', 'Segoe UI', Roboto, system-ui, sans-serif;
    color: var(--bni-text);
    -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---- Navbar ---- */
.bni-navbar {
    background: linear-gradient(90deg, var(--bni-blue-dark) 0%, var(--bni-blue) 100%);
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}
.bni-navbar .badge.bg-danger { background: var(--bni-red) !important; }
.bni-navbar .btn-outline-light:hover { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.25); }

/* ---- Sidebar ---- */
.sidebar {
    background: var(--bni-sidebar) !important;
    box-shadow: inset -4px 0 10px rgba(0,0,0,.1);
}
.sidebar .nav-link {
    color: #cbd5e1 !important;
    border-radius: 8px;
    margin: 2px 12px;
    padding: .6rem .8rem;
    transition: all .2s ease;
    font-size: .9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
}
.sidebar .nav-link i { font-size: 1.1rem; margin-right: .8rem; width: 20px; text-align: center; }
.sidebar .nav-link:hover {
    background: var(--bni-sidebar-hover);
    color: #fff !important;
}
.sidebar .nav-link.active {
    background: var(--bni-blue) !important;
    color: #fff !important;
    box-shadow: 0 4px 6px rgba(13, 110, 253, .3);
}
.sidebar .nav-link.text-warning { color: #fbbf24 !important; }
.sidebar .nav-link.text-warning.active { background: var(--bni-red) !important; color: #fff !important; box-shadow: 0 4px 6px rgba(214, 32, 46, .3); }

/* Mobile Backdrop */
.sidebar-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,.5); z-index: 1040; display: none;
}
.sidebar-backdrop.show { display: block; }

/* ---- Cards ---- */
.card {
    border: 1px solid var(--bni-border);
    border-radius: .8rem;
    box-shadow: var(--bni-shadow);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--bni-border);
    font-weight: 600;
    padding: 1rem 1.25rem;
    border-top-left-radius: .8rem !important;
    border-top-right-radius: .8rem !important;
}

/* ---- Dashboard stat cards ---- */
.stat-card {
    border-left: 4px solid var(--bni-blue);
    transition: transform .2s, box-shadow .2s;
    border-radius: .8rem;
}
.stat-card:hover { 
    transform: translateY(-3px); 
    box-shadow: var(--bni-shadow-lg); 
}
.stat-card.bg-warning { border-left-color: #ffc107; }
.stat-card.bg-danger  { border-left-color: var(--bni-red); }
.stat-card.bg-success { border-left-color: #198754; }
.stat-card.bg-info    { border-left-color: #0dcaf0; }

.stat-card .stat-icon {
    width: 50px; height: 50px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
    font-size: 1.5rem;
    opacity: .9;
}

/* ---- Tables ---- */
.table thead th {
    background: #f8fafc;
    color: var(--bni-text-muted);
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 2px solid var(--bni-border);
    padding: 12px 16px;
}
.table-hover tbody tr { transition: background-color .15s; }
.table-hover tbody tr:hover { background: var(--bni-blue-light) !important; }

/* ---- Badges ---- */
.badge { font-weight: 600; padding: .45em .8em; border-radius: .35rem; font-size: .75rem; }

/* ---- Buttons ---- */
.btn { font-weight: 500; border-radius: .4rem; transition: all .15s; }
.btn-primary { --bs-btn-bg: var(--bni-blue); --bs-btn-border-color: var(--bni-blue); }
.btn-primary:hover { --bs-btn-hover-bg: var(--bni-blue-dark); --bs-btn-hover-border-color: var(--bni-blue-dark); transform: translateY(-1px); }
.btn-danger { --bs-btn-bg: var(--bni-red); --bs-btn-border-color: var(--bni-red); }
.btn-danger:hover { --bs-btn-hover-bg: var(--bni-red-dark); --bs-btn-hover-border-color: var(--bni-red-dark); }
.btn-outline-primary { color: var(--bni-blue); border-color: var(--bni-blue); }
.btn-outline-primary:hover { background-color: var(--bni-blue); border-color: var(--bni-blue); }

/* ---- Avatars ---- */
.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bni-blue-light);
    color: var(--bni-blue); 
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,.05);
}
.avatar-lg { width: 80px; height: 80px; font-size: 1.5rem; }

/* ---- Auth Pages ---- */
.auth-wrapper {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--bni-blue-dark) 0%, var(--bni-red-dark) 100%);
    padding: 1rem;
}
.auth-card {
    width: 100%; max-width: 420px;
    background: #fff; border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

/* ---- Empty States ---- */
.empty-state {
    text-align: center; padding: 3rem 1rem; color: var(--bni-text-muted);
}
.empty-state i { font-size: 4rem; color: #cbd5e1; }

/* ---- Timeline ---- */
.timeline { position: relative; padding-left: 30px; }
.timeline::before {
    content: ''; position: absolute; left: 10px; top: 0; bottom: 0;
    width: 2px; background: var(--bni-border);
}
.timeline-item { position: relative; margin-bottom: 1.5rem; }
.timeline-item::before {
    content: ''; position: absolute; left: -25px; top: 4px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--bni-blue); border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--bni-blue);
}

/* ---- Mobile Responsive ---- */
@media (max-width: 768px) {
    .sidebar { 
        position: fixed; top: 56px; bottom: 0; left: 0; 
        width: 260px; z-index: 1050; 
        transform: translateX(-100%); 
        transition: transform .3s ease-in-out;
    }
    .sidebar.show { transform: translateX(0); }
    .navbar-brand span.fw-bold { display: none; } /* Hide app name on very small screens */
}