/* ===========================
   CSS VARIABLES & RESET
   =========================== */
:root {
    /* Color Scheme - As Required */
    --primary: #2563EB;
    --background: #F8FAFC;
    --text: #0F172A;
    --cards: #FFFFFF;
    --success: #22C55E;
    --muted: #64748B;
    
    /* Additional Utility Colors */
    --primary-hover: #1D4ED8;
    --primary-light: #DBEAFE;
    --border: #E2E8F0;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --warning: #F59E0B;
    --info: #3B82F6;
    
    /* Typography */
    --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===========================
   NAVIGATION BAR
   =========================== */
.navbar {
    background: var(--cards);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.brand-icon {
    flex-shrink: 0;
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 0.5rem 1rem;
    background: var(--gray-100);
    border-radius: var(--radius-lg);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.user-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
}

.user-role {
    font-size: 0.75rem;
    color: var(--muted);
}

.logout-btn {
    padding: 0.625rem 1.25rem;
    background: transparent;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    transition: var(--transition);
    font-family: var(--font-family);
}

.logout-btn:hover {
    background: var(--gray-100);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

/* ===========================
   MAIN DASHBOARD
   =========================== */
.dashboard-main {
    flex: 1;
    padding: var(--spacing-lg) 0;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

/* ===========================
   WELCOME SECTION
   =========================== */
.welcome-section {
    background: linear-gradient(135deg, var(--primary) 0%, #1D4ED8 100%);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease-out;
    position: relative;
    overflow: hidden;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.welcome-content {
    position: relative;
    z-index: 1;
}

.welcome-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    line-height: 1.2;
}

.welcome-subtitle {
    font-size: 1.125rem;
    opacity: 0.9;
}

.welcome-decoration {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* ===========================
   STATS SECTION
   =========================== */
.stats-section {
    animation: fadeInUp 0.6s ease-out 0.1s backwards;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

.stat-card {
    background: var(--cards);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.courses-icon {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.lessons-icon {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.progress-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--muted);
    font-weight: 500;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
}

/* ===========================
   SECTION HEADERS
   =========================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}

.view-all-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: var(--transition-fast);
}

.view-all-link:hover {
    color: var(--primary-hover);
    transform: translateX(4px);
}

/* ===========================
   COURSES SECTION
   =========================== */
.courses-section {
    animation: fadeInUp 0.6s ease-out 0.2s backwards;
}

.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--spacing-md);
}

.course-card {
    background: var(--cards);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    border: 2px solid transparent;
}

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.course-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.course-icon-wrapper {
    width: 56px;
    height: 56px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.course-badge {
    padding: 0.375rem 0.75rem;
    background: var(--success);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.course-badge.in-progress {
    background: var(--warning);
}

.course-body {
    flex: 1;
}

.course-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--spacing-xs);
}

.course-meta {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: var(--muted);
}

.course-progress-section {
    margin-bottom: var(--spacing-md);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xs);
}

.progress-label {
    font-size: 0.875rem;
    color: var(--muted);
    font-weight: 500;
}

.progress-percentage {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #3B82F6);
    border-radius: 999px;
    transition: width 1s ease-out;
}

.course-footer {
    display: flex;
    gap: var(--spacing-sm);
}

.continue-btn {
    flex: 1;
    padding: 0.75rem 1.25rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    font-family: var(--font-family);
}

.continue-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===========================
   EMPTY STATE
   =========================== */
.empty-state {
    background: var(--cards);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    text-align: center;
    box-shadow: var(--shadow-md);
}

.empty-icon {
    margin-bottom: var(--spacing-md);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.empty-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--spacing-xs);
}

.empty-description {
    color: var(--muted);
    margin-bottom: var(--spacing-lg);
}

.browse-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 0.875rem 1.75rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition);
}

.browse-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===========================
   ACTIVITY SECTION
   =========================== */
.activity-section {
    animation: fadeInUp 0.6s ease-out 0.3s backwards;
}

.activity-card {
    background: var(--cards);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
}

.activity-item {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.activity-item:hover {
    background: var(--gray-100);
}

.activity-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.activity-description {
    font-size: 0.875rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--muted);
}

.activity-status {
    align-self: flex-start;
    padding: 0.375rem 0.75rem;
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

/* ===========================
   FOOTER
   =========================== */
.dashboard-footer {
    background: var(--cards);
    border-top: 1px solid var(--border);
    padding: var(--spacing-lg) 0;
    margin-top: var(--spacing-xl);
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-container p {
    color: var(--muted);
    font-size: 0.875rem;
}

.footer-links {
    display: flex;
    gap: var(--spacing-md);
}

.footer-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: var(--transition-fast);
}

.footer-links a:hover {
    color: var(--primary);
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */
@media (max-width: 1024px) {
    .dashboard-container {
        padding: 0 1.5rem;
    }
    
    .nav-container {
        padding: 1rem 1.5rem;
    }
    
    .welcome-title {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: stretch;
    }
    
    .nav-actions {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .user-info {
        justify-content: center;
    }
    
    .logout-btn {
        justify-content: center;
    }
    
    .welcome-section {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-lg);
    }
    
    .welcome-decoration {
        display: none;
    }
    
    .welcome-title {
        font-size: 1.75rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .courses-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }
    
    .footer-container {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }
    
    .footer-links {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    .dashboard-container {
        padding: 0 1rem;
    }
    
    .nav-container {
        padding: 1rem;
    }
    
    .welcome-section {
        padding: var(--spacing-lg);
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .course-header {
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-sm);
    }
}

/* ===========================
   LOADING STATES
   =========================== */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===========================
   ACCESSIBILITY
   =========================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}