/* ================================================================
   Tolibi Ilm CRM — AURORA PREMIUM THEME v3.0
   Modern SaaS Dashboard Design (2025+ Trend)
   ================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* ====================== DARK MODE (Default) ====================== */
:root {
    --bg-main: #06070a;
    --bg-surface: rgba(16, 18, 27, 0.75);
    --bg-card: rgba(22, 27, 45, 0.65);
    --bg-card-solid: #141929;
    --border-color: rgba(99, 102, 241, 0.08);
    --border-glow: rgba(99, 102, 241, 0.2);
    --text-primary: #eef2ff;
    --text-secondary: #a5b4cf;
    --text-muted: #5f6e87;
    --text-table-cell: #c7d2e0;
    --table-row-bg: rgba(22, 27, 45, 0.5);
    --table-row-hover-bg: rgba(30, 36, 60, 0.8);

    --accent-indigo: #818cf8;
    --accent-indigo-glow: rgba(129, 140, 248, 0.3);
    --accent-violet: #a78bfa;
    --accent-emerald: #34d399;
    --accent-emerald-glow: rgba(52, 211, 153, 0.2);
    --accent-rose: #fb7185;
    --accent-rose-glow: rgba(251, 113, 133, 0.2);
    --accent-amber: #fbbf24;
    --accent-sky: #38bdf8;

    --input-bg: rgba(10, 12, 20, 0.7);
    --input-bg-focus: rgba(10, 12, 20, 0.95);
    --input-group-bg: rgba(30, 36, 60, 0.8);

    --btn-secondary-bg: rgba(255, 255, 255, 0.04);
    --btn-secondary-hover-bg: rgba(255, 255, 255, 0.08);
    --btn-secondary-hover-border: rgba(129, 140, 248, 0.3);
    --btn-outline-hover-bg: rgba(129, 140, 248, 0.08);

    --dropdown-bg: #151a2e;
    --dropdown-border: rgba(99, 102, 241, 0.15);

    --card-shadow: 0 4px 24px -4px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(99, 102, 241, 0.04);
    --card-hover-shadow: 0 8px 40px -8px rgba(99, 102, 241, 0.2), 0 0 0 1px rgba(99, 102, 241, 0.12);

    --gradient-primary: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #c084fc 100%);
    --gradient-sidebar: linear-gradient(180deg, #0a0d18 0%, #0e1225 50%, #111733 100%);

    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Sidebar */
    --sb-bg: #0a0d18;
    --sb-border: rgba(99, 102, 241, 0.06);
    --sb-text-primary: #eef2ff;
    --sb-text-secondary: #7a8aaa;
    --sb-hover-bg: rgba(129, 140, 248, 0.06);
    --sb-active-bg: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
    --sb-active-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

/* ====================== LIGHT MODE ====================== */
[data-theme="light"] {
    --bg-main: #f0f2f8;
    --bg-surface: rgba(255, 255, 255, 0.7);
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-card-solid: #ffffff;
    --border-color: rgba(99, 102, 241, 0.1);
    --border-glow: rgba(99, 102, 241, 0.25);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-table-cell: #334155;
    --table-row-bg: rgba(255, 255, 255, 0.7);
    --table-row-hover-bg: rgba(238, 242, 255, 0.9);

    --accent-indigo: #6366f1;
    --accent-indigo-glow: rgba(99, 102, 241, 0.15);
    --accent-violet: #7c3aed;
    --accent-emerald: #059669;
    --accent-emerald-glow: rgba(5, 150, 105, 0.1);
    --accent-rose: #e11d48;
    --accent-rose-glow: rgba(225, 29, 72, 0.1);
    --accent-amber: #d97706;
    --accent-sky: #0284c7;

    --input-bg: rgba(255, 255, 255, 0.9);
    --input-bg-focus: #ffffff;
    --input-group-bg: #e2e8f0;

    --btn-secondary-bg: rgba(99, 102, 241, 0.04);
    --btn-secondary-hover-bg: rgba(99, 102, 241, 0.08);
    --btn-secondary-hover-border: rgba(99, 102, 241, 0.3);
    --btn-outline-hover-bg: rgba(99, 102, 241, 0.06);

    --dropdown-bg: #ffffff;
    --dropdown-border: rgba(99, 102, 241, 0.12);

    --card-shadow: 0 4px 20px -4px rgba(99, 102, 241, 0.08), 0 0 0 1px rgba(99, 102, 241, 0.06);
    --card-hover-shadow: 0 8px 32px -4px rgba(99, 102, 241, 0.12), 0 0 0 1px rgba(99, 102, 241, 0.15);

    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #7c3aed 50%, #9333ea 100%);
    --gradient-sidebar: linear-gradient(180deg, #0a0d18 0%, #0e1225 50%, #111733 100%);
}

/* ====================== BASE ====================== */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    margin: 0;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* ---- Aurora Gradient Background (DARK) ---- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background:
        radial-gradient(ellipse 120% 60% at 10% 0%, rgba(99, 102, 241, 0.18) 0%, transparent 50%),
        radial-gradient(ellipse 80% 50% at 90% 5%, rgba(168, 85, 247, 0.14) 0%, transparent 45%),
        radial-gradient(ellipse 60% 80% at 80% 90%, rgba(52, 211, 153, 0.07) 0%, transparent 40%),
        radial-gradient(ellipse 90% 40% at 5% 100%, rgba(56, 189, 248, 0.06) 0%, transparent 45%),
        radial-gradient(ellipse 40% 40% at 50% 50%, rgba(251, 113, 133, 0.04) 0%, transparent 50%),
        var(--bg-main);
    pointer-events: none;
}

/* ---- Animated Aurora Orbs ---- */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background:
        radial-gradient(circle 400px at 10% 15%, rgba(99, 102, 241, 0.12) 0%, transparent 100%),
        radial-gradient(circle 300px at 90% 10%, rgba(168, 85, 247, 0.08) 0%, transparent 100%),
        radial-gradient(circle 350px at 80% 80%, rgba(52, 211, 153, 0.06) 0%, transparent 100%),
        radial-gradient(circle 250px at 15% 90%, rgba(56, 189, 248, 0.05) 0%, transparent 100%);
    animation: auroraFloat 20s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes auroraFloat {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    25% { transform: translate(20px, -15px) scale(1.03) rotate(0.5deg); }
    50% { transform: translate(-15px, 20px) scale(0.97) rotate(-0.5deg); }
    75% { transform: translate(10px, 10px) scale(1.02) rotate(0.3deg); }
    100% { transform: translate(-5px, -10px) scale(1) rotate(0deg); }
}

/* ---- Noise Texture for depth ---- */
.main-wrapper::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
    pointer-events: none;
}

/* Light mode aurora — softer, pastel */
[data-theme="light"] body::before {
    background:
        radial-gradient(ellipse 120% 60% at 10% 0%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse 80% 50% at 90% 5%, rgba(168, 85, 247, 0.07) 0%, transparent 45%),
        radial-gradient(ellipse 60% 80% at 80% 90%, rgba(52, 211, 153, 0.05) 0%, transparent 40%),
        radial-gradient(ellipse 90% 40% at 5% 100%, rgba(56, 189, 248, 0.04) 0%, transparent 45%),
        var(--bg-main);
}

[data-theme="light"] body::after {
    background:
        radial-gradient(circle 400px at 10% 15%, rgba(99, 102, 241, 0.06) 0%, transparent 100%),
        radial-gradient(circle 300px at 90% 10%, rgba(168, 85, 247, 0.04) 0%, transparent 100%),
        radial-gradient(circle 350px at 80% 80%, rgba(52, 211, 153, 0.03) 0%, transparent 100%),
        radial-gradient(circle 250px at 15% 90%, rgba(56, 189, 248, 0.03) 0%, transparent 100%);
}

[data-theme="light"] .main-wrapper::before {
    opacity: 0.012;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    font-weight: 600;
}

/* ====================== GLASSMORPHISM CARD ====================== */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

/* Subtle top highlight line */
.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(129, 140, 248, 0.3), transparent);
    pointer-events: none;
}

.glass-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--card-hover-shadow);
    transform: translateY(-3px);
}

/* Table/list cards should not hover-shift */
.glass-card.p-0 {
    overflow: hidden;
}

.glass-card.p-0:hover {
    transform: none;
}

/* ====================== SIDEBAR ====================== */
.sidebar {
    background: var(--gradient-sidebar);
    border-right: 1px solid var(--sb-border);
    height: 100vh;
    overflow-y: auto;
    transition: var(--transition-smooth);
    width: 260px;
    position: fixed;
    z-index: 1000;
}

/* Sidebar inner glow */
.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, rgba(129, 140, 248, 0.15), transparent 30%, transparent 70%, rgba(129, 140, 248, 0.08));
    pointer-events: none;
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(129, 140, 248, 0.15);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(129, 140, 248, 0.3);
}

.sidebar-brand {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: 0.5px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    padding: 1.8rem 1.5rem;
    display: block;
    text-decoration: none;
}

.nav-menu {
    list-style: none;
    padding: 0 1rem 2rem 1rem;
    margin: 0;
}

.nav-item {
    margin-bottom: 0.3rem;
}

.nav-link-custom {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--sb-text-secondary);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.92rem;
    transition: var(--transition-smooth);
    position: relative;
}

.nav-link-custom i {
    font-size: 1.1rem;
    width: 22px;
    margin-right: 12px;
    transition: var(--transition-smooth);
}

.nav-link-custom:hover {
    color: var(--sb-text-primary);
    background-color: var(--sb-hover-bg);
}

.nav-link-custom:hover i {
    color: var(--accent-indigo);
}

.nav-link-custom.active {
    color: #ffffff;
    background: var(--sb-active-bg);
    box-shadow: var(--sb-active-shadow);
    font-weight: 600;
}

.nav-link-custom.active i {
    color: #ffffff;
}

/* ====================== MAIN CONTENT ====================== */
.main-wrapper {
    margin-left: 260px;
    padding: 2rem;
    min-height: 100vh;
    transition: var(--transition-smooth);
    position: relative;
}

@media (max-width: 991.98px) {
    .sidebar {
        margin-left: -260px;
    }
    .sidebar.active {
        margin-left: 0;
    }
    .main-wrapper {
        margin-left: 0;
        padding: 1rem;
    }
}

/* ====================== FORM STYLING ====================== */
.form-control-custom {
    background-color: var(--input-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 12px;
    padding: 0.65rem 1rem;
    transition: var(--transition-smooth);
    font-size: 0.93rem;
}

.form-control-custom:focus {
    background-color: var(--input-bg-focus) !important;
    border-color: var(--accent-indigo) !important;
    box-shadow: 0 0 0 3px var(--accent-indigo-glow), 0 0 20px -5px rgba(99, 102, 241, 0.2) !important;
    outline: none;
    color: var(--text-primary) !important;
}

.form-control-custom::placeholder {
    color: var(--text-muted) !important;
}

.form-label-custom {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.88rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}

/* Input group addons */
.input-group-text {
    background-color: var(--input-group-bg) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
    border-radius: 12px;
}

/* ====================== CUSTOM TABLE ====================== */
.table-custom {
    color: var(--text-primary);
    border-collapse: separate;
    border-spacing: 0 6px;
    --bs-table-bg: transparent !important;
    --bs-table-hover-bg: transparent !important;
    --bs-table-hover-color: inherit !important;
    --bs-table-color: inherit !important;
}

.table-custom thead th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 1.2px;
    border: none;
    padding: 0.85rem 1rem;
    background-color: transparent !important;
}

.table-custom tbody tr {
    background: var(--table-row-bg) !important;
    transition: var(--transition-smooth);
}

.table-custom tbody tr:hover {
    background: var(--table-row-hover-bg) !important;
    transform: scale(1.003);
    box-shadow: 0 0 30px -10px rgba(99, 102, 241, 0.1);
}

/* Table cell text — always readable */
.table-custom tbody td {
    padding: 0.9rem 1rem;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    background-color: transparent !important;
    color: var(--text-table-cell) !important;
    font-size: 0.9rem;
}

.table-custom tbody tr:hover td {
    color: var(--text-table-cell) !important;
}

.table-custom tbody td:first-child {
    border-left: 1px solid var(--border-color);
    border-top-left-radius: 14px;
    border-bottom-left-radius: 14px;
}

.table-custom tbody td:last-child {
    border-right: 1px solid var(--border-color);
    border-top-right-radius: 14px;
    border-bottom-right-radius: 14px;
}

/* Explicit text colors in table cells */
.table-custom td .fw-bold,
.table-custom td .text-white {
    color: var(--text-primary) !important;
}

.table-custom td .text-muted,
.table-custom td small.text-muted {
    color: var(--text-muted) !important;
}

.table-custom td .text-white-50,
.table-custom td small.text-white-50 {
    color: var(--text-secondary) !important;
}

.table-custom td .text-success {
    color: var(--accent-emerald) !important;
}

.table-custom td .text-danger {
    color: var(--accent-rose) !important;
}

.table-custom td .text-secondary {
    color: var(--text-secondary) !important;
}

.table-custom td .text-info {
    color: var(--accent-sky) !important;
}

.table-custom td .text-warning {
    color: var(--accent-amber) !important;
}

/* ====================== BADGES ====================== */
.badge-custom {
    padding: 0.4em 0.8em;
    font-weight: 600;
    border-radius: 10px;
    font-size: 0.78rem;
    letter-spacing: 0.01em;
}

.badge-custom-success {
    background-color: rgba(52, 211, 153, 0.12);
    color: var(--accent-emerald) !important;
    border: 1px solid rgba(52, 211, 153, 0.25);
}

.badge-custom-danger {
    background-color: rgba(251, 113, 133, 0.12);
    color: var(--accent-rose) !important;
    border: 1px solid rgba(251, 113, 133, 0.25);
}

.badge-custom-warning {
    background-color: rgba(251, 191, 36, 0.12);
    color: var(--accent-amber) !important;
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.badge-custom-info {
    background-color: rgba(129, 140, 248, 0.12);
    color: var(--accent-indigo) !important;
    border: 1px solid rgba(129, 140, 248, 0.25);
}

/* ====================== BUTTONS ====================== */
.btn-custom-primary {
    background: var(--gradient-primary);
    color: #ffffff !important;
    border: none;
    border-radius: 12px;
    padding: 0.6rem 1.3rem;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px var(--accent-indigo-glow);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

/* Shine effect on primary button */
.btn-custom-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: 0.5s;
}

.btn-custom-primary:hover::after {
    left: 100%;
}

.btn-custom-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.5);
    color: #ffffff !important;
}

.btn-custom-secondary {
    background: var(--btn-secondary-bg);
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.6rem 1.3rem;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}

.btn-custom-secondary:hover {
    background: var(--btn-secondary-hover-bg) !important;
    border-color: var(--btn-secondary-hover-border) !important;
    color: var(--text-primary) !important;
}

/* Action icon buttons */
.btn-outline-light {
    color: var(--text-secondary) !important;
    border-color: transparent !important;
    border-radius: 10px;
    transition: var(--transition-smooth);
}

.btn-outline-light:hover {
    background-color: var(--btn-outline-hover-bg) !important;
    color: var(--text-primary) !important;
}

.btn-outline-light i.text-info {
    color: var(--accent-sky) !important;
}
.btn-outline-light i.text-warning {
    color: var(--accent-amber) !important;
}
.btn-outline-light i.text-danger {
    color: var(--accent-rose) !important;
}

/* ====================== STATS CARDS ====================== */
.stats-card {
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: -60%;
    right: -40%;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-indigo-glow) 0%, transparent 70%);
    z-index: 0;
}

.stats-icon {
    font-size: 2.2rem;
    margin-bottom: 1rem;
    display: inline-block;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ====================== ATTENDANCE ====================== */
.attendance-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    border: 2px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    transition: var(--transition-bounce);
}

.attendance-btn-present {
    border-color: var(--accent-emerald);
    color: var(--accent-emerald);
}

.attendance-btn-present.active {
    background-color: var(--accent-emerald);
    color: #fff;
    box-shadow: 0 0 20px var(--accent-emerald-glow);
    transform: scale(1.05);
}

.attendance-btn-absent {
    border-color: var(--accent-rose);
    color: var(--accent-rose);
}

.attendance-btn-absent.active {
    background-color: var(--accent-rose);
    color: #fff;
    box-shadow: 0 0 20px var(--accent-rose-glow);
    transform: scale(1.05);
}

/* ====================== LIGHT MODE TEXT OVERRIDES ====================== */
[data-theme="light"] .text-white {
    color: var(--text-primary) !important;
}

[data-theme="light"] .text-white-50 {
    color: var(--text-secondary) !important;
}

/* Badge colors stay consistent */
[data-theme="light"] .badge-custom-success { color: var(--accent-emerald) !important; }
[data-theme="light"] .badge-custom-danger { color: var(--accent-rose) !important; }
[data-theme="light"] .badge-custom-warning { color: var(--accent-amber) !important; }
[data-theme="light"] .badge-custom-info { color: var(--accent-indigo) !important; }

/* Primary button always white text */
[data-theme="light"] .btn-custom-primary { color: #ffffff !important; }

/* Avatar circle */
[data-theme="light"] .avatar-circle,
[data-theme="light"] .user-profile .rounded-circle,
[data-theme="light"] .rounded-circle.bg-secondary.text-white,
[data-theme="light"] .rounded-circle.bg-secondary.text-white * {
    color: #ffffff !important;
}

/* Light mode dropdown */
[data-theme="light"] .dropdown-menu-dark {
    background-color: var(--dropdown-bg) !important;
    border-color: var(--dropdown-border) !important;
    box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .dropdown-menu-dark .dropdown-item {
    color: var(--text-primary) !important;
}

[data-theme="light"] .dropdown-menu-dark .dropdown-item:hover,
[data-theme="light"] .dropdown-menu-dark .dropdown-item:focus {
    background-color: rgba(99, 102, 241, 0.08) !important;
}

[data-theme="light"] .dropdown-menu-dark .dropdown-item.active {
    background-color: rgba(99, 102, 241, 0.12) !important;
}

[data-theme="light"] .dropdown-menu-dark .dropdown-divider {
    border-color: var(--border-color) !important;
}

/* Light mode header username */
[data-theme="light"] .user-profile .fw-semibold.text-white {
    color: var(--text-primary) !important;
}

/* Light mode card top highlight */
[data-theme="light"] .glass-card::before {
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.15), transparent);
}

/* ====================== SELECT OPTIONS ====================== */
.form-select.form-control-custom option {
    background-color: var(--bg-main);
    color: var(--text-primary);
}

[data-theme="light"] .form-select.form-control-custom option {
    background-color: #ffffff;
    color: #0f172a;
}

/* ====================== SCROLLBAR (Global) ====================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(129, 140, 248, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(129, 140, 248, 0.3);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.15);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.3);
}

/* ====================== SELECTION COLOR ====================== */
::selection {
    background: rgba(129, 140, 248, 0.3);
    color: var(--text-primary);
}

[data-theme="light"] ::selection {
    background: rgba(99, 102, 241, 0.2);
}

/* ====================== PHASE 1: TOAST NOTIFICATIONS ====================== */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast-notification {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-radius: 14px;
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 400px;
}

.toast-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-notification.hiding {
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s ease-in;
}

.toast-success {
    background: rgba(52, 211, 153, 0.12);
    border-color: rgba(52, 211, 153, 0.3);
}
.toast-success i { color: var(--accent-emerald); }

.toast-error {
    background: rgba(251, 113, 133, 0.12);
    border-color: rgba(251, 113, 133, 0.3);
}
.toast-error i { color: var(--accent-rose); }

.toast-warning {
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.3);
}
.toast-warning i { color: var(--accent-amber); }

.toast-info {
    background: rgba(129, 140, 248, 0.12);
    border-color: rgba(129, 140, 248, 0.3);
}
.toast-info i { color: var(--accent-indigo); }

/* ====================== PHASE 1: SIDEBAR SECTION LABELS ====================== */
.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    color: var(--text-muted);
    padding: 1.2rem 1rem 0.4rem 1rem;
    display: block;
}

.nav-link-custom.active {
    border-left: 3px solid rgba(255,255,255,0.8);
}

/* Count badge in sidebar */
.nav-count-badge {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(129, 140, 248, 0.15);
    color: var(--accent-indigo);
    padding: 2px 8px;
    border-radius: 99px;
    min-width: 22px;
    text-align: center;
}

/* Sidebar user card */
.sidebar-user-card {
    margin: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-user-info {
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ====================== PHASE 1: TABLE MICRO-INTERACTIONS ====================== */
.table-custom tbody tr {
    border-left: 3px solid transparent;
}

.table-custom tbody tr:hover {
    border-left-color: var(--accent-indigo);
}

.table-custom tbody td:first-child {
    border-left: none;
}

/* Status pill badges */
.status-pill {
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.status-pill-active {
    background: rgba(52, 211, 153, 0.12);
    color: var(--accent-emerald);
    border: 1px solid rgba(52, 211, 153, 0.25);
}

.status-pill-active::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-emerald);
    animation: statusPulse 2s ease-in-out infinite;
}

.status-pill-inactive {
    background: rgba(251, 113, 133, 0.12);
    color: var(--accent-rose);
    border: 1px solid rgba(251, 113, 133, 0.25);
}

.status-pill-inactive::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-rose);
}

.status-pill-new {
    background: rgba(56, 189, 248, 0.12);
    color: var(--accent-sky);
    border: 1px solid rgba(56, 189, 248, 0.25);
}

.status-pill-called {
    background: rgba(251, 191, 36, 0.12);
    color: var(--accent-amber);
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.status-pill-registered {
    background: rgba(52, 211, 153, 0.12);
    color: var(--accent-emerald);
    border: 1px solid rgba(52, 211, 153, 0.25);
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Row avatar initials circle */
.row-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* Monospace phone numbers */
.phone-mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.82rem;
    letter-spacing: -0.02em;
}

/* ====================== PHASE 1: KPI DASHBOARD CARDS ====================== */
.kpi-card {
    position: relative;
    overflow: hidden;
}

.kpi-card .kpi-value {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
}

.kpi-card .kpi-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.kpi-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 8px;
}

.kpi-trend-up {
    background: rgba(52, 211, 153, 0.1);
    color: var(--accent-emerald);
}

.kpi-trend-down {
    background: rgba(251, 113, 133, 0.1);
    color: var(--accent-rose);
}

.kpi-progress-bar {
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.06);
    overflow: hidden;
    margin-top: 0.75rem;
}

.kpi-progress-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--gradient-primary);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====================== PHASE 2: EMPTY STATES ====================== */
.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.empty-state h5 {
    font-family: 'Outfit', sans-serif;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    max-width: 360px;
    margin: 0 auto 1.5rem;
    font-size: 0.9rem;
}

/* ====================== PHASE 2: SKELETON SHIMMER ====================== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-card) 25%,
        rgba(129, 140, 248, 0.06) 50%,
        var(--bg-card) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.8s ease-in-out infinite;
    border-radius: 8px;
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 6px;
}

.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-50 { width: 50%; }
.skeleton-text.w-25 { width: 25%; }

.skeleton-card {
    height: 120px;
    border-radius: 20px;
}

.skeleton-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ====================== PHASE 2: MOBILE RESPONSIVE TABLES ====================== */
@media (max-width: 768px) {
    .table-responsive-cards thead {
        display: none;
    }

    .table-responsive-cards tbody tr {
        display: flex;
        flex-direction: column;
        padding: 1rem;
        margin-bottom: 0.5rem;
        border-radius: 16px !important;
        background: var(--bg-card) !important;
        border: 1px solid var(--border-color) !important;
        border-left: 3px solid transparent !important;
    }

    .table-responsive-cards tbody tr:hover {
        border-left-color: var(--accent-indigo) !important;
    }

    .table-responsive-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.35rem 0 !important;
        border: none !important;
        border-radius: 0 !important;
        font-size: 0.88rem;
    }

    .table-responsive-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        flex-shrink: 0;
        margin-right: 1rem;
    }

    .table-responsive-cards tbody td:last-child {
        border-top: 1px solid var(--border-color) !important;
        margin-top: 0.5rem;
        padding-top: 0.75rem !important;
        justify-content: flex-end;
    }
}

/* ====================== PHASE 2: BREADCRUMB ====================== */
.breadcrumb-custom {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 0.82rem;
}

.breadcrumb-custom .breadcrumb-item a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-custom .breadcrumb-item a:hover {
    color: var(--accent-indigo);
}

.breadcrumb-custom .breadcrumb-item.active {
    color: var(--text-secondary);
}

.breadcrumb-custom .breadcrumb-item + .breadcrumb-item::before {
    content: '›';
    color: var(--text-muted);
    font-weight: 600;
}

/* ====================== PHASE 3: SMOOTH THEME TRANSITIONS ====================== */
body,
.glass-card,
.sidebar,
.table-custom,
.table-custom tbody tr,
.table-custom tbody td,
.form-control-custom,
.form-select,
.btn-custom-secondary,
.breadcrumb-custom,
input, select, textarea,
.nav-link-custom,
.stats-card,
.badge-custom,
header {
    transition: background-color 0.35s ease,
                color 0.35s ease,
                border-color 0.35s ease,
                box-shadow 0.35s ease;
}

/* ====================== PHASE 3: STUDENT PROFILE HERO ====================== */
.profile-hero {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.profile-avatar-lg {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 1.5rem;
    font-family: 'Outfit', sans-serif;
    flex-shrink: 0;
    box-shadow: 0 4px 20px var(--accent-indigo-glow);
}

.profile-info h3 {
    margin-bottom: 0.25rem;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
}

.profile-meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.profile-meta-item i {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.profile-stat-card {
    text-align: center;
    padding: 0.75rem;
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
}

.profile-stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
}

.profile-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Profile tabs */
.profile-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    margin: 0 -1.5rem;
    padding: 0 1.5rem;
}

.profile-tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.profile-tab:hover {
    color: var(--text-primary);
}

.profile-tab.active {
    color: var(--accent-indigo);
    border-bottom-color: var(--accent-indigo);
    font-weight: 600;
}

/* ====================== PHASE 3: COMMAND PALETTE ====================== */
.cmd-palette-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.cmd-palette-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cmd-palette {
    width: 100%;
    max-width: 560px;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-glow);
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
    overflow: hidden;
    transform: translateY(-10px) scale(0.98);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cmd-palette-overlay.active .cmd-palette {
    transform: translateY(0) scale(1);
}

.cmd-palette-input {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    outline: none;
    border-bottom: 1px solid var(--border-color);
}

.cmd-palette-input::placeholder {
    color: var(--text-muted);
}

.cmd-palette-results {
    max-height: 320px;
    overflow-y: auto;
    padding: 0.5rem;
}

.cmd-palette-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.15s;
    cursor: pointer;
}

.cmd-palette-item:hover,
.cmd-palette-item.selected {
    background: rgba(129, 140, 248, 0.08);
    color: var(--text-primary);
}

.cmd-palette-item i {
    width: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.cmd-palette-item span {
    font-size: 0.9rem;
}

.cmd-palette-shortcut {
    font-size: 0.7rem;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 2px 6px;
    border-radius: 6px;
    margin-left: auto;
}

/* ====================== PHASE 3: FORM FLOATING LABELS ====================== */
.form-floating-custom {
    position: relative;
}

.form-floating-custom input,
.form-floating-custom select,
.form-floating-custom textarea {
    padding-top: 1.5rem;
    padding-bottom: 0.5rem;
}

.form-floating-custom label {
    position: absolute;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 1;
}

.form-floating-custom input:focus ~ label,
.form-floating-custom input:not(:placeholder-shown) ~ label,
.form-floating-custom select:focus ~ label,
.form-floating-custom textarea:focus ~ label,
.form-floating-custom textarea:not(:placeholder-shown) ~ label {
    top: 0.4rem;
    left: 0.85rem;
    transform: none;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-indigo);
}

/* ====================== PRINT STYLES ====================== */
@media print {
    .sidebar, .no-print, header, .toast-container, .cmd-palette-overlay { display: none !important; }
    .main-wrapper { margin-left: 0 !important; padding: 0 !important; }
    .glass-card { box-shadow: none !important; border: 1px solid #ddd !important; }
    body::before, body::after, .main-wrapper::before { display: none !important; }
}
