:root {
    --asoft-primary: #0d6efd;
    --asoft-primary-dark: #0a58ca;
    --asoft-success: #198754;
    --asoft-warning: #ffc107;
    --asoft-danger: #dc3545;
    --asoft-sidebar-bg: #0f172a;
    --asoft-sidebar-text: #94a3b8;
    --asoft-sidebar-active: #3b82f6;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
    min-height: 100vh;
}

/* Sidebar & Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 270px;
    background-color: var(--asoft-sidebar-bg);
    color: var(--asoft-sidebar-text);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 5px;
}
.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.sidebar .brand {
    padding: 1.25rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar .nav-link {
    color: var(--asoft-sidebar-text);
    padding: 0.65rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.06);
    border-left-color: var(--asoft-sidebar-active);
}

.sidebar .nav-heading {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 1rem 1.5rem 0.35rem 1.5rem;
    color: #64748b;
    font-weight: 700;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

.top-navbar {
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 900;
}

.content-wrapper {
    padding: 1.5rem;
    flex-grow: 1;
}

/* Modern Card Styling */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    background-color: #ffffff;
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

/* Stat Cards */
.stat-card {
    border-radius: 0.75rem;
    padding: 1.25rem;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
}

.stat-card .icon-box {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Risk Badges */
.badge-risk-normal { background-color: #dcfce7; color: #166534; font-weight: 600; }
.badge-risk-attention { background-color: #fef9c3; color: #854d0e; font-weight: 600; }
.badge-risk-risk { background-color: #fee2e2; color: #991b1b; font-weight: 600; }

/* Attendance Button Large Mobile */
.btn-attendance {
    padding: 1.25rem 2rem;
    font-size: 1.25rem;
    font-weight: 700;
    border-radius: 1rem;
    box-shadow: 0 10px 15px -3px rgba(13, 110, 253, 0.3);
    transition: all 0.3s;
}

.btn-attendance:active {
    transform: scale(0.98);
}

/* Study Zone Layout */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 0.5rem;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Badges Showcase */
.badge-card {
    text-align: center;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #ffffff;
    transition: all 0.2s;
}

.badge-card .badge-icon {
    font-size: 3rem;
    color: #f59e0b;
    margin-bottom: 0.5rem;
}

/* Notifications Bell */
.notification-bell {
    position: relative;
    cursor: pointer;
    font-size: 1.25rem;
    color: #64748b;
    transition: color 0.2s;
}
.notification-bell:hover {
    color: var(--asoft-primary);
}
.notification-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
    border-radius: 50rem;
}

/* Back button */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Sortable table header */
th.sortable {
    cursor: pointer;
    user-select: none;
}
th.sortable:hover {
    background-color: #e2e8f0;
}

/* Responsive Mobile Drawer & Touch Navigation */
@media (max-width: 991.98px) {
    .app-container {
        flex-direction: column;
        position: relative;
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: -290px;
        width: 280px;
        height: 100vh;
        z-index: 1050;
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.4);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .sidebar.show {
        left: 0;
    }
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: rgba(15, 23, 42, 0.65);
        backdrop-filter: blur(2px);
        z-index: 1040;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .sidebar-backdrop.show {
        opacity: 1;
        pointer-events: auto;
    }
    .content-wrapper {
        padding: 1rem 0.75rem;
    }
    .top-navbar {
        padding: 0.6rem 1rem;
    }
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 575.98px) {
    .content-wrapper {
        padding: 0.75rem 0.5rem;
    }
    .card {
        border-radius: 0.5rem;
        margin-bottom: 1rem;
    }
    .btn {
        font-size: 0.85rem;
    }
}
