/* ============================================
   LEARNING PORTAL - COMPLETE DASHBOARD STYLES
   ============================================ */

/* ============================================
   ROOT VARIABLES
   ============================================ */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --dark-color: #1f2937;
    --light-color: #f9fafb;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --sidebar-width: 260px;
    --header-height: 70px;
    --transition: all 0.3s ease;
}

/* ============================================
   GLOBAL STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--light-color);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

/* ============================================
   MAIN HEADER
   ============================================ */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 24px;
    max-width: 100%;
}

/* Logo Section */
.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 18px;
    color: var(--text-primary);

    transition: var(--transition);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition);
}

.header-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: var(--light-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.btn-icon:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger-color);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--light-color);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.user-menu-btn:hover {
    border-color: var(--primary-color);
}

.user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 280px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 100;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-info {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.user-avatar-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 12px;
    object-fit: cover;
}

.user-avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--light-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.user-avatar-placeholder i {
    font-size: 30px;
    color: var(--text-secondary);
}

.user-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.user-email {
    font-size: 13px;
    color: var(--text-secondary);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-primary);
    transition: var(--transition);
}

.user-dropdown-item:hover {
    background: var(--light-color);
}

.user-dropdown-item.danger {
    color: var(--danger-color);
}

.user-dropdown-item i {
    font-size: 18px;
    width: 20px;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--light-color);
    border-radius: 10px;
    cursor: pointer;
    font-size: 24px;
    color: var(--text-primary);
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: white;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 20px 0;
    z-index: 999;
    transition: var(--transition);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition);
    position: relative;
}

.nav-item:hover {
    background: var(--light-color);
    color: var(--primary-color);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-color);
}

.nav-item i {
    font-size: 20px;
    width: 24px;
}

.nav-item-text {
    flex: 1;
}

/* Submenu */
.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--light-color);
}

.submenu.open {
    max-height: 500px;
}

.submenu .nav-item {
    padding-left: 60px;
    font-size: 13px;
}

.submenu .nav-item i {
    font-size: 16px;
}

/* Nav Section */
.nav-section {
    margin-top: 24px;
}

.nav-section-title {
    padding: 12px 24px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: var(--transition);
}

.sidebar-overlay.show {
    opacity: 1;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 32px;
    min-height: calc(100vh - var(--header-height));
    transition: var(--transition);
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.dashboard-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 700;
}

/* ============================================
   STATISTICS CARDS
   ============================================ */
.stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.stat-icon.bg-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

.stat-icon.bg-success {
    background: linear-gradient(135deg, #10b981, #34d399);
}

.stat-icon.bg-info {
    background: linear-gradient(135deg, #06b6d4, #22d3ee);
}

.stat-icon.bg-warning {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.stat-content h3 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-content p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: none;
    margin-bottom: 24px;
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 20px 24px;
    border-radius: 16px 16px 0 0;
}

.card-body {
    padding: 24px;
}

/* ============================================
   COURSE CARDS
   ============================================ */
.course-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.course-thumbnail {
    position: relative;
    height: 180px;
    overflow: hidden;
}

.course-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.placeholder-thumbnail {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: white;
}

.placeholder-thumbnail.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

.placeholder-thumbnail.bg-gradient-info {
    background: linear-gradient(135deg, #06b6d4, #22d3ee);
}

.badge-pill {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.course-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.course-content h5, .course-content h6 {
    font-weight: 600;
    margin-bottom: 12px;
}

.course-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.course-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.price {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   TABLES
   ============================================ */
.table {
    margin-bottom: 0;
}

.table thead th {
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    padding: 16px;
}

.table tbody td {
    padding: 16px;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background: var(--light-color);
}

.avatar-sm {
    width: 36px;
    height: 36px;
    font-size: 14px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    font-weight: 500;
    border-radius: 8px;
    padding: 10px 20px;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    padding: 6px 12px;
    font-weight: 500;
    border-radius: 6px;
}

/* ============================================
   PROGRESS BARS
   ============================================ */
.progress {
    background: var(--light-color);
    border-radius: 8px;
}

.progress-bar {
    background: var(--success-color);
    border-radius: 8px;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    border-radius: 12px;
    padding: 16px 20px;
    border: none;
}

/* ============================================
   FOOTER
   ============================================ */
.main-footer {
    margin-left: var(--sidebar-width);
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 24px 32px;
    margin-top: 48px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.copyright {
    font-size: 14px;
    color: var(--text-secondary);
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    font-size: 14px;
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 991px) {
    .logo-section {
        padding-left: 0;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-footer {
        margin-left: 0;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .header-btn span {
        display: none;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 20px;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .dashboard-header h1 {
        font-size: 24px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .stat-content h3 {
        font-size: 24px;
    }
}

@media (max-width: 576px) {
    .header-content {
        padding: 0 16px;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .main-footer {
        padding: 20px 16px;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}