/* Theme Variables */
:root {
    /* Brand Colors */
    --primary-color: #427770; /* Booty Bay */
    --secondary-color: #6caaa9; /* Aqua Sea */
    --accent-color: #a5e4da; /* Spinnaker */
    
    /* UI Colors */
    --bg-primary: #ffffff; /* Pure White */
    --bg-secondary: #f0f4f5; /* Very soft light gray-blue */
    --text-primary: #04262b; /* Deep Navy */
    --text-secondary: #445c5c; /* Softer, elegant secondary text */
    --border-color: #cdd8d8; /* Light border, clean look */
    
    /* Interactive States */
    --hover-bg: #e1f2f1; /* Very soft aqua for hover */
    --active-bg: #84c4bb; /* Booty Bay */
    --shadow-color: rgba(4, 38, 43, 0.08); /* Very light soft shadow */
    
    /* Additional Variables */
    --gradient-primary: linear-gradient(135deg, #427770, #6caaa9);
    --gradient-success: linear-gradient(135deg, #a5e4da, #6caaa9);
    --warning-color: #ff9f80; /* Soft Peach Warning */
}

[data-theme="dark"] {
    /* Brand Colors */
    --primary-color: #84c4bb; /* Booty Bay */
    --secondary-color: #6caaa9; /* Aqua Sea */
    --accent-color: #a5e4da; /* Spinnaker */
    
    /* UI Colors */
    --bg-primary: #0b1c1e; /* Deep neutral dark, very elegant */
    --bg-secondary: #16282a; /* Soft dark for sections/cards */
    --text-primary: #eff9f9; /* Very soft almost white text */
    --text-secondary: #9ec3c3; /* Soft muted secondary text */
    --border-color: #355c5e; /* Muted teal-gray border */
    
    /* Interactive States */
    --hover-bg: #1d3c3f; /* Slightly lighter hover */
    --active-bg: #6caaa9; /* Aqua Sea */
    --shadow-color: rgba(0, 0, 0, 0.5); /* Proper dark mode shadow */
    
    /* Additional Variables */
    --gradient-primary: linear-gradient(135deg, #84c4bb, #6caaa9);
    --gradient-success: linear-gradient(135deg, #a5e4da, #6caaa9);
    --warning-color: #ffb285; /* Soft Warm Warning */
}


/* Base Styles */
body {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary);
    transition: all 0.3s ease;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 100% 0%, rgba(79, 70, 229, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 0% 100%, rgba(124, 58, 237, 0.1) 0%, transparent 50%);
}

/* Navbar Styles */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background-color: var(--bg-primary) !important;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    height: 76px;
    transition: all 0.3s ease;
}

[data-theme="dark"] .navbar {
    background-color: var(--bg-primary) !important;
}

.navbar-brand {
    color: var(--primary-color) !important;
    font-weight: 600;
    font-size: 1.5rem;
}

.nav-link {
    color: var(--text-primary) !important;
    padding: 0.5rem 1rem !important;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

.nav-link.active {
    color: var(--primary-color) !important;
    font-weight: 500;
}

/* Profile Container Styles */
.profile-container {
    position: relative;
}

.profile-image {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
    transition: all 0.3s ease;
}

.profile-container:hover .profile-image {
    transform: scale(1.05);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.dropdown-menu {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    padding: 0.5rem;
    min-width: 200px;
}

.dropdown-item {
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

.dropdown-divider {
    border-color: var(--border-color);
    margin: 0.5rem 0;
}

.dropdown-item-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}

/* Theme Toggle Button */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
    transform: scale(1.05);
}

/* Dashboard Container */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    padding-top: 76px; /* Match navbar height */
    position: relative;
    width: 100%;
}

/* Sidebar Styles */
.dashboard-sidebar {
    width: 250px;
    background-color: var(--bg-secondary);
    position: fixed;
    height: calc(100vh - 76px); /* Subtract navbar height */
    left: 0;
    top: 76px; /* Match navbar height */
    transition: transform 0.3s ease;
    z-index: 1020;
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.sidebar-nav ul {
    list-style: none;
    padding: 10px 0;
    margin: 0;
}

.nav-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}

.nav-item:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--hover-bg);
    color: var(--primary-color);
    border-left: 4px solid var(--primary-color);
}

.nav-item i {
    width: 20px;
    margin-right: 10px;
}

/* Main Content Area */
.dashboard-main {
    flex: 1;
    margin-left: 250px; /* Match sidebar width */
    padding: 20px;
    width: calc(100% - 250px);
    min-height: calc(100vh - 76px);
    background-color: var(--bg-primary);
    position: relative;
}

/* Stats Container */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease-in-out;
}

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

.stat-card i {
    font-size: 2rem;
    color: var(--primary-color);
    background: var(--primary-light);
    padding: 1rem;
    border-radius: 10px;
}

.stat-info {
    flex-grow: 1;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.stat-label {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chart-card h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.chart-card canvas {
    width: 100% !important;
    height: 300px !important;
}

/* Section Container */
.section-container {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
    overflow: hidden; /* Prevent content overflow */
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.section-container:hover {
    box-shadow: var(--card-hover-shadow);
}

.section-header-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header-with-action h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

/* Courses Grid */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Compact Course Card Styles */
.courses-scroll-container {
    position: relative;
    margin: 15px 0;
    padding: 0 40px;
    width: 100%;
    overflow: hidden;
}

.courses-scroll-wrapper {
    overflow-x: hidden;
    width: 100%;
}

.courses-row {
    display: flex;
    gap: 15px;
    width: 100%;
}

.course-card {
    flex: 0 0 calc(20% - 12px); /* Show exactly 5 cards */
    min-width: 180px; /* Reduced minimum width */
    max-width: calc(20% - 12px);
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.course-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow);
}

.course-thumbnail {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.course-content {
    padding: 12px;
}

.course-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.course-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.category-badge, .status-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

.status-badge.draft {
    background: var(--warning-color);
    color: white;
}

.status-badge.published {
    background: var(--success-color);
    color: white;
}

/* Scroll Buttons */
.scroll-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    opacity: 0.8;
}

.scroll-button:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.scroll-left {
    left: 0;
}

.scroll-right {
    right: 0;
}

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

    .course-card {
        flex: 0 0 calc(25% - 12px); /* 4 cards on smaller screens */
        max-width: calc(25% - 12px);
    }
}

@media (max-width: 992px) {
    .mobile-menu-trigger {
        display: block;
    }

    .dashboard-sidebar {
        transform: translateX(-100%);
    }

    .dashboard-sidebar.active {
        transform: translateX(0);
    }

    .dashboard-main {
        margin-left: 0;
        width: 100%;
    }

    .navbar-brand span {
        display: none;
    }

    /* Stats container adjustments */
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card i {
        font-size: 1.5rem;
        padding: 0.75rem;
    }

    .stat-number {
        font-size: 1.2rem;
    }

    /* Charts container */
    .charts-container {
        grid-template-columns: 1fr;
    }

    .chart-card {
        padding: 1rem;
    }

    /* Course cards */
    .courses-scroll-container {
        padding: 0 30px;
    }

    .course-card {
        flex: 0 0 calc(50% - 10px);
        min-width: 150px;
    }

    /* Section containers */
    .section-container {
        padding: 1rem;
    }

    .section-header-with-action {
        flex-direction: column;
        gap: 10px;
    }

    .section-header-with-action h2 {
        font-size: 1.25rem;
    }

    /* Filter groups */
    .filter-group {
        flex-direction: column;
        width: 100%;
    }

    .filter-group select {
        width: 100%;
    }

    /* Mobile Chat Styles */
    .messaging-container {
        grid-template-columns: 1fr;
        height: calc(100vh - 150px);
        margin: 0;
        border-radius: 0;
        overflow: hidden;
    }

    .students-list {
        width: 100%;
        height: 100%;
        position: fixed;
        top: 76px; /* Match navbar height */
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        background: var(--bg-primary);
        display: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .students-list.active {
        display: block;
    }

    .chat-window {
        width: 100%;
        height: 100%;
        position: fixed;
        top: 76px; /* Match navbar height */
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        background: var(--bg-primary);
        display: none;
    }

    .chat-window.active {
        display: flex;
    }

    .chat-header {
        position: relative;
        padding: 1rem;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        height: 70px;
        display: flex;
        align-items: center;
    }

    .chat-back-btn {
        position: relative;
        left: 0;
        background: none;
        border: none;
        color: var(--text-primary);
        font-size: 1.2rem;
        padding: 0.5rem;
        margin-right: 0.5rem;
        cursor: pointer;
        z-index: 2;
    }

    .chat-user-info {
        display: flex;
        align-items: center;
        gap: 0.8rem;
        margin-left: 0;
    }

    .chat-user-info img {
        width: 40px;
        height: 40px;
    }

    .chat-user-info div h5 {
        font-size: 1rem;
        margin: 0;
    }

    .chat-user-info div small {
        font-size: 0.8rem;
    }

    .messages-container {
        height: calc(100% - 140px); /* Adjust for header and input heights */
        padding: 1rem;
        overflow-y: auto;
        background: var(--bg-secondary);
    }

    .message {
        margin-bottom: 1rem;
    }

    .message-content {
        max-width: 85%;
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
    }

    .message.sent .message-content {
        background: var(--primary-color);
    }

    .chat-input {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 0.8rem;
        background: var(--bg-primary);
        border-top: 1px solid var(--border-color);
        display: flex;
        gap: 0.5rem;
        height: 70px;
    }

    .chat-input input {
        flex: 1;
        height: 40px;
        padding: 0.5rem 1rem;
        font-size: 0.95rem;
    }

    .chat-input button {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    .student-chat-item {
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }

    .student-avatar {
        width: 45px;
        height: 45px;
    }

    .student-chat-info h5 {
        font-size: 1rem;
    }

    .course-name, .last-message {
        font-size: 0.85rem;
    }

    .unread-badge {
        right: 1rem;
    }

    /* Mobile Chat Styles */
    .messaging-container {
        grid-template-columns: 1fr;
        height: calc(100vh - 150px);
        position: relative;
    }

    .students-list {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 10;
        display: none;
        background: var(--bg-primary);
        padding: 1rem;
    }

    .students-list.active {
        display: block;
    }

    .chat-window {
        display: none;
        height: 100%;
    }

    .chat-window.active {
        display: flex;
    }

    /* Show student list by default on mobile if no chat is selected */
    .messaging-container:not(.chat-active) .students-list {
        display: block;
    }

    .chat-header {
        padding: 1rem;
        position: relative;
    }

    .chat-back-btn {
        position: absolute;
        left: 1rem;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: var(--text-primary);
        font-size: 1.2rem;
        padding: 0.5rem;
        cursor: pointer;
        z-index: 2;
    }

    .student-chat-item {
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }

    .student-avatar {
        width: 40px;
        height: 40px;
    }

    .chat-user-info {
        margin-left: 2.5rem;
    }

    .message-content {
        max-width: 85%;
    }

    .chat-input {
        padding: 0.8rem;
    }

    .chat-input input {
        padding: 0.6rem 1rem;
    }
}

@media (max-width: 576px) {
    .stats-container {
        grid-template-columns: 1fr;
    }

    .course-card {
        flex: 0 0 100%;
    }

    .navbar {
        padding: 0.5rem;
    }

    .profile-container {
        margin-left: auto;
    }

    /* Hide theme toggle on very small screens */
    .theme-toggle {
        display: none;
    }

    /* Adjust modal content */
    .modal-content {
        margin: 0;
        border-radius: 0;
        height: 100vh;
        width: 100vw;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    /* Table responsive */
    .table-responsive {
        margin: 0 -1rem;
    }

    .table td, .table th {
        padding: 0.5rem;
        font-size: 0.875rem;
    }

    .messaging-container {
        height: calc(100vh - 120px);
        border-radius: 0;
    }

    .students-list {
        padding: 0.5rem;
    }

    .student-chat-item {
        padding: 0.8rem;
    }

    .message-content {
        max-width: 90%;
        padding: 0.6rem 0.8rem;
    }

    .chat-input {
        padding: 0.8rem;
    }
}

/* Overlay for mobile when sidebar is active */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 76px; /* Match navbar height */
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1015;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Dark Mode Specific Adjustments */
[data-theme="dark"] .stat-card,
[data-theme="dark"] .section-container,
[data-theme="dark"] .course-card,
[data-theme="dark"] .activity-list {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .nav-item:hover,
[data-theme="dark"] .activity-item:hover {
    background-color: var(--hover-bg);
}

[data-theme="dark"] .nav-item.active {
    background-color: var(--hover-bg);
    border-left-color: var(--primary-color);
}

/* Button Styles */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Modal Styles */
.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-primary);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
}

.modal-title {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Course Details Modal Specific Styles */
.course-details-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.course-details-thumbnail {
    width: 300px;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.course-details-info {
    flex: 1;
}

.course-details-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.course-details-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.course-details-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.course-details-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Topics Section in Modal */
.topics-section {
    margin-top: 2rem;
}

.topics-section h4 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.topic-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.topic-header {
    padding: 1rem 1.5rem;
    background: var(--hover-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.topic-header h5 {
    margin: 0;
    color: var(--text-primary);
    font-weight: 600;
}

.toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    transition: transform 0.3s ease;
}

.toggle-btn:hover {
    color: var(--primary-color);
}

.topic-content {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.topic-content.show {
    padding: 1.5rem;
    max-height: 1000px;
}

.subtopic-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.subtopic-item {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.subtopic-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.subtopic-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.content-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.content-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.content-list a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.content-list a:hover {
    color: var(--secondary-color);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .course-details-header {
        flex-direction: column;
    }

    .course-details-thumbnail {
        width: 100%;
        height: 200px;
    }

    .course-details-meta {
        flex-wrap: wrap;
    }

    .topic-header {
        padding: 0.75rem 1rem;
    }

    .topic-content.show {
        padding: 1rem;
    }
}

/* Filter Section */
.filter-section {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    min-width: 150px;
}

/* Activity Sections */
.row.mt-4 {
    margin: 1rem -0.75rem;
    width: calc(100% + 1.5rem);
}

.col-md-6 {
    padding: 0 0.75rem;
}

/* Welcome Popup Styles */
.welcome-popup {
    border-radius: 16px !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--card-hover-shadow) !important;
    animation: slideIn 0.5s ease-out !important;
}

.welcome-popup .swal2-title {
    color: var(--text-primary) !important;
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    margin-bottom: 1rem !important;
}

.welcome-popup .swal2-content {
    color: var(--text-secondary) !important;
    font-size: 1rem !important;
}

.welcome-popup .swal2-icon {
    border-color: var(--success-color) !important;
    color: var(--success-color) !important;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Welcome Container Styles */
.welcome-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    animation: fadeIn 0.5s ease-out;
}

.welcome-content {
    max-width: 800px;
}

.welcome-content h1 {
    color: var(--text-primary);
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: var(--gradient-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-content p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin: 0;
    line-height: 1.5;
}

/* Update existing animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments for welcome container */
@media (max-width: 768px) {
    .welcome-container {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .welcome-content h1 {
        font-size: 1.75rem;
    }

    .welcome-content p {
        font-size: 1rem;
    }
}

/* Ratings Styles */
.ratings-stats {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.rating-overview {
    text-align: center;
    margin-bottom: 2rem;
}

.average-rating {
    font-size: 3rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.rating-bars {
    max-width: 600px;
    margin: 0 auto;
}

.rating-bar-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.rating-bar-item .progress {
    flex: 1;
    height: 0.5rem;
    background: var(--hover-bg);
}

.rating-bar-item .progress-bar {
    background: var(--primary-color);
}

.rating-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.star-rating {
    color: var(--warning-color);
    font-size: 0.9rem;
}

.rating-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Certificate Styles */
.certificates-container {
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.certificates-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card.certificate-stat {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card.certificate-stat:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow);
}

.certificate-stat .stat-number {
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 1rem 0;
}

.level-distribution {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.5rem;
    background: var(--hover-bg);
    border-radius: 12px;
}

.level-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border-radius: 8px;
    background: var(--bg-secondary);
}

.course-certificates {
    background: var(--bg-secondary);
    border-radius: 16px;
    margin-bottom: 2rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.course-certificates:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow);
}

.course-certificates-header {
    padding: 1.5rem;
    background: var(--hover-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.course-certificates-header h4 {
    font-size: 1.25rem;
    margin: 0;
    color: var(--text-primary);
}

.course-certificates-content {
    padding: 1.5rem;
}

.certificate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.certificate-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.certificate-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-hover-shadow);
}

.certificate-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--hover-bg);
}

.student-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.student-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.certificate-details {
    padding: 1.25rem;
    flex-grow: 1;
}

.certificate-info {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem 1.5rem;
    align-items: center;
}

.certificate-info span:nth-child(odd) {
    color: var(--text-secondary);
    font-weight: 500;
}

.certificate-info span:nth-child(even) {
    color: var(--text-primary);
}

.certificate-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem;
    background: var(--hover-bg);
    border-top: 1px solid var(--border-color);
}

.certificate-badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-beginner {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
}

.badge-intermediate {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    color: white;
}

.badge-advanced {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    color: white;
}

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

@media (max-width: 768px) {
    .certificates-stats {
        grid-template-columns: 1fr;
    }
    
    .certificate-grid {
        grid-template-columns: 1fr;
    }
    
    .certificates-container {
        padding: 1rem;
    }
}

/* Student Management Styles */
.students-management {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.students-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.student-stats-card {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

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

.student-stats-card h3 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.student-stats-card p {
    color: var(--text-secondary);
    margin: 0;
}

.course-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.course-progress-card {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.course-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.students-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
}

.students-table th {
    padding: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
}

.students-table td {
    padding: 1rem;
    background: var(--bg-primary);
    vertical-align: middle;
}

.student-row {
    transition: transform 0.3s ease;
}

.student-row:hover {
    transform: translateY(-2px);
}

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

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Chat Section Styles */
.messaging-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1rem;
    height: calc(100vh - 180px);
    background: var(--bg-secondary);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
}

.students-list {
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    height: 100%;
}

.student-chat-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.student-chat-item:hover {
    background: var(--hover-bg);
}

.student-chat-item.active {
    background: var(--hover-bg);
    border-left: 3px solid var(--primary-color);
}

.student-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.student-chat-info {
    flex: 1;
    min-width: 0;
}

.student-chat-info h5 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.course-name {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin: 0.2rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.last-message {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    padding: 0 6px;
}

.chat-window {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-primary);
    position: relative;
}

.chat-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    z-index: 2;
    display: flex;
    align-items: center;
    padding: 1rem;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-user-info img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.chat-user-info div h5 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.chat-user-info div small {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--bg-secondary);
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    position: absolute;
    top: 70px; /* Height of chat header */
    bottom: 70px; /* Height of chat input */
    left: 0;
    right: 0;
    overflow-x: hidden;
}

.message {
    display: flex;
    max-width: 80%;
    opacity: 1;
    transition: opacity 0.3s ease;
    animation: messageAppear 0.3s ease;
}

.message.sent {
    margin-left: auto;
}

.message-content {
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: var(--bg-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
}

.message.sent .message-content {
    background: var(--primary-color);
    color: white;
}

.message-content p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.message-content small {
    display: block;
    font-size: 0.7rem;
    margin-top: 0.3rem;
    opacity: 0.7;
}

.chat-input {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    z-index: 2;
    display: flex;
    align-items: center;
    padding: 1rem;
    gap: 0.5rem;
}

.chat-input input {
    flex: 1;
    padding: 0.8rem 1.2rem;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.chat-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.1);
}

.chat-input button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-input button:hover {
    transform: scale(1.1);
    background: var(--primary-color-dark);
}

.select-chat-message {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    gap: 1rem;
    padding: 2rem;
    text-align: center;
}

.select-chat-message i {
    font-size: 3rem;
    opacity: 0.5;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive Styles */
@media (max-width: 992px) {
    .messaging-container {
        grid-template-columns: 1fr;
        height: calc(100vh - 150px);
        position: relative;
    }

    .students-list {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 10;
        display: none;
        background: var(--bg-primary);
        padding: 1rem;
    }

    .students-list.active {
        display: block;
    }

    .chat-window {
        display: none;
        height: 100%;
    }

    .chat-window.active {
        display: flex;
    }

    /* Show student list by default on mobile if no chat is selected */
    .messaging-container:not(.chat-active) .students-list {
        display: block;
    }

    .chat-header {
        padding: 1rem;
        position: relative;
    }

    .chat-back-btn {
        position: absolute;
        left: 1rem;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: var(--text-primary);
        font-size: 1.2rem;
        padding: 0.5rem;
        cursor: pointer;
        z-index: 2;
    }

    .student-chat-item {
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }

    .student-avatar {
        width: 40px;
        height: 40px;
    }

    .chat-user-info {
        margin-left: 2.5rem;
    }

    .message-content {
        max-width: 85%;
    }

    .chat-input {
        padding: 0.8rem;
    }

    .chat-input input {
        padding: 0.6rem 1rem;
    }

    .chat-window {
        position: fixed;
        top: 76px; /* Match navbar height */
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
    }

    .messages-container {
        top: 60px; /* Slightly smaller header on mobile */
        bottom: 60px; /* Slightly smaller input on mobile */
    }

    .chat-header {
        height: 60px;
    }

    .chat-input {
        height: 60px;
    }
}

/* Small screens */
@media (max-width: 576px) {
    .messaging-container {
        height: calc(100vh - 120px);
        border-radius: 0;
    }

    .students-list {
        padding: 0.5rem;
    }

    .student-chat-item {
        padding: 0.8rem;
    }

    .message-content {
        max-width: 90%;
        padding: 0.6rem 0.8rem;
    }

    .chat-input {
        padding: 0.8rem;
    }
}

/* Mobile Responsive Styles */
@media (max-width: 992px) {
    .students-management {
        padding: 1rem;
    }

    .students-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .course-progress-grid {
        grid-template-columns: 1fr;
    }

    .students-table {
        font-size: 0.9rem;
    }

    .students-table th:nth-child(3),
    .students-table td:nth-child(3) {
        display: none;
    }

    .messaging-container {
        grid-template-columns: 1fr;
        height: calc(100vh - 150px);
    }

    .students-list {
        display: none;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 10;
    }

    .students-list.active {
        display: block;
    }

    .chat-window {
        display: none;
    }

    .chat-window.active {
        display: flex;
    }

    .chat-header {
        padding: 0.8rem;
    }

    .chat-back-btn {
        display: block;
        margin-right: 1rem;
        background: none;
        border: none;
        color: var(--text-primary);
        cursor: pointer;
    }

    .message-content {
        max-width: 85%;
    }

    .chat-input {
        padding: 0.8rem;
    }

    .chat-input input {
        padding: 0.6rem;
    }
}

/* Small screens */
@media (max-width: 576px) {
    .student-stats-card {
        padding: 1rem;
    }

    .student-stats-card h3 {
        font-size: 1.5rem;
    }

    .students-table th,
    .students-table td {
        padding: 0.8rem;
    }

    .student-avatar {
        width: 32px;
        height: 32px;
    }

    .messaging-container {
        height: calc(100vh - 120px);
    }

    .student-chat-item {
        padding: 0.8rem;
    }

    .message-content {
        max-width: 90%;
        padding: 0.6rem 0.8rem;
    }
}
