/* ==========================================================================
   Usama Laboratory - application styles (Bootstrap 5 base)
   ========================================================================== */
:root {
    --sidebar-width: 250px;
    --sidebar-bg: #2f353a;
    --sidebar-bg-hover: #3a4248;
    --sidebar-text: #c8ced3;
    --sidebar-active: #20a8d8;
    --brand: #2e6e69;
    --header-height: 56px;
    --page-bg: #f0f3f5;
}

body { background: var(--page-bg); font-size: .9rem; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-left: var(--sidebar-width); transition: margin-left .2s; }
.app-header {
    position: sticky; top: 0; z-index: 1020; height: var(--header-height);
    display: flex; align-items: center; gap: .5rem; padding: 0 1rem;
    background: #fff; border-bottom: 1px solid #d8dbe0;
}
.app-header-title { font-size: 1.1rem; font-weight: 600; margin: 0; color: #23282c; }
.app-content { padding: 1.25rem; flex: 1; }

/* ---------- Sidebar ---------- */
.app-sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); z-index: 1030;
    background: var(--sidebar-bg); color: var(--sidebar-text); overflow-y: auto;
    transition: transform .2s;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .6rem; height: var(--header-height); padding: 0 1rem;
    background: #fff; color: var(--brand); font-weight: 700; text-decoration: none; border-bottom: 1px solid #d8dbe0;
}
.sidebar-nav { padding: .5rem 0 2rem; }
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: .6rem; width: 100%; padding: .6rem 1rem;
    color: var(--sidebar-text); text-decoration: none; background: none; border: 0; text-align: left; font-weight: 600;
}
.sidebar-nav .nav-link:hover { background: var(--sidebar-bg-hover); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--sidebar-active); color: #fff; }
.sidebar-nav .nav-icon { width: 1.25rem; text-align: center; }
.nav-caret { margin-left: auto; font-size: .7rem; transition: transform .2s; }
.nav-group.open > .nav-group-toggle .nav-caret { transform: rotate(180deg); }
.nav-group-toggle.active { background: transparent; color: #fff; }
.nav-children { display: none; background: rgba(0,0,0,.15); }
.nav-group.open > .nav-children { display: block; }
.nav-children .nav-link { padding-left: 2.25rem; font-weight: 400; font-size: .85rem; }
.nav-children .nav-link.active { background: #e9ecef; color: #000; }
.nav-sub-icon { font-size: .55rem; width: .8rem; }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
    .app-main { margin-left: 0; }
    .app-sidebar { transform: translateX(-100%); }
    body.sidebar-open .app-sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 1025; background: rgba(0,0,0,.4); }
}
@media (min-width: 992px) {
    body.sidebar-collapsed .app-sidebar { transform: translateX(-100%); }
    body.sidebar-collapsed .app-main { margin-left: 0; }
}

/* ---------- Components ---------- */
.card { border-color: #d8dbe0; }
.card-header { background: #f7f8f9; font-weight: 600; }
.table th { white-space: nowrap; font-weight: 600; }
.table td { vertical-align: middle; }
.form-label { font-weight: 600; margin-bottom: .25rem; }
.required::after { content: " *"; color: #dc3545; }
.select2-container { width: 100% !important; }
.dt-buttons .btn { margin-right: .25rem; }

/* Test status badges (same colors everywhere) */
.status-badge { font-size: .75rem; font-weight: 600; padding: .3em .6em; border-radius: .25rem; color: #fff; white-space: nowrap; }
.status-process { background: #f0ad4e; }
.status-sample_required { background: #6f42c1; }
.status-verified { background: #28a745; }
.status-cancelled { background: #dc3545; }
.status-collectioncenter { background: #17a2b8; }
.status-dispatched { background: #007bff; }
.row-delayed { background: #fff3cd !important; }
.row-critical td { color: #c00; font-weight: 600; }

/* Stat tiles on dashboard */
.stat-tile { border: 0; border-radius: .5rem; color: #fff; }
.stat-tile .stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-tile .stat-label { opacity: .9; }

/* Auth pages */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--brand), #1b4a46); padding: 1rem; }
.auth-card { width: 100%; max-width: 400px; border: 0; border-radius: .75rem; box-shadow: 0 1rem 2rem rgba(0,0,0,.2); }

@media print {
    .app-sidebar, .app-header, .no-print, .dt-buttons, .dt-search, .dt-length, .dt-paging { display: none !important; }
    .app-main { margin: 0 !important; }
    .app-content { padding: 0; }
    body { background: #fff; }
}
