@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Modern Color Palette */
    --primary: #4f46e5; /* Indigo 600 */
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    
    --secondary: #64748b; /* Slate 500 */
    --secondary-light: #f1f5f9;
    
    --success: #10b981; /* Emerald 500 */
    --success-light: #d1fae5;
    
    --warning: #f59e0b; /* Amber 500 */
    --warning-light: #fef3c7;
    
    --danger: #ef4444; /* Red 500 */
    --danger-light: #fee2e2;
    
    --info: #0ea5e9; /* Sky 500 */
    --info-light: #e0f2fe;

    /* Neutrals */
    --bg-body: #f8fafc; /* Slate 50 */
    --bg-surface: #ffffff;
    --text-main: #0f172a; /* Slate 900 */
    --text-muted: #64748b; /* Slate 500 */
    --border-color: #e2e8f0; /* Slate 200 */

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 15px rgba(79, 70, 229, 0.3);

    /* Dimensions */
    --sidebar-width: 280px;
    --header-height: 70px;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    --bg-gradient-end: #e0e7ff;
}

[data-bs-theme="dark"] {
    /* Dark Mode Palette */
    --primary: #818cf8; /* Indigo 400 */
    --primary-hover: #a5b4fc;
    --primary-light: rgba(99, 102, 241, 0.15);
    
    --secondary: #94a3b8; /* Slate 400 */
    --secondary-light: rgba(148, 163, 184, 0.15);
    
    --success: #34d399; /* Emerald 400 */
    --success-light: rgba(52, 211, 153, 0.15);
    
    --warning: #fbbf24; /* Amber 400 */
    --warning-light: rgba(251, 191, 36, 0.15);
    
    --danger: #f87171; /* Red 400 */
    --danger-light: rgba(248, 113, 113, 0.15);
    
    --info: #38bdf8; /* Sky 400 */
    --info-light: rgba(56, 189, 248, 0.15);

    /* Neutrals */
    --bg-body: #0f172a; /* Slate 900 */
    --bg-surface: #1e293b; /* Slate 800 */
    --text-main: #f1f5f9; /* Slate 100 */
    --text-muted: #94a3b8; /* Slate 400 */
    --border-color: #334155; /* Slate 700 */

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --shadow-glow: 0 0 15px rgba(129, 140, 248, 0.2);
    
    --bg-gradient-end: #1e1b4b;
}

/* Dark Mode Utility Overrides */
[data-bs-theme="dark"] .bg-white { background-color: var(--bg-surface) !important; color: var(--text-main) !important; }
[data-bs-theme="dark"] .bg-light { background-color: rgba(255,255,255, 0.05) !important; color: var(--text-main) !important; }
[data-bs-theme="dark"] .text-dark { color: var(--text-main) !important; }
[data-bs-theme="dark"] .text-muted { color: var(--text-muted) !important; }
[data-bs-theme="dark"] .table-light { --bs-table-bg: rgba(255,255,255, 0.05); --bs-table-color: var(--text-main); }
[data-bs-theme="dark"] .card { background-color: var(--bg-surface); border-color: var(--border-color); }
[data-bs-theme="dark"] .card-header { border-bottom-color: var(--border-color); }
[data-bs-theme="dark"] .card-footer { border-top-color: var(--border-color); background-color: rgba(0,0,0,0.2); }
[data-bs-theme="dark"] .border { border-color: var(--border-color) !important; }
[data-bs-theme="dark"] .dropdown-menu { background-color: var(--bg-surface); border-color: var(--border-color); }
[data-bs-theme="dark"] .dropdown-item { color: var(--text-main); }
[data-bs-theme="dark"] .dropdown-item:hover { background-color: rgba(255,255,255, 0.05); }
[data-bs-theme="dark"] .modal-content { background-color: var(--bg-surface); border-color: var(--border-color); }
[data-bs-theme="dark"] .modal-header, [data-bs-theme="dark"] .modal-footer { border-color: var(--border-color); }
[data-bs-theme="dark"] .close { filter: invert(1) grayscale(100%) brightness(200%); }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* Reset & Base */
body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

[data-bs-theme="dark"] body {
    background-color: var(--bg-body) !important;
    color: var(--text-main) !important;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: all 0.2s ease;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

/* Layout Structure */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar (Desktop) */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

[data-bs-theme="dark"] .app-sidebar {
    background-color: var(--bg-surface) !important;
    border-right-color: var(--border-color) !important;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.app-brand {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-brand i {
    font-size: 1.5rem;
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

.sidebar-content {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    margin: 1.5rem 0 0.75rem 0.75rem;
}

.nav-section-title:first-child {
    margin-top: 0;
}

.nav-item .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: var(--radius-md);
    margin-bottom: 0.25rem;
    transition: all 0.2s;
}

.nav-item .nav-link:hover {
    background-color: var(--bg-body);
    color: var(--text-main);
}

.nav-item .nav-link.active {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-item .nav-link i {
    font-size: 1.25rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-lg);
    background: var(--bg-body);
    transition: background 0.2s;
}

.user-card:hover {
    background: var(--secondary-light);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

/* Top Header */
.app-header {
    height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 900;
}

[data-bs-theme="dark"] .app-header {
    background-color: var(--bg-surface) !important;
    border-bottom-color: var(--border-color) !important;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.btn-icon:hover {
    background: var(--bg-body);
    color: var(--primary);
}

.notification-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
}

/* Content Area */
.app-content {
    padding: 2rem;
    flex: 1;
}

/* Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background: var(--bg-body);
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

/* Stat Cards */
.stat-card {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 1rem;
}

.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger); }

.stat-details h3 {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.2;
}

.stat-details p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-outline-secondary {
    color: var(--text-muted);
    border-color: var(--border-color);
}

.btn-outline-secondary:hover {
    background: var(--bg-body);
    color: var(--text-main);
    border-color: var(--text-muted);
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

.table td {
    padding: 1rem 1.5rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.9375rem;
}

.table tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    border-radius: 6px;
    letter-spacing: 0.025em;
}

.badge.bg-success { background: var(--success-light) !important; color: var(--success); }
.badge.bg-warning { background: var(--warning-light) !important; color: var(--warning); }
.badge.bg-danger { background: var(--danger-light) !important; color: var(--danger); }
.badge.bg-info { background: var(--info-light) !important; color: var(--info); }
.badge.bg-secondary { background: var(--secondary-light) !important; color: var(--secondary); }

/* Forms */
.form-control, .form-select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    transition: all 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

/* Mobile & Responsive */
.mobile-toggle {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: var(--text-main);
    padding: 0;
    margin-right: 1rem;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    
    .app-sidebar.show {
        transform: translateX(0);
    }
    
    .app-main {
        margin-left: 0;
    }
    
    .mobile-toggle {
        display: block;
    }
    
    .mobile-overlay.show {
        display: block;
    }
    
    .app-content {
        padding: 1rem;
    }
    
    .app-header {
        padding: 0 1rem;
    }
}

/* Bottom Nav (Mobile Only) */
.bottom-nav {
    display: none;
}

@media (max-width: 767.98px) {
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-surface);
        border-top: 1px solid var(--border-color);
        padding: 0.75rem 1rem;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
        justify-content: space-around;
        z-index: 1000;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
    }
    
    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: var(--text-muted);
        font-size: 0.75rem;
        font-weight: 600;
        gap: 0.25rem;
    }
    
    .bottom-nav-item i {
        font-size: 1.5rem;
    }
    
    .bottom-nav-item.active {
        color: var(--primary);
    }
    
    .bottom-nav-fab {
        width: 50px;
        height: 50px;
        background: var(--primary);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 1.5rem;
        margin-top: -25px;
        box-shadow: 0 4px 10px rgba(79, 70, 229, 0.4);
    }
    
    .app-main {
        padding-bottom: 80px;
    }
}

/* Utilities */
.text-primary { color: var(--primary) !important; }
.bg-primary-subtle { background-color: var(--primary-light) !important; }
.text-success { color: var(--success) !important; }
.bg-success-subtle { background-color: var(--success-light) !important; }
.text-warning { color: var(--warning) !important; }
.bg-warning-subtle { background-color: var(--warning-light) !important; }
.text-danger { color: var(--danger) !important; }
.bg-danger-subtle { background-color: var(--danger-light) !important; }

.fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-medium { font-weight: 500 !important; }

.rounded-xl { border-radius: var(--radius-xl) !important; }
.shadow-hover:hover { box-shadow: var(--shadow-lg) !important; transform: translateY(-2px); }

/* Login Page Specific */
.login-page {
    background: linear-gradient(135deg, var(--bg-body) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    background: var(--bg-surface);
    border-radius: 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
}

/* Overdue Task Styling */
.row-overdue {
    background-color: var(--danger-light) !important;
    position: relative;
}

.row-overdue td {
    background-color: var(--danger-light) !important;
    border-bottom-color: var(--danger) !important;
}

.row-overdue:hover td {
    background-color: var(--danger-light) !important;
    filter: brightness(0.95);
}

.row-overdue strong {
    color: var(--danger);
}
