:root {
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --light-color: #f8f9fc;
    --dark-color: #5a5c69;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
}

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

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f4f6f9;
    color: #333;
}

/* Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, #224abe 100%);
    padding: 20px;
}

.auth-box {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 450px;
    padding: 40px;
}

.auth-box h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.auth-box .subtitle {
    text-align: center;
    color: var(--secondary-color);
    margin-bottom: 30px;
}

.auth-box .logo {
    text-align: center;
    margin-bottom: 20px;
}

.auth-box .logo img {
    max-width: 120px;
}

.auth-box .form-group {
    margin-bottom: 20px;
}

.auth-box label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
}

.auth-box input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5eb;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.auth-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.auth-box .btn-login {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.auth-box .btn-login:hover {
    background: #3d5fc4;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
}

.user-type-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.user-type-btn {
    flex: 1;
    padding: 15px 10px;
    border: 2px solid #e1e5eb;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s;
}

.user-type-btn i {
    font-size: 24px;
    display: block;
    margin-bottom: 8px;
    color: var(--secondary-color);
}

.user-type-btn span {
    font-size: 13px;
    font-weight: 600;
    color: var(--secondary-color);
}

.user-type-btn.active,
.user-type-btn:hover {
    border-color: var(--primary-color);
    background: rgba(78, 115, 223, 0.1);
}

.user-type-btn.active i,
.user-type-btn.active span {
    color: var(--primary-color);
}

/* Dashboard Layout */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-color) 0%, #224abe 100%);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: width 0.3s;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h3 {
    color: white;
    font-size: 18px;
    margin: 0;
}

.sidebar-header .logo-icon {
    font-size: 40px;
    color: white;
    margin-bottom: 10px;
}

.sidebar-menu {
    padding: 15px 0;
}

.sidebar-menu .menu-header {
    padding: 10px 20px;
    color: rgba(255,255,255,0.5);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left-color: white;
}

.sidebar-menu a i {
    width: 25px;
    margin-right: 10px;
    font-size: 16px;
}

.sidebar-menu a span {
    font-size: 14px;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    transition: margin-left 0.3s, width 0.3s;
}

/* Header */
.top-header {
    background: white;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--dark-color);
    display: none;
}

.search-box {
    position: relative;
}

.search-box input {
    padding: 10px 15px 10px 40px;
    border: 1px solid #e1e5eb;
    border-radius: 25px;
    width: 300px;
    font-size: 14px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-icon {
    position: relative;
    font-size: 20px;
    color: var(--secondary-color);
    cursor: pointer;
}

.header-icon .badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger-color);
    color: white;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 50%;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.3s;
}

.user-dropdown:hover {
    background: var(--light-color);
}

.user-dropdown img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user-dropdown .user-info {
    text-align: left;
}

.user-dropdown .user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--dark-color);
}

.user-dropdown .user-role {
    font-size: 12px;
    color: var(--secondary-color);
}

/* Content Area */
.content-area {
    padding: 25px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-title h1 {
    font-size: 24px;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.page-title .breadcrumb {
    display: flex;
    gap: 10px;
    font-size: 13px;
    color: var(--secondary-color);
}

.page-title .breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

/* Cards */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 25px;
    border: none;
}

.card-header {
    padding: 15px 20px;
    background: white;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 10px 10px 0 0;
}

.card-header h5 {
    margin: 0;
    font-size: 16px;
    color: var(--primary-color);
    font-weight: 700;
}

.card-body {
    padding: 20px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 15px;
    border-left: 4px solid;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card.primary { border-left-color: var(--primary-color); }
.stat-card.success { border-left-color: var(--success-color); }
.stat-card.warning { border-left-color: var(--warning-color); }
.stat-card.info { border-left-color: var(--info-color); }
.stat-card.danger { border-left-color: var(--danger-color); }

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-card.primary .stat-icon { background: rgba(78, 115, 223, 0.1); color: var(--primary-color); }
.stat-card.success .stat-icon { background: rgba(28, 200, 138, 0.1); color: var(--success-color); }
.stat-card.warning .stat-icon { background: rgba(246, 194, 62, 0.1); color: var(--warning-color); }
.stat-card.info .stat-icon { background: rgba(54, 185, 204, 0.1); color: var(--info-color); }
.stat-card.danger .stat-icon { background: rgba(231, 74, 59, 0.1); color: var(--danger-color); }

.stat-details h3 {
    font-size: 28px;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.stat-details p {
    font-size: 13px;
    color: var(--secondary-color);
    margin: 0;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--light-color);
    padding: 12px 15px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    color: var(--dark-color);
    text-transform: uppercase;
    border-bottom: 2px solid #e9ecef;
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
    vertical-align: middle;
}

.data-table tr:hover {
    background: var(--light-color);
}

.data-table .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary { background: var(--primary-color); color: white; }
.btn-primary:hover { background: #3d5fc4; color: white; }
.btn-success { background: var(--success-color); color: white; }
.btn-success:hover { background: #17a673; color: white; }
.btn-warning { background: var(--warning-color); color: #333; }
.btn-danger { background: var(--danger-color); color: white; }
.btn-info { background: var(--info-color); color: white; }
.btn-secondary { background: var(--secondary-color); color: white; }
.btn-light { background: var(--light-color); color: var(--dark-color); }

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-group {
    display: flex;
    gap: 5px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #d1d3e2;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23858796' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-text {
    font-size: 12px;
    color: var(--secondary-color);
    margin-top: 5px;
}

/* Status Badges */
.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: rgba(28, 200, 138, 0.1); color: var(--success-color); }
.badge-warning { background: rgba(246, 194, 62, 0.1); color: #b88700; }
.badge-danger { background: rgba(231, 74, 59, 0.1); color: var(--danger-color); }
.badge-info { background: rgba(54, 185, 204, 0.1); color: var(--info-color); }
.badge-primary { background: rgba(78, 115, 223, 0.1); color: var(--primary-color); }

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: rgba(28, 200, 138, 0.1); color: var(--success-color); border: 1px solid var(--success-color); }
.alert-danger { background: rgba(231, 74, 59, 0.1); color: var(--danger-color); border: 1px solid var(--danger-color); }
.alert-warning { background: rgba(246, 194, 62, 0.1); color: #b88700; border: 1px solid var(--warning-color); }
.alert-info { background: rgba(54, 185, 204, 0.1); color: var(--info-color); border: 1px solid var(--info-color); }

.alert-dismissible .btn-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.5;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h4 {
    margin: 0;
    color: var(--dark-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--secondary-color);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 20px;
}

.pagination a, .pagination span {
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    color: var(--dark-color);
    background: white;
    border: 1px solid #e1e5eb;
}

.pagination a:hover, .pagination .active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.quick-action-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    text-decoration: none;
    color: var(--dark-color);
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.quick-action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.quick-action-card i {
    font-size: 32px;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.quick-action-card span {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

/* Calendar */
.calendar-widget {
    background: white;
    border-radius: 10px;
    padding: 20px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 50%;
    cursor: pointer;
}

.calendar-day.today {
    background: var(--primary-color);
    color: white;
}

.calendar-day.has-event {
    background: rgba(78, 115, 223, 0.1);
}

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }
    .sidebar .sidebar-header h3,
    .sidebar-menu .menu-header,
    .sidebar-menu a span {
        display: none;
    }
    .sidebar-menu a {
        justify-content: center;
        padding: 15px;
    }
    .sidebar-menu a i {
        margin-right: 0;
        font-size: 20px;
    }
    .main-content {
        margin-left: var(--sidebar-collapsed-width);
        width: calc(100% - var(--sidebar-collapsed-width));
    }
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .sidebar .sidebar-header h3,
    .sidebar-menu .menu-header,
    .sidebar-menu a span {
        display: block;
    }
    .sidebar-menu a {
        justify-content: flex-start;
        padding: 12px 20px;
    }
    .sidebar-menu a i {
        margin-right: 10px;
        font-size: 16px;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    .menu-toggle {
        display: block;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .quick-actions {
        grid-template-columns: 1fr;
    }
    .search-box {
        display: none;
    }
    .user-dropdown .user-info {
        display: none;
    }
    .page-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    .data-table {
        font-size: 13px;
    }
    .data-table th, .data-table td {
        padding: 10px;
    }
}

@media (max-width: 576px) {
    .content-area {
        padding: 15px;
    }
    .auth-box {
        padding: 25px;
    }
    .user-type-selector {
        flex-direction: column;
    }
    .card-body {
        padding: 15px;
    }
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

/* Print Styles */
@media print {
    .sidebar, .top-header, .btn, .pagination {
        display: none !important;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--light-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Attendance Status Colors */
.attendance-present { color: var(--success-color); }
.attendance-absent { color: var(--danger-color); }
.attendance-late { color: var(--warning-color); }

/* Profile Avatar */
.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e9ecef;
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-color);
}

/* Charts Container */
.chart-container {
    position: relative;
    height: 300px;
}

/* Tab Navigation */
.nav-tabs {
    display: flex;
    gap: 5px;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 20px;
}

.nav-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--secondary-color);
    position: relative;
}

.nav-tab.active {
    color: var(--primary-color);
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--secondary-color);
}

.empty-state i {
    font-size: 60px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h4 {
    margin-bottom: 10px;
}
