:root {
    --primary-blue: #0066CC;
    --primary-blue-hover: #005bb5;
    --light-bg: #F5F7FA;
    --white: #FFFFFF;
    --text-dark: #333333;
    --text-muted: #8e8e93;
    --success-green: #28A745;
    --danger-red: #DC3545;
    --warning-yellow: #FFC107;
    --border-color: #e1e4e8;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --sidebar-width: 260px;
    --header-height: 70px;
    --radius-lg: 16px;
    --radius-md: 10px;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--light-bg);
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Glassmorphism Utilities */
.glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #f0f0f0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    font-size: 14px;
}

.btn-primary {
    background-color: var(--primary-blue);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-blue-hover);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: var(--danger-red);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Inputs */
.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: border-color 0.2s;
    outline: none;
    background: #FAFAFA;
}

.form-control:focus {
    border-color: var(--primary-blue);
    background: #fff;
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-dark);
}

/* Login Page specific */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #E0EBFF 0%, #F5F7FA 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    text-align: center;
}

.login-logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 30px;
    display: block;
}

.login-logo i {
    margin-right: 8px;
}

/* Dashboard Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 0 24px 24px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-blue);
    display: flex;
    align-items: center;
}

.sidebar-menu {
    padding: 20px 10px;
}

.menu-item {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    color: #666;
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    font-weight: 500;
    transition: all 0.2s;
}

.menu-item i {
    width: 24px;
    margin-right: 10px;
    font-size: 16px;
}

.menu-item:hover,
.menu-item.active {
    background-color: #F0F7FF;
    color: var(--primary-blue);
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 20px 30px;
    transition: margin-left 0.3s ease;
}

/* Header */
.top-header {
    height: var(--header-height);
    background: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ddd;
    object-fit: cover;
}

/* DataTables Customization */
table.dataTable thead th {
    background-color: #FAFAFA;
    border-bottom: 2px solid #eee !important;
    font-weight: 600;
    color: #555;
    padding: 15px !important;
}

table.dataTable tbody td {
    padding: 15px !important;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

table.dataTable.no-footer {
    border-bottom: none !important;
}

/* Badges */
.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #E6F9EA;
    color: var(--success-green);
}

.badge-danger {
    background: #FDE8EA;
    color: var(--danger-red);
}

.badge-warning {
    background: #FFF8E1;
    color: var(--warning-yellow);
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    }

    .main-content {
        margin-left: 0;
        padding: 20px 15px;
        /* Reduced padding on mobile */
    }

    .top-header {
        margin-bottom: 20px;
    }
}

@media (max-width: 768px) {

    .stats-grid,
    .charts-row {
        grid-template-columns: 1fr !important;
        /* Stack vertically */
    }

    .header-left {
        display: none;
        /* Simplify header on very small screens if needed, or adjust */
    }

    .top-header {
        justify-content: space-between;
    }

    .form-control {
        font-size: 16px;
        /* Prevent iOS zoom */
    }
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--primary-blue);
    cursor: pointer;
    margin-right: 15px;
}

@media (max-width: 992px) {
    .mobile-toggle {
        display: block;
    }
}

/* Ported from index.php */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    position: relative;
    border: 1px solid #f0f0f0;
}

.stat-info h3 {
    font-size: 28px;
    margin-bottom: 5px;
    color: #333;
}

.stat-info p {
    font-size: 14px;
    color: #888;
    font-weight: 500;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.bg-blue-light {
    background: #E0EBFF;
    color: #0066CC;
}

.bg-green-light {
    background: #E6F9EA;
    color: #28A745;
}

.bg-orange-light {
    background: #FFF4E5;
    color: #FF9800;
}

.bg-purple-light {
    background: #F3E5F5;
    color: #9C27B0;
}

.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

/* Table Responsive Wrapper */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 15px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 20px;
    align-items: center;
    /* Center vertically if flex */
    justify-content: center;
}

.modal-content {
    background-color: #fefefe;
    margin: 20px auto;
    padding: 30px;
    border: 1px solid #f0f0f0;
    width: 100%;
    max-width: 600px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    position: absolute;
    right: 25px;
    top: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: var(--danger-red);
}