:root {
    --primary: #4e73df;
    --primary-dark: #2e59d9;
    --secondary: #858796;
    --success: #1cc88a;
    --info: #36b9cc;
    --warning: #f6c23e;
    --danger: #e74a3b;
    --light: #f8f9fc;
    --dark: #5a5c69;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f6f9;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

main {
    flex: 1;
}

/* —— StudySphere navbar: attractive background + hover/focus UX —— */
.studysphere-navbar {
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 50%, #2d3748 100%) !important;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    transition: box-shadow 0.2s ease;
}
.studysphere-navbar.scrolled {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Brand: hover lift + glow */
.studysphere-navbar .navbar-brand {
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 0.5px;
    color: #fff !important;
    transition: transform 0.2s ease, opacity 0.2s ease, text-shadow 0.2s ease;
}
.studysphere-navbar .navbar-brand:hover,
.studysphere-navbar .navbar-brand:focus {
    color: #e2e8f0 !important;
    transform: translateY(-1px);
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
    opacity: 0.95;
}

/* Nav links: pill-style hover + smooth transition */
.studysphere-navbar .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem !important;
    margin: 0 0.1rem;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.studysphere-navbar .navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff !important;
    transform: translateY(-1px);
}
.studysphere-navbar .navbar-nav .nav-link:focus {
    background-color: rgba(255, 255, 255, 0.12);
    color: #fff !important;
    outline: none;
}
.studysphere-navbar .navbar-nav .nav-link.dropdown-toggle.show {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff !important;
}

/* Dropdown menus: subtle shadow + item hover */
.studysphere-navbar .dropdown-menu {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 0.35rem;
    margin-top: 0.35rem;
}
.studysphere-navbar .dropdown-item {
    border-radius: 0.5rem;
    padding: 0.5rem 0.85rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.studysphere-navbar .dropdown-item:hover,
.studysphere-navbar .dropdown-item:focus {
    background-color: rgba(78, 115, 223, 0.12);
    color: var(--primary-dark);
}
.studysphere-navbar .dropdown-divider {
    margin: 0.35rem 0;
}

/* Language submenu under Courses: show on hover and when opened by click */
.studysphere-navbar .dropdown-submenu {
    position: relative;
}
.studysphere-navbar .dropdown-submenu .dropdown-submenu-menu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    margin-top: 0;
    margin-left: 0.125rem;
    min-width: 10rem;
    z-index: 1060;
}
.studysphere-navbar .dropdown-submenu:hover .dropdown-submenu-menu,
.studysphere-navbar .dropdown-submenu.show .dropdown-submenu-menu {
    display: block;
}
.studysphere-navbar .dropdown-submenu > .dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Toggler: hover state for mobile */
.studysphere-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.4);
    padding: 0.4rem 0.55rem;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.studysphere-navbar .navbar-toggler:hover,
.studysphere-navbar .navbar-toggler:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: none;
}
.studysphere-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Register button in navbar (guest) */
.studysphere-navbar .nav-link.btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.95) !important;
    color: #1e3a5f !important;
    border-color: #fff;
}

@media (max-width: 991.98px) {
    .navbar-collapse {
        max-height: 80vh;
        overflow-y: auto;
    }

    .navbar .dropdown-menu {
        max-width: calc(100vw - 2rem);
    }

    .studysphere-navbar .navbar-nav .nav-link {
        margin: 0.15rem 0;
    }

    /* On mobile, Language submenu opens below so it stays on screen */
    .studysphere-navbar .dropdown-submenu .dropdown-submenu-menu {
        left: 0;
        top: 100%;
        margin-left: 0;
        margin-top: 0.125rem;
    }
}

.card {
    border: none;
    border-radius: 0.75rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1) !important;
}

.card-header {
    border-radius: 0.75rem 0.75rem 0 0 !important;
    font-weight: 600;
}

.hero-section {
    background: linear-gradient(135deg, var(--primary) 0%, #224abe 100%);
    color: #fff;
    padding: 5rem 0;
    border-radius: 0 0 2rem 2rem;
    margin-bottom: 2rem;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 700;
}

.hero-section p {
    font-size: 1.25rem;
    opacity: 0.9;
}

.feature-card {
    text-align: center;
    padding: 2rem;
}

.feature-card i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.profile-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.profile-photo-placeholder {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background-color: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.badge-teacher {
    background-color: var(--info);
    color: #fff;
}

.badge-student {
    background-color: var(--success);
    color: #fff;
}

.status-card {
    border-left: 4px solid var(--primary);
    margin-bottom: 1rem;
}

.notification-unread {
    background-color: #e8f0fe;
    border-left: 4px solid var(--primary);
}

.notification-read {
    opacity: 0.7;
}

.chat-container {
    height: 450px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    padding: 1rem;
    background-color: #fff;
    scroll-behavior: smooth;
}

.chat-message {
    margin-bottom: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    max-width: 75%;
    word-wrap: break-word;
}

.chat-message.own {
    background-color: var(--primary);
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 0.25rem;
}

.chat-message.other {
    background-color: #e9ecef;
    margin-right: auto;
    border-bottom-left-radius: 0.25rem;
}

.chat-message .username {
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.chat-message .timestamp {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

.chat-input-area {
    border-top: 1px solid #dee2e6;
    padding-top: 1rem;
    margin-top: 1rem;
}

/* Chat room: responsive message area height */
.chat-messages-panel {
    min-height: 300px;
}
@media (max-width: 767.98px) {
    .chat-messages-panel {
        min-height: 280px;
        height: 50vh !important;
        max-height: 400px;
    }
}

.rating-stars {
    color: var(--warning);
}

.star-empty {
    color: #ccc;
}

.course-card .card-body {
    display: flex;
    flex-direction: column;
}

.course-card .card-text {
    flex-grow: 1;
}

.enrol-btn {
    background: linear-gradient(135deg, var(--success), #17a673);
    border: none;
    color: #fff;
    font-weight: 600;
}

.enrol-btn:hover {
    background: linear-gradient(135deg, #17a673, var(--success));
    color: #fff;
}

/* Footer: same gradient as navbar for a consistent StudySphere look */
.studysphere-footer {
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 50%, #2d3748 100%) !important;
    color: rgba(255, 255, 255, 0.95);
    padding: 1.5rem 0;
    margin-top: auto;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
}
.studysphere-footer .text-white-50 {
    color: rgba(255, 255, 255, 0.75) !important;
}
.studysphere-footer a {
    color: rgba(255, 255, 255, 0.95) !important;
    transition: color 0.2s ease, opacity 0.2s ease;
}
.studysphere-footer a:hover {
    color: #fff !important;
    opacity: 0.9;
}

footer {
    padding: 1.5rem 0;
    margin-top: 3rem;
}

.table th {
    font-weight: 600;
    background-color: var(--light);
}

.search-box {
    max-width: 500px;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* Auth pages: back-to-home link */
.auth-back-link:hover {
    color: var(--primary) !important;
}

@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2rem;
    }

    .hero-section p {
        font-size: 1rem;
    }

    .chat-container {
        height: 300px;
    }

    .profile-photo,
    .profile-photo-placeholder {
        width: 100px;
        height: 100px;
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .hero-section {
        padding: 3rem 0;
        margin-bottom: 1.5rem;
    }

    .hero-section h1 {
        font-size: 1.5rem;
    }

    .hero-section p {
        font-size: 0.95rem;
    }

    .chat-container {
        height: 280px;
    }

    /* Touch-friendly minimum tap targets for primary actions */
    .btn-primary:not(.btn-sm),
    .btn-success:not(.btn-sm),
    .navbar .btn {
        min-height: 44px;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
}

/* Responsive tables: horizontal scroll on small viewports */
.table-responsive {
    overflow-x: auto;
}

/* Prevent long words/URLs from breaking layout */
.text-break {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Presence status (Available / Busy / DND / BRB / Away / Offline) in navbar and chat */
.presence-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.presence-dot.presence-available { background-color: #1cc88a; }
.presence-dot.presence-online { background-color: #36b9cc; }
.presence-dot.presence-busy { background-color: #e74a3b; }
.presence-dot.presence-dnd { background-color: #e74a3b; }
.presence-dot.presence-brb { background-color: #f6c23e; }
.presence-dot.presence-away { background-color: #f6c23e; }
.presence-dot.presence-offline { background-color: #858796; }
/* Legacy alias for chat compatibility */
.presence-dot.presence-present { background-color: #1cc88a; }

/* ========== Settings page: modern layout (General, Account, Security, Preferences, Language) ========== */
.settings-page {
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}
.settings-header {
  padding-top: 0.5rem;
}
.settings-header-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary) 0%, #224abe 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.settings-card {
  border-radius: 1rem;
}
.settings-nav {
  min-height: 200px;
}
.settings-nav .nav-link {
  font-weight: 500;
  padding: 0.65rem 1rem;
  color: #495057;
  border: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.settings-nav .nav-link:hover {
  background-color: rgba(78, 115, 223, 0.08);
  color: var(--primary);
}
.settings-nav .nav-link.active {
  background-color: rgba(78, 115, 223, 0.15);
  color: var(--primary-dark);
}
.settings-section-card {
  border-radius: 0.75rem;
  transition: box-shadow 0.2s ease;
}
.settings-section-card:hover {
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.08) !important;
}
.settings-section-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, rgba(78, 115, 223, 0.12) 0%, rgba(78, 115, 223, 0.06) 100%);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}
.settings-avatar {
  border: 3px solid #e9ecef;
}
@media (max-width: 767.98px) {
  .settings-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.25rem;
    min-height: 0;
  }
  .settings-nav .nav-link {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    font-size: 0.875rem;
    padding: 0.5rem 0.5rem;
  }
}

/* Chat message bubbles + hover actions (emoji, edit, more) */
.chat-message-bubble {
    position: relative;
}
.chat-bubble-own {
    background: #e3ecff;
    color: #1a1a1a;
    border: 1px solid #c5d5ff;
    border-bottom-right-radius: 0.25rem;
}
.chat-bubble-own a {
    color: var(--primary-dark);
}
.chat-bubble-other {
    background: #ffffff;
    color: #1a1a1a;
    border: 1px solid #dee2e6;
    border-bottom-left-radius: 0.25rem;
}
.chat-message-actions {
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
}
.chat-message-bubble:hover .chat-message-actions {
    opacity: 1;
}
.chat-message-pinned {
    box-shadow: 0 0 0 2px var(--warning);
}
.chat-message-unread {
    border-style: dashed !important;
}

/* Emoji reaction chips: visible on both sender and receiver bubbles */
.chat-emoji-chip {
    background-color: #fff !important;
    color: #1a1a1a !important;
    border: 1px solid rgba(0, 0, 0, 0.15) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    font-size: 1rem;
}

/* Reaction chips container: always visible (not hidden like actions) */
.chat-message-reactions {
    opacity: 1;
    min-height: 1.5rem;
}

.chat-emoji-picker {
    position: absolute;
    bottom: 125%;
    right: 0;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.25rem 0.5rem;
    z-index: 10;
    white-space: nowrap;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Input-area emoji picker (above the text box) */
.chat-input-emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 0.5rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.5rem;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(8, 1.5rem);
    gap: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}
.chat-input-emoji-picker button {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1;
    border: none;
    background: transparent;
    border-radius: 0.25rem;
    cursor: pointer;
}
.chat-input-emoji-picker button:hover {
    background: #f0f0f0;
}

/* Gamification cards (Memrise-style: streak + certs) */
.gamification-card {
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.gamification-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.12) !important;
}
.gamification-icon {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}
.streak-card .streak-icon {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 50%, #ffc107 100%);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.35);
}
.certs-card .certs-icon {
    background: linear-gradient(135deg, #d4af37 0%, #f4d03f 50%, #f9e79f 100%);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}
.progress-card .progress-icon {
    background: linear-gradient(135deg, #1cc88a 0%, #36b9cc 100%);
    box-shadow: 0 4px 12px rgba(28, 200, 138, 0.35);
}
.profile-gamification {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.profile-gamification-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    background: #fff;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.profile-gamification-item .icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.profile-gamification-item.streak .icon-wrap {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
}
.profile-gamification-item.certs .icon-wrap {
    background: linear-gradient(135deg, #d4af37, #f4d03f);
}
.profile-gamification-item .value {
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.2;
}
.profile-gamification-item .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
}

/* Thicker progress bars for stat cards (Home & Profile) */
.progress-stat {
    height: 8px !important;
    background-color: #e9ecef;
}
.progress-stat .progress-bar {
    transition: width 0.4s ease;
}

/* Teacher dashboard: Completions This Week — 3D card with vibrant colour */
.teacher-card-completions {
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 50%, #2dd4bf 100%);
    border: none;
    box-shadow: 0 4px 0 #0f766e, 0 8px 20px rgba(13, 148, 136, 0.35);
    color: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.teacher-card-completions:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #0f766e, 0 12px 28px rgba(13, 148, 136, 0.4);
}
.teacher-card-completions .text-muted {
    color: rgba(255, 255, 255, 0.85) !important;
}
.teacher-card-completions .badge {
    background: rgba(255, 255, 255, 0.3) !important;
    color: #fff !important;
}
.teacher-card-completions .progress-stat {
    background-color: rgba(255, 255, 255, 0.3);
}
.teacher-card-completions .progress-bar {
    background-color: #fff !important;
}

/* Teacher dashboard: Pending Approvals — attractive soft colour */
.teacher-card-pending {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 50%, #a78bfa 100%);
    border: none;
    box-shadow: 0 4px 0 #5b21b6, 0 8px 20px rgba(124, 58, 237, 0.35);
    color: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.teacher-card-pending:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #5b21b6, 0 12px 28px rgba(124, 58, 237, 0.4);
}
.teacher-card-pending .text-muted {
    color: rgba(255, 255, 255, 0.85) !important;
}
.teacher-card-pending .badge {
    background: rgba(255, 255, 255, 0.3) !important;
    color: #fff !important;
}
.teacher-card-pending .progress-stat {
    background-color: rgba(255, 255, 255, 0.3);
}
.teacher-card-pending .progress-bar {
    background-color: #fff !important;
}

/* Teacher: Pending Approvals list card — attractive purple theme */
.teacher-card-pending-list {
    border-left: 4px solid #8b5cf6;
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.12);
}
.teacher-card-pending-header {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08) 0%, rgba(139, 92, 246, 0.06) 100%) !important;
    color: #5b21b6;
}
.teacher-card-pending-header i {
    color: #7c3aed;
}
.teacher-pending-item {
    border-bottom: 1px solid rgba(124, 58, 237, 0.08) !important;
}
.teacher-pending-item:last-child {
    border-bottom: none !important;
}
.teacher-pending-view-btn {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    color: #fff !important;
    border: none;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
}
.teacher-pending-view-btn:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 100%);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.45);
}

/* Teacher: Students Completed This Week — vibrant chart + 3D effect */
.teacher-card-completions-chart {
    border-left: 4px solid #0d9488;
    box-shadow: 0 2px 12px rgba(13, 148, 136, 0.12);
}
.teacher-card-completions-header {
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.08) 0%, rgba(20, 184, 166, 0.06) 100%) !important;
    color: #0f766e;
}
.teacher-card-completions-header i {
    color: #0d9488;
}
.teacher-chart-3d-wrapper {
    filter: drop-shadow(0 8px 16px rgba(13, 148, 136, 0.25)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    padding: 8px;
}

/* Teacher dashboard: coloured section headers */
.teacher-header-activity {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(99, 102, 241, 0.08) 100%) !important;
    color: #1d4ed8;
}
.teacher-header-activity i {
    color: #3b82f6;
}
.teacher-header-engagement {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.08) 100%) !important;
    color: #047857;
}
.teacher-header-engagement i {
    color: #10b981;
}
.teacher-header-courses {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(217, 119, 6, 0.08) 100%) !important;
    color: #b45309;
}
.teacher-header-courses i {
    color: #f59e0b;
}

/* Student dashboard: coloured section headers */
.student-header-progress {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(99, 102, 241, 0.08) 100%) !important;
    color: #1d4ed8;
}
.student-header-progress i {
    color: #3b82f6;
}
.student-header-deadlines {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.12) 0%, rgba(234, 88, 12, 0.08) 100%) !important;
    color: #c2410c;
}
.student-header-deadlines i {
    color: #f97316;
}
.student-header-notifications {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(124, 58, 237, 0.08) 100%) !important;
    color: #5b21b6;
}
.student-header-notifications i {
    color: #8b5cf6;
}
.student-header-achievement {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(217, 119, 6, 0.1) 100%) !important;
    color: #b45309;
}
.student-header-achievement i {
    color: #f59e0b;
}
.student-header-heatmap {
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.1) 0%, rgba(20, 184, 166, 0.08) 100%) !important;
    color: #0f766e;
}
.student-header-heatmap i {
    color: #0d9488;
}
.student-header-heatmap .text-muted {
    color: rgba(15, 118, 110, 0.8) !important;
}

/* Activity heatmap (GitHub-style, full year) */
.activity-heatmap-wrapper {
    max-height: 280px;
}
.activity-heatmap-months-row {
    overflow: visible;
}
.activity-heatmap-month-label {
    font-size: 0.7rem;
    line-height: 1;
    overflow: visible;
}
.activity-heatmap-cell {
    flex-shrink: 0;
}

/* Profile page: coloured section headers */
.profile-header-activity {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(99, 102, 241, 0.08) 100%) !important;
    color: #1d4ed8;
}
.profile-header-activity i {
    color: #3b82f6;
}
.profile-header-progress {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(217, 119, 6, 0.1) 100%) !important;
    color: #b45309;
}
.profile-header-progress i {
    color: #f59e0b;
}
.profile-header-achievements {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.08) 100%) !important;
    color: #047857;
}
.profile-header-achievements i {
    color: #10b981;
}
.profile-header-enrolled {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(99, 102, 241, 0.08) 100%) !important;
    color: #1d4ed8;
}
.profile-header-enrolled i {
    color: #3b82f6;
}
.profile-header-courses-created {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(22, 163, 74, 0.08) 100%) !important;
    color: #15803d;
}
.profile-header-courses-created i {
    color: #22c55e;
}
.profile-header-share {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(124, 58, 237, 0.08) 100%) !important;
    color: #5b21b6;
}
.profile-header-share i {
    color: #8b5cf6;
}

/* ========== Dark mode (Settings → Preferences → Theme: Dark / System) ========== */
html[data-theme="dark"] {
    color-scheme: dark;
}
html[data-theme="dark"] body {
    background-color: #1a1d23;
    color: #e2e8f0;
}
html[data-theme="dark"] main {
    background-color: transparent;
}
/* Cards */
html[data-theme="dark"] .card {
    background-color: #252830;
    border-color: #3d4452;
}
html[data-theme="dark"] .card-header {
    background-color: #2d3139 !important;
    border-color: #3d4452;
    color: #e2e8f0;
}
html[data-theme="dark"] .card-footer {
    background-color: #2d3139;
    border-color: #3d4452;
    color: #cbd5e1;
}
html[data-theme="dark"] .card-body,
html[data-theme="dark"] .card .text-muted {
    color: #cbd5e1;
}
/* Tables */
html[data-theme="dark"] .table {
    color: #e2e8f0;
    border-color: #3d4452;
}
html[data-theme="dark"] .table th,
html[data-theme="dark"] .table-light th,
html[data-theme="dark"] thead.table-light th {
    background-color: #2d3139 !important;
    color: #e2e8f0;
    border-color: #3d4452;
}
html[data-theme="dark"] .table td,
html[data-theme="dark"] .table th {
    border-color: #3d4452;
}
html[data-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.1);
}
/* Form controls */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] textarea {
    background-color: #2d3139;
    border-color: #3d4452;
    color: #e2e8f0;
}
html[data-theme="dark"] .form-control::placeholder {
    color: #94a3b8;
}
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    background-color: #353a45;
    border-color: var(--primary);
    color: #e2e8f0;
}
/* Labels and text */
html[data-theme="dark"] .form-label,
html[data-theme="dark"] .fw-semibold,
html[data-theme="dark"] label {
    color: #e2e8f0;
}
html[data-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}
html[data-theme="dark"] .text-dark {
    color: #e2e8f0 !important;
}
/* Alerts */
html[data-theme="dark"] .alert-success {
    background-color: rgba(28, 200, 138, 0.2);
    border-color: rgba(28, 200, 138, 0.4);
    color: #a7f3d0;
}
html[data-theme="dark"] .alert-danger {
    background-color: rgba(231, 74, 59, 0.2);
    border-color: rgba(231, 74, 59, 0.4);
    color: #fecaca;
}
html[data-theme="dark"] .alert-warning {
    background-color: rgba(246, 194, 62, 0.2);
    border-color: rgba(246, 194, 62, 0.4);
    color: #fef3c7;
}
html[data-theme="dark"] .alert-info {
    background-color: rgba(54, 185, 204, 0.2);
    border-color: rgba(54, 185, 204, 0.4);
    color: #a5f3fc;
}
/* List groups */
html[data-theme="dark"] .list-group-item {
    background-color: #252830;
    border-color: #3d4452;
    color: #e2e8f0;
}
html[data-theme="dark"] .list-group-item:hover {
    background-color: #2d3139;
}
/* Nav tabs (e.g. Settings) */
html[data-theme="dark"] .nav-tabs {
    border-color: #3d4452;
}
html[data-theme="dark"] .nav-tabs .nav-link {
    color: #94a3b8;
    background-color: transparent;
    border-color: #3d4452;
}
html[data-theme="dark"] .nav-tabs .nav-link:hover {
    color: #e2e8f0;
    border-color: #3d4452;
}
html[data-theme="dark"] .nav-tabs .nav-link.active {
    background-color: #252830;
    border-color: #3d4452 #3d4452 #252830;
    color: #e2e8f0;
}
/* Dropdown menus (Bootstrap, e.g. navbar user menu) */
html[data-theme="dark"] .dropdown-menu {
    background-color: #252830;
    border-color: #3d4452;
}
html[data-theme="dark"] .dropdown-item {
    color: #e2e8f0;
}
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus {
    background-color: rgba(78, 115, 223, 0.25);
    color: #c7d2fe;
}
html[data-theme="dark"] .dropdown-divider {
    border-color: #3d4452;
}
/* Buttons outline */
html[data-theme="dark"] .btn-outline-secondary {
    border-color: #3d4452;
    color: #94a3b8;
}
html[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: #3d4452;
    border-color: #64748b;
    color: #e2e8f0;
}
html[data-theme="dark"] .btn-outline-primary:hover {
    color: #fff;
}
/* Background utilities */
html[data-theme="dark"] .bg-white {
    background-color: #252830 !important;
}
html[data-theme="dark"] .bg-light {
    background-color: #2d3139 !important;
    color: #e2e8f0;
}
/* Settings / general content */
html[data-theme="dark"] .border,
html[data-theme="dark"] .border-top,
html[data-theme="dark"] .border-bottom {
    border-color: #3d4452 !important;
}
/* Links */
html[data-theme="dark"] a:not(.btn):not(.nav-link):not(.dropdown-item) {
    color: #93c5fd;
}
html[data-theme="dark"] a:not(.btn):not(.nav-link):not(.dropdown-item):hover {
    color: #bfdbfe;
}
/* Pagination */
html[data-theme="dark"] .pagination .page-link {
    background-color: #252830;
    border-color: #3d4452;
    color: #e2e8f0;
}
html[data-theme="dark"] .pagination .page-link:hover {
    background-color: #2d3139;
    color: #fff;
}
html[data-theme="dark"] .pagination .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
}
/* Empty state, search box */
html[data-theme="dark"] .empty-state {
    color: #94a3b8;
}
/* Dashboard / teacher / student header cards (keep tint, darken bg) */
html[data-theme="dark"] .teacher-header-activity,
html[data-theme="dark"] .student-header-progress,
html[data-theme="dark"] .profile-header-activity {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(99, 102, 241, 0.15) 100%) !important;
    color: #93c5fd;
}
html[data-theme="dark"] .teacher-header-engagement,
html[data-theme="dark"] .student-header-achievement,
html[data-theme="dark"] .profile-header-achievements {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.15) 100%) !important;
    color: #6ee7b7;
}
html[data-theme="dark"] .teacher-header-courses,
html[data-theme="dark"] .student-header-deadlines,
html[data-theme="dark"] .profile-header-progress {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(217, 119, 6, 0.15) 100%) !important;
    color: #fcd34d;
}
html[data-theme="dark"] .teacher-card-completions,
html[data-theme="dark"] .teacher-card-pending {
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.2);
}
/* Chat areas */
html[data-theme="dark"] #chat-messages.chat-messages-panel,
html[data-theme="dark"] .chat-messages-panel {
    background-color: #1a1d23 !important;
}
html[data-theme="dark"] .chat-bubble-own {
    background: rgba(78, 115, 223, 0.35);
    border-color: rgba(78, 115, 223, 0.5);
}
html[data-theme="dark"] .chat-bubble-other {
    background: #2d3139;
    border-color: #3d4452;
}
/* Notification list */
html[data-theme="dark"] .notification-unread {
    background-color: rgba(78, 115, 223, 0.15);
    border-left-color: var(--primary);
}

/* Settings page dark mode */
html[data-theme="dark"] .settings-header-icon {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
html[data-theme="dark"] .settings-nav .nav-link {
    color: #94a3b8;
}
html[data-theme="dark"] .settings-nav .nav-link:hover {
    background-color: rgba(78, 115, 223, 0.2);
    color: #c7d2fe;
}
html[data-theme="dark"] .settings-nav .nav-link.active {
    background-color: rgba(78, 115, 223, 0.3);
    color: #c7d2fe;
}
html[data-theme="dark"] .settings-section-card {
    background-color: #252830;
    border-color: #3d4452;
}
html[data-theme="dark"] .settings-section-icon {
    background: linear-gradient(135deg, rgba(78, 115, 223, 0.25) 0%, rgba(78, 115, 223, 0.12) 100%);
    color: #93c5fd;
}
html[data-theme="dark"] .settings-avatar {
    border-color: #3d4452;
}
