:root {
    --primary-color: #6366f1;
    /* Indigo 500 */
    --primary-hover: #4f46e5;
    /* Indigo 600 */
    --secondary-color: #10b981;
    /* Emerald 500 */
    --danger-color: #ef4444;
    /* Red 500 */
    --bg-color: #f8fafc;
    /* Slate 50 */
    --card-bg: #ffffff;
    --text-color: #1e293b;
    /* Slate 800 */
    --text-muted: #64748b;
    /* Slate 500 */
    --border-color: #e2e8f0;
    /* Slate 200 */
    --hover-bg: #f1f5f9;
    /* Slate 100 */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 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);
}

/* Dark Mode */
[data-theme="dark"] {
    --primary-color: #818cf8;
    /* Indigo 400 */
    --primary-hover: #a5b4fc;
    /* Indigo 300 */
    --secondary-color: #34d399;
    /* Emerald 400 */
    --danger-color: #f87171;
    /* Red 400 */
    --bg-color: #0f172a;
    /* Slate 900 */
    --card-bg: #1e293b;
    /* Slate 800 */
    --text-color: #f1f5f9;
    /* Slate 100 */
    --text-muted: #94a3b8;
    /* Slate 400 */
    --border-color: #334155;
    /* Slate 700 */
    --hover-bg: #334155;
    /* Slate 700 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
    font-size: 1.25rem;
}

.theme-toggle:hover {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.theme-toggle i {
    transition: transform 0.3s ease;
}

.theme-toggle:active i {
    transform: rotate(180deg);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

.container {
    width: 100%;
    margin: 0 auto;
    padding: 0;
}

/* Header */
header {
    background-color: var(--card-bg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 0;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-color);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo i {
    color: #6366f1;
    /* Fallback/Icon color since text-fill-transparent hides it */
    -webkit-text-fill-color: #6366f1;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links a {
    margin-left: 0;
    /* Reset margin */
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.nav-links a:hover {
    color: var(--primary-color);
    background-color: rgba(99, 102, 241, 0.1);
    text-decoration: none;
}

.nav-links a.active {
    color: var(--primary-color);
    background-color: #e0e7ff;
}

.nav-links a i {
    font-size: 1.1rem;
}

.btn-logout {
    color: var(--danger-color) !important;
}

.btn-logout:hover {
    background-color: #fee2e2 !important;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.summary-card:hover {
    transform: translateY(-1px);
}

.card-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.025em;
}

/* Dashboard Summary Cards */
.summary-card {
    position: relative;
    overflow: hidden;
    border: none;
    padding: 1.5rem !important;
    margin-bottom: 0 !important;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: currentColor;
}

.summary-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1.2;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s;
    background-color: var(--bg-color);
    color: var(--text-color);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.75rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    transition: all 0.2s;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.3);
    text-decoration: none;
    color: white !important;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(16, 185, 129, 0.3);
    text-decoration: none;
    color: white !important;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    background-color: var(--bg-color);
    border-bottom: 2px solid var(--border-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: var(--bg-color);
}

.text-success {
    color: var(--secondary-color);
    font-weight: 600;
}

.text-danger {
    color: var(--danger-color);
    font-weight: 600;
}

/* Utilities */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Mobile Menu */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    align-items: center;
    justify-content: center;
}

.mobile-menu-btn span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    border-radius: 3px;
    transition: 0.3s;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 70px;
        /* Adjust based on header height */
        left: 0;
        width: 100%;
        background-color: var(--card-bg);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow-lg);
        border-bottom: 1px solid var(--border-color);
        z-index: 100;
        gap: 0.5rem;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links a {
        width: 100%;
        justify-content: flex-start;
        padding: 0.75rem 1rem;
    }

    .user-menu-separator {
        height: 1px;
        background-color: var(--border-color);
        width: 100%;
        margin: 0.5rem 0;
    }

    /* Adjust Dashboard Grid for Mobile */
    .dashboard-summary {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .hide-mobile {
        display: none;
    }
}

/* Alert Widget Item Styles */
.alert-item-overdue {
    background-color: #fef2f2;
}

.alert-item-today {
    background-color: #fff1f2;
}

.alert-item-upcoming {
    background-color: #f8fafc;
}

body.dark-mode .alert-item-overdue {
    background-color: rgba(220, 38, 38, 0.15);
}

body.dark-mode .alert-item-today {
    background-color: rgba(219, 39, 119, 0.15);
}

body.dark-mode .alert-item-upcoming {
    background-color: rgba(100, 116, 139, 0.1);
}