/* ==========================================================
 * MEDILAB DIAGNOSTIC ERP + LIS — ULTRA-MODERN NEXT-GEN UI
 * Inspired by Modern Medical SaaS, Tailwind & Glassmorphism
 * ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Hind+Siliguri:wght@400;500;600;700&display=swap');

:root {
    --bs-font-sans-serif: 'Plus Jakarta Sans', 'Hind Siliguri', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --sidebar-width: 260px;
    --primary: #0284c7;
    --primary-gradient: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
    --secondary-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --success-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --warning-gradient: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    --danger-gradient: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    --info-gradient: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #0284c7;
    --card-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
    --card-shadow-hover: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.03);
    --border-radius: 12px;
}

body {
    font-family: var(--bs-font-sans-serif);
    color: #1e293b;
    background-color: #f1f5f9;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
}

/* ==========================================================
 * MODERN SIDEBAR
 * ========================================================== */
#wrapper {
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
}

#sidebar-wrapper {
    min-height: 100vh;
    width: var(--sidebar-width);
    margin-left: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--sidebar-bg) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
}

.sidebar-heading {
    padding: 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
}

.sidebar-user {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.85rem 1.25rem;
}

.sidebar-user .avatar {
    width: 38px;
    height: 38px;
    background: var(--primary-gradient);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar-nav {
    padding: 0.75rem 0.5rem;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    padding: 1rem 1rem 0.35rem 1rem;
}

#sidebar-wrapper .list-group-item {
    background-color: transparent;
    color: #94a3b8;
    border: none;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    border-radius: 8px;
    margin: 2px 6px;
    transition: all 0.2s ease;
}

#sidebar-wrapper .list-group-item:hover {
    background-color: var(--sidebar-hover);
    color: #f8fafc;
    transform: translateX(3px);
}

#sidebar-wrapper .list-group-item.active {
    background: var(--primary-gradient) !important;
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

#sidebar-wrapper .list-group-item i {
    width: 22px;
    font-size: 1rem;
    margin-right: 0.5rem;
}

/* ==========================================================
 * TOPBAR NAVIGATION
 * ========================================================== */
.topbar-navbar {
    background: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.search-input-group {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.search-input-group:focus-within {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.12);
}

/* ==========================================================
 * KPI & METRIC CARDS
 * ========================================================== */
.kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover) !important;
    border-color: #cbd5e1;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0.8;
}

.kpi-card.border-success::before { background: var(--success-gradient); }
.kpi-card.border-warning::before { background: var(--warning-gradient); }
.kpi-card.border-danger::before { background: var(--danger-gradient); }
.kpi-card.border-info::before { background: var(--info-gradient); }

.kpi-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.bg-primary-soft { background: rgba(2, 132, 199, 0.1); color: #0284c7; }
.bg-success-soft { background: rgba(16, 185, 129, 0.1); color: #059669; }
.bg-warning-soft { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.bg-danger-soft { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.bg-info-soft { background: rgba(6, 182, 212, 0.1); color: #0891b2; }

/* ==========================================================
 * MODERN CARDS & PANELS
 * ========================================================== */
.card {
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    background: #ffffff;
    transition: all 0.2s ease;
}

.card-header {
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    padding: 1rem 1.25rem;
    font-weight: 600;
    border-top-left-radius: var(--border-radius) !important;
    border-top-right-radius: var(--border-radius) !important;
}

/* ==========================================================
 * TABLES
 * ========================================================== */
.table-modern {
    margin-bottom: 0;
}

.table-modern thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.85rem 1rem;
}

.table-modern tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 0.875rem;
}

.table-modern tbody tr:hover {
    background-color: #f8fafc;
}

/* ==========================================================
 * BUTTONS & CONTROLS
 * ========================================================== */
.btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.35);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success-gradient);
    border: none;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    padding: 0.55rem 0.85rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.15);
}

/* BADGES */
.badge {
    padding: 0.4em 0.65em;
    font-weight: 600;
    border-radius: 6px;
    letter-spacing: 0.02em;
}

.badge-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
}

/* ==========================================================
 * RESPONSIVE TOGGLES
 * ========================================================== */
#wrapper.toggled #sidebar-wrapper {
    margin-left: calc(-1 * var(--sidebar-width));
}

@media (max-width: 767.98px) {
    #sidebar-wrapper {
        margin-left: calc(-1 * var(--sidebar-width));
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 1045;
    }
    #wrapper.toggled #sidebar-wrapper {
        margin-left: 0;
    }
}