/* ================================================================
   Insurance CRM — ARK Theme  (complete, production-ready)
   ================================================================ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
    --bg-main:        #0f1117;
    --bg-card:        #1a1d27;
    --bg-sidebar:     #13151f;
    --border:         #2a2d3e;
    --accent:         #4f6ef7;
    --accent-h:       #3d5ce6;
    --text:           #e2e8f0;
    --muted:          #6b7280;
    --sidebar-w:      240px;
    --radius:         12px;
    --radius-sm:      8px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body {
    background: var(--bg-main);
    color: var(--text);
    font-family: 'Inter', sans-serif;
}

/* ── Bootstrap overrides ────────────────────────────────────── */
.text-black, .text-dark, .text-body { color: var(--text) !important; }
.text-muted  { color: var(--muted)  !important; }
.text-primary{ color: var(--accent) !important; }
.text-success{ color: #22c55e !important; }
.text-danger { color: #f87171 !important; }
.text-warning{ color: #eab308 !important; }
.text-info   { color: #22d3ee !important; }

.bg-primary-subtle   { background: rgba(79,110,247,.15) !important; }
.bg-success-subtle   { background: rgba(34,197,94,.15)  !important; }
.bg-danger-subtle    { background: rgba(239,68,68,.15)  !important; }
.bg-warning-subtle   { background: rgba(234,179,8,.15)  !important; }
.bg-info-subtle      { background: rgba(6,182,212,.15)  !important; }
.bg-secondary-subtle { background: rgba(107,114,128,.15)!important; }

/* ── Layout ─────────────────────────────────────────────────── */


/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh; height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: sticky; top: 0;
    overflow-y: auto; flex-shrink: 0;
    display: flex; flex-direction: column;
}
.sidebar-brand {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.05rem; font-weight: 700; color: #fff;
    display: flex; align-items: center;
}
.sidebar-divider {
    border-color: var(--border);
    opacity: 1; margin: .5rem 0;
}
.sidebar .nav-link {
    color: var(--muted);
    border-radius: var(--radius-sm);
    padding: .45rem .75rem;
    font-size: .85rem;
    transition: background .15s, color .15s;
    display: flex; align-items: center; gap: .4rem;
    text-decoration: none;
}
.sidebar .nav-link:hover { background: rgba(79,110,247,.12); color: var(--accent); }
.sidebar .nav-link.active { background: rgba(79,110,247,.18); color: var(--accent); }
.sidebar .nav-link-danger { color: #f87171 !important; }
.sidebar .nav-link-danger:hover { background: rgba(239,68,68,.12) !important; color: #ef4444 !important; }

/* Chevron rotation when open */
.sidebar .menu-chevron { font-size: .7rem; transition: transform .2s; }
.sidebar .nav-link[aria-expanded="true"] .menu-chevron { transform: rotate(90deg); }

/* Sub-menu */
.sidebar .sub-menu {
    padding-left: .9rem;
    border-left: 2px solid var(--border);
    margin-left: .85rem;
}
.sidebar .sub-menu .nav-link { font-size: .8rem; padding: .35rem .6rem; }

/* Profile row */
.nav-profile-image {
    position: relative; width: 30px; height: 30px;
    border-radius: 50%; background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: .7rem; font-weight: 700; color: #fff;
}
.login-status {
    position: absolute; bottom: 0; right: 0;
    width: 8px; height: 8px; border-radius: 50%;
    border: 2px solid var(--bg-sidebar);
}
.login-status.online { background: #22c55e; }
.login-status.busy   { background: #ef4444; }
.sidebar-footer { color: var(--muted); font-size: .75rem; }

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    color: var(--text);
    position: sticky; top: 0; z-index: 100;
    height: 52px; min-height: 52px; max-height: 52px;
    overflow: visible;
}
.topbar h5 { color: var(--text) !important; }

/* Profile partial styles (used by _LoginPartial) */
.topbar .nav-item { list-style: none; }
.topbar .nav-link { padding: 0 !important; }
.topbar .nav-profile-img { display: flex; align-items: center; }
.topbar .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem; font-weight: 700; flex-shrink: 0;
}
.topbar .availability-status {
    width: 8px; height: 8px; border-radius: 50%;
    border: 2px solid var(--bg-card);
    margin-left: -10px; margin-top: 18px;
}
.topbar .availability-status.online { background: #22c55e; }
.topbar .nav-profile-text p { margin: 0; font-size: .85rem; color: var(--text); }
.topbar-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 700; color: #fff;
    cursor: pointer; transition: opacity .2s;
    user-select: none;
}
.topbar-avatar:hover { opacity: .85; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
}
.card-body { color: var(--text); }
.card-header, .card-footer {
    background: transparent;
    border-color: var(--border); color: var(--text);
}
.card.bg-dark, .card.bg-gradient-primary { background: var(--bg-card) !important; }
.card h2, .card h3, .card h4, .card h5, .card h6 { color: var(--text); }

/* Stat card hover */
.card-stat { transition: transform .2s, box-shadow .2s; cursor: default; }
.card-stat:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0,0,0,.45); }

/* Master-data card (clickable, from 21Apr) */
.edit-card {
    cursor: pointer;
    transition: transform .2s, box-shadow .2s, border-color .2s;
    border: 1px solid var(--border) !important;
}
.edit-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(79,110,247,.2);
    border-color: var(--accent) !important;
}
.card.bg-gradient-primary {
    background: linear-gradient(135deg, #1e2a5e 0%, #1a1d27 100%) !important;
    border: 1px solid rgba(79,110,247,.3) !important;
}
.card.bg-gradient-primary h4 { color: #fff; }

/* Stat icons */
.stat-icon {
    width: 42px; height: 42px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.bg-blue   { background: rgba(79,110,247,.15); color: #4f6ef7; }
.bg-green  { background: rgba(34,197,94,.15);  color: #22c55e; }
.bg-yellow { background: rgba(234,179,8,.15);  color: #eab308; }
.bg-purple { background: rgba(168,85,247,.15); color: #a855f7; }
.bg-red    { background: rgba(239,68,68,.15);  color: #ef4444; }

/* ── Tables ──────────────────────────────────────────────────── */
.table {
    --bs-table-bg:           transparent;
    --bs-table-color:        var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-hover-bg:     rgba(79,110,247,.06);
    --bs-table-hover-color:  var(--text);
    color: var(--text) !important;
}
.table thead th {
    color: var(--muted) !important;
    font-size: .73rem; text-transform: uppercase; letter-spacing: .06em;
    border-bottom-color: var(--border); background: var(--bg-card);
    font-weight: 600;
}
.table tbody td {
    color: var(--text) !important;
    border-color: var(--border); vertical-align: middle;
}
.table-hover tbody tr:hover td {
    background: rgba(79,110,247,.06) !important;
    color: var(--text) !important;
}
.table-outside-border { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.table-striped tbody tr:nth-of-type(odd) > * { --bs-table-accent-bg: rgba(255,255,255,.02); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-control, .form-select {
    background: #0c0e14 !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    border-radius: var(--radius-sm);
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 .2rem rgba(79,110,247,.22);
    color: var(--text) !important;
}
.form-control::placeholder { color: var(--muted); opacity: 1; }
.form-select option { background: #1a1d27; color: var(--text); }
.form-label, label { color: var(--text); font-size: .875rem; font-weight: 500; }
.form-group { margin-bottom: 1rem; }
.form-check-input { background-color: #0c0e14; border-color: var(--border); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-label { color: var(--text); }
.input-group-text { background: var(--bg-card); border-color: var(--border); color: var(--muted); }
.field-validation-error, .validation-summary-errors ul li { color: #f87171; font-size: .82rem; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary, .btn-gradient-primary {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #fff !important; border-radius: var(--radius-sm);
}
.btn-primary:hover, .btn-gradient-primary:hover {
    background: var(--accent-h) !important;
    border-color: var(--accent-h) !important;
}
.btn-outline-primary { border-color: var(--accent); color: var(--accent); border-radius: var(--radius-sm); }
.btn-outline-primary:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-success { background: #16a34a; border-color: #16a34a; color: #fff; border-radius: var(--radius-sm); }
.btn-danger  { background: #dc2626; border-color: #dc2626; color: #fff; border-radius: var(--radius-sm); }
.btn-warning { background: #d97706; border-color: #d97706; color: #fff; border-radius: var(--radius-sm); }
.btn-secondary { background: #374151; border-color: #374151; color: #fff; border-radius: var(--radius-sm); }
.btn-outline-secondary { border-color: var(--border); color: var(--muted); border-radius: var(--radius-sm); }
.btn-outline-secondary:hover { background: rgba(255,255,255,.06); color: var(--text); border-color: var(--muted); }
.btn-outline-danger { border-color: #dc2626; color: #f87171; border-radius: var(--radius-sm); }
.btn-outline-danger:hover { background: #dc2626; color: #fff; }
.btn-outline-success { border-color: #16a34a; color: #22c55e; border-radius: var(--radius-sm); }
.btn-outline-success:hover { background: #16a34a; color: #fff; }
.btn-light { background: rgba(255,255,255,.08); border-color: var(--border); color: var(--text); border-radius: var(--radius-sm); }
.btn-light:hover { background: rgba(255,255,255,.15); }

/* FA-class icon buttons (legacy CRM style) */
a.btn-sm.fa, a.btn-sm[class*="fa-"] {
    padding: .3rem .55rem; border-radius: 6px;
    text-decoration: none; display: inline-flex;
    align-items: center; justify-content: center;
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge-status { padding: .35em .75em; border-radius: 6px; font-size: .72rem; font-weight: 600; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert { border-radius: var(--radius-sm); }
.alert-success { background: rgba(34,197,94,.12);  color: #86efac; border-color: rgba(34,197,94,.25); }
.alert-danger  { background: rgba(239,68,68,.12);  color: #fca5a5; border-color: rgba(239,68,68,.25); }
.alert-warning { background: rgba(234,179,8,.12);  color: #fde68a; border-color: rgba(234,179,8,.25); }
.alert-info    { background: rgba(79,110,247,.12); color: #93c5fd; border-color: rgba(79,110,247,.25); }
.btn-close { filter: invert(1); opacity: .6; }
.btn-close:hover { opacity: 1; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text); border-radius: var(--radius);
}
.modal-header { border-bottom-color: var(--border); }
.modal-footer { border-top-color: var(--border); }
/* Bootstrap 4 close button compat */
button.close {
    background: none; border: none; font-size: 1.4rem;
    color: var(--muted); cursor: pointer; line-height: 1;
    padding: .25rem .5rem; opacity: .7;
}
button.close:hover { opacity: 1; color: var(--text); }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination .page-link { background: var(--bg-card); border-color: var(--border); color: var(--text); border-radius: 6px; }
.pagination .page-link:hover { background: rgba(79,110,247,.15); color: var(--accent); }
.pagination .page-item.active .page-link { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .page-item.disabled .page-link { background: var(--bg-card); color: var(--muted); }
.pager strong { color: var(--text); }

/* ── Dropdown ────────────────────────────────────────────────── */
.dropdown-menu {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.navbar-dropdown { min-width: 190px; padding: .5rem 0; }
.dropdown-item { color: var(--text); font-size: .85rem; padding: .5rem 1rem; }
.dropdown-item:hover { background: rgba(79,110,247,.12); color: var(--accent); }
.dropdown-divider { border-color: var(--border); }

/* ── Typography & links ──────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 { color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); }
hr { border-color: var(--border); opacity: 1; }
.font-monospace { color: var(--text); }
.fw-medium { font-weight: 500; }

/* dl-horizontal (Details pages) */
.dl-horizontal dt { float: left; width: 150px; clear: left; text-align: right; color: var(--muted); font-weight: 500; margin-bottom: .5rem; }
.dl-horizontal dd { margin-left: 170px; color: var(--text); margin-bottom: .5rem; }

/* ── Main content ────────────────────────────────────────────── */
.main-content { min-height: 100vh; background: var(--bg-main); overflow-x: hidden; }
.content-area { max-width: 1400px; }

/* ── Report expand rows ──────────────────────────────────────── */
.item-details td { background: var(--bg-main) !important; }
.item-details .card { background: var(--bg-card) !important; }
.item-details .card-header { background: rgba(79,110,247,.08) !important; border-color: rgba(79,110,247,.25) !important; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ================================================================
   LOGIN PAGE
   ================================================================ */
body.login-page {
    background: radial-gradient(ellipse at 60% 40%, #1a2550 0%, #0f1117 60%);
    align-items: center; justify-content: center;
    height: 100vh; overflow: hidden;
}
.login-wrapper {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.login-box { width: 100%; max-width: 420px; }

/* Logo circle */
.login-logo-circle {
    width: 72px; height: 72px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; color: #fff;
    box-shadow: 0 8px 32px rgba(79,110,247,.4);
}

/* Login card */
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-card h5 { color: var(--text); }
.login-card .form-label { color: var(--text); font-size: .875rem; font-weight: 500; }
.login-card .form-control {
    background: rgba(255,255,255,.04) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    border-radius: var(--radius-sm);
    padding: .65rem .9rem;
    font-size: .95rem;
}
.login-card .form-control:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 .2rem rgba(79,110,247,.22);
}
.login-card .form-control::placeholder { color: var(--muted); }
.login-card .btn-primary {
    padding: .7rem; font-size: 1rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 16px rgba(79,110,247,.35);
    transition: box-shadow .2s, transform .1s;
}
.login-card .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(79,110,247,.5);
    transform: translateY(-1px);
}
.login-card .form-check-label { color: var(--muted); font-size: .85rem; }
.login-card a { color: var(--accent); font-size: .85rem; }
.login-card a:hover { color: var(--accent-h); }
.login-card .alert { border-radius: var(--radius-sm); font-size: .85rem; }
