/**
 * Student / teacher portal: sticky header, sidebar + main scroll, unified menu search.
 */

html.portal-shell-active {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    scroll-padding-top: 72px;
}

body.app-portal-layout,
body.student-dashboard-page {
    margin: 0;
    background: linear-gradient(180deg, #eef2ff 0%, #f8fafc 38%, #f1f5f9 100%) !important;
}

body.app-portal-layout::before,
body.student-dashboard-page::before {
    display: none !important;
}

/* Sticky top bar */
body.app-portal-layout > .navbar,
body.student-dashboard-page > .navbar {
    position: sticky !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 45%, #7c3aed 100%) !important;
    box-shadow: 0 4px 24px rgba(79, 70, 229, 0.35);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

body.app-portal-layout > .navbar .navbar-brand,
body.app-portal-layout > .navbar .nav-link,
body.student-dashboard-page > .navbar .navbar-brand,
body.student-dashboard-page > .navbar .nav-link {
    color: rgba(255, 255, 255, 0.95) !important;
}

body.app-portal-layout > .navbar .navbar-brand i,
body.student-dashboard-page > .navbar .navbar-brand i {
    color: #fde68a;
}

.portal-navbar-search-wrap {
    flex: 1 1 auto;
    max-width: min(420px, 100%);
    min-width: 0;
}

.portal-navbar-search-wrap .form-control {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 10px;
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.portal-navbar-search-wrap .form-control::placeholder {
    color: #64748b;
}

.portal-navbar-search-wrap .form-control:focus {
    border-color: #c7d2fe;
    box-shadow: 0 0 0 0.2rem rgba(199, 210, 254, 0.55);
}

/* One search only: header search filters sidebar; hide sidebar duplicate */
body.portal-unified-header .app-sidebar-search-wrap {
    display: none !important;
}

body.app-portal-layout #sidebarMenu.sidebar,
body.student-dashboard-page #sidebarMenu.sidebar {
    background: linear-gradient(180deg, #4338ca 0%, #4f46e5 35%, #5b21b6 100%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 2px 0 16px rgba(67, 56, 202, 0.2);
    padding: 0;
    min-height: 0;
}

body.app-portal-layout #sidebarMenu .nav-link,
body.student-dashboard-page #sidebarMenu .nav-link {
    color: rgba(255, 255, 255, 0.92) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.app-portal-layout #sidebarMenu .nav-link:hover,
body.student-dashboard-page #sidebarMenu .nav-link:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #fff !important;
    transform: none;
}

body.app-portal-layout #sidebarMenu .nav-link.active,
body.student-dashboard-page #sidebarMenu .nav-link.active {
    background: rgba(255, 255, 255, 0.22) !important;
    color: #fff !important;
    border-left: 4px solid #fde68a;
    font-weight: 600;
}

/* Student dashboard content */
body.student-dashboard-page {
    font-family: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
}

body.student-dashboard-page .sd-main {
    padding-bottom: 2.5rem;
}

body.student-dashboard-page .sd-welcome {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-left: 4px solid #6366f1 !important;
}

body.student-dashboard-page .sd-avatar {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-weight: 700;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Statistics overview panel — compact height (matches admin dashboard) */
body.student-dashboard-page .student-stats-overview {
    border-radius: 12px;
    overflow: hidden;
    border-width: 2px !important;
}

body.student-dashboard-page .student-stats-overview .card-header {
    cursor: pointer;
    user-select: none;
    background: linear-gradient(135deg, #06b6d4 0%, #4f46e5 52%, #7c3aed 100%) !important;
    color: #fff !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

body.student-dashboard-page .student-stats-overview .card-header h2,
body.student-dashboard-page .student-stats-overview .student-stats-chevron {
    color: #fff !important;
}

body.student-dashboard-page .student-stats-overview .student-stats-chevron {
    transition: transform 0.25s ease;
}

body.student-dashboard-page .student-stats-overview .card-header[aria-expanded="false"] .student-stats-chevron {
    transform: rotate(-90deg);
}

body.student-dashboard-page .student-stats-overview .stat-card {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 45%, #7c3aed 100%) !important;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 0.75rem 0.5rem !important;
    margin-bottom: 0 !important;
    min-height: 88px;
    max-height: 104px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.student-dashboard-page .student-stats-overview a.text-decoration-none:hover .stat-card {
    transform: translateY(-4px) scale(1) !important;
    box-shadow: 0 10px 28px rgba(79, 70, 229, 0.4) !important;
}

body.student-dashboard-page .student-stats-overview .stat-card .stat-number {
    font-size: 1.75rem !important;
    font-weight: 700 !important;
    line-height: 1.1 !important;
    margin-bottom: 0.2rem !important;
    color: #e0e7ff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    animation: none;
}

body.student-dashboard-page .student-stats-overview .stat-card .stat-label {
    font-size: 0.68rem !important;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.25;
    color: rgba(255, 255, 255, 0.92) !important;
    opacity: 1 !important;
    margin-bottom: 0;
}

body.student-dashboard-page .student-stats-overview .stat-card::before {
    display: none;
}

body.student-dashboard-page .student-stats-overview a:hover .stat-card::before {
    display: none;
}

#sd-section-available-mock,
#sd-section-recent-attempts,
#sd-section-assignments,
#sd-section-notifications,
#sd-section-class-videos {
    scroll-margin-top: 5.5rem;
}

body.student-dashboard-page .sd-video-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1.15rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

body.student-dashboard-page .sd-video-card:hover {
    border-color: #c7d2fe;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.1);
}

body.student-dashboard-page .sd-video-card .sd-video-title {
    color: #1e293b;
    font-weight: 700;
}

body.student-dashboard-page .sd-video-card .sd-video-badge {
    background: #eef2ff;
    color: #4338ca;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    border: 1px solid #c7d2fe;
}

body.student-dashboard-page .sd-video-embed {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.1);
    border: 1px solid #e2e8f0;
}

body.student-dashboard-page .sd-test-card {
    transition: border-color 0.2s, box-shadow 0.2s;
    border-color: #e2e8f0 !important;
}

body.student-dashboard-page .sd-test-card:hover {
    border-color: #c7d2fe !important;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12) !important;
}

body.student-dashboard-page .sd-empty {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
}

body.student-dashboard-page .sd-empty-icon {
    font-size: 2.5rem;
    color: #cbd5e1;
}

body.student-dashboard-page .sd-notify-item {
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid transparent;
}

body.student-dashboard-page .sd-notify-item:hover {
    background: #f1f5f9 !important;
}

body.student-dashboard-page .sd-unread {
    background: #eef2ff !important;
    border-color: #c7d2fe !important;
}

body.student-dashboard-page .sd-attempt-row:last-child,
body.student-dashboard-page .sd-assign-row:last-child {
    border-bottom: 0 !important;
}

@media (max-width: 767px) {
    body.student-dashboard-page .sd-quick-links {
        width: 100%;
    }

    body.student-dashboard-page .sd-quick-links .btn {
        flex: 1 1 auto;
        text-align: center;
    }
}

@media (max-width: 767.98px) {
    body.student-dashboard-page .student-stats-overview .stat-card {
        min-height: 82px;
        max-height: 96px;
        padding: 0.65rem 0.4rem !important;
    }

    body.student-dashboard-page .student-stats-overview .stat-card .stat-number {
        font-size: 1.5rem !important;
    }
}

@media (max-width: 767.98px) {
    .portal-navbar-search-wrap {
        width: 100%;
        max-width: 100%;
        margin: 0.5rem 0 0.75rem !important;
    }

    body.app-portal-layout > .navbar .navbar-collapse,
    body.student-dashboard-page > .navbar .navbar-collapse {
        padding-bottom: 0.5rem;
    }
}
