/* dashboard.css - Elegant Learning Dashboard */
/* Matches Manakahthey LIT aesthetic */

:root {
    --primary-gold: #ffd700;
    --light-gold: #f8e49b;
    --warm-cream: #e5c98d;
    --bg-dark: #0f0a06;
    --bg-secondary: #1a1410;
    --bg-tertiary: #221a12;
    --card-dark: #161b22;
    --card-brown: #1a1f26;
    --border-brown: #3d2f24;
    --border-light: #52413a;
    --purple: #a78bfa;
    --light-purple: #c4b5fd;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --success: #3fb950;
    --warning: #d29922;
    --error: #f85149;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Manakahthey', 'Noto Sans Hebrew';
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ============================================================
   BACKGROUND & SHIMMER
   ============================================================ */

.background-parchment {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 15% 25%, rgba(255, 215, 0, 0.03) 0%, transparent 40%),
        radial-gradient(circle at 85% 75%, rgba(167, 139, 250, 0.02) 0%, transparent 40%);
    z-index: -1;
    pointer-events: none;
}

.top-shimmer-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-gold), var(--purple), #ff1493, var(--primary-gold));
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
    z-index: 9999;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% 50%; opacity: 0.7; }
    50% { background-position: 100% 50%; opacity: 1; }
}

/* ============================================================
   CONTAINER & HEADER
   ============================================================ */

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

.dashboard-header {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.15), rgba(255, 215, 0, 0.1));
    border: 1px solid var(--border-brown);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.header-logo {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    border: 2px solid var(--purple);
}

.header-text h1 {
    color: var(--primary-gold);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.header-text p {
    color: var(--warm-cream);
    font-size: 1rem;
    opacity: 0.9;
}

/* ============================================================
   LOADING STATE
   ============================================================ */

.loading-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--primary-gold);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(167, 139, 250, 0.2);
    border-top-color: var(--primary-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   STATS GRID
   ============================================================ */

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

.stat-card {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.2), rgba(167, 139, 250, 0.1));
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--purple);
    box-shadow: 0 8px 25px rgba(167, 139, 250, 0.2);
}

.stat-card.streak { border-left: 3px solid #f97316; }
.stat-card.lessons { border-left: 3px solid var(--success); }
.stat-card.videos { border-left: 3px solid var(--purple); }
.stat-card.games { border-left: 3px solid #60a5fa; }
.stat-card.time { border-left: 3px solid var(--primary-gold); }

.stat-icon {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-gold);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================
   CREDITS CARD
   ============================================================ */

.credits-card {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem 2rem !important;
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.15), rgba(255, 215, 0, 0.08)) !important;
    margin-bottom: 1.5rem;
}

.credits-visual {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.credits-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: rgba(167, 139, 250, 0.2);
    stroke-width: 8;
}

.ring-progress {
    fill: none;
    stroke: var(--primary-gold);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 264;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.5s ease;
}

.credits-count {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-gold);
}

.credits-divider {
    opacity: 0.5;
    margin: 0 2px;
}

.credits-info h2 {
    color: var(--primary-gold);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.credits-reset {
    color: var(--warm-cream);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.credits-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ============================================================
   TWO COLUMN LAYOUT
   ============================================================ */

.dashboard-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.dashboard-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ============================================================
   DASHBOARD CARDS
   ============================================================ */

.dashboard-card {
    background: var(--card-brown);
    border: 1px solid var(--border-brown);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    border-color: rgba(167, 139, 250, 0.4);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.card-header:hover {
    background: rgba(167, 139, 250, 0.1);
}

.card-header h2 {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--light-gold);
    margin: 0;
}

.card-icon {
    font-size: 1.1rem;
}

.toggle-arrow {
    color: var(--primary-gold);
    font-size: 0.9rem;
    transition: transform 0.3s;
}

.card-header.open .toggle-arrow {
    transform: rotate(180deg);
}

.activity-count, .achievement-percent {
    background: rgba(167, 139, 250, 0.2);
    color: var(--light-purple);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.card-content {
    padding: 1.25rem;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s;
}

.card-content.collapsed {
    max-height: 0;
    padding: 0 1.25rem;
}

.scrollable-content {
    max-height: 350px;
    overflow-y: auto;
}

/* Custom Scrollbar */
.scrollable-content::-webkit-scrollbar {
    width: 6px;
}

.scrollable-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.scrollable-content::-webkit-scrollbar-thumb {
    background: var(--purple);
    border-radius: 3px;
}

/* ============================================================
   MINI STATS (Flashcards, Games)
   ============================================================ */

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

.mini-stat {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-brown);
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
}

.mini-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-gold);
}

.mini-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.card-action-btn {
    display: block;
    text-align: center;
    padding: 0.75rem;
    margin-top: 1rem;
    background: linear-gradient(135deg, var(--purple), #8b5cf6);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s;
}

.card-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(167, 139, 250, 0.4);
}

/* ============================================================
   PROGRESS SECTIONS
   ============================================================ */

.progress-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(61, 47, 36, 0.5);
}

.progress-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--warm-cream);
    cursor: pointer;
}

.progress-count {
    color: var(--light-purple);
    font-weight: 600;
}

.progress-bar {
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-gold), var(--light-gold));
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}

.lessons-list {
    max-height: 200px;
    overflow-y: auto;
}

.lessons-list.collapsed-list {
    max-height: 0;
    overflow: hidden;
}

.lesson-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(61, 47, 36, 0.3);
    border-radius: 6px;
    margin-bottom: 0.4rem;
    text-decoration: none;
    color: var(--warm-cream);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.lesson-item:hover {
    background: rgba(167, 139, 250, 0.1);
    border-color: var(--purple);
}

.lesson-item.completed {
    opacity: 0.6;
}

.lesson-checkbox {
    font-size: 1rem;
}

/* ============================================================
   ACTIVITY ITEMS
   ============================================================ */

.activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(61, 47, 36, 0.3);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.activity-item:hover {
    background: rgba(167, 139, 250, 0.1);
    transform: translateX(3px);
}

.activity-icon {
    width: 36px;
    height: 36px;
    background: var(--purple);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.activity-info {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: var(--light-gold);
    font-size: 0.9rem;
}

.activity-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ============================================================
   ACHIEVEMENTS
   ============================================================ */

.achievement-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--purple), var(--light-purple));
    color: white;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.achievement-item.locked {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-brown);
    color: var(--text-secondary);
    opacity: 0.6;
}

.achievement-icon {
    font-size: 1.5rem;
}

.achievement-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.achievement-desc {
    font-size: 0.75rem;
    opacity: 0.9;
}

/* ============================================================
   LEADERBOARD
   ============================================================ */

.leaderboard-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.lb-tab {
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-brown);
    border-radius: 6px;
    color: var(--warm-cream);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.lb-tab:hover {
    border-color: var(--purple);
}

.lb-tab.active {
    background: var(--purple);
    border-color: var(--purple);
    color: white;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(61, 47, 36, 0.3);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.leaderboard-item.current-user {
    background: rgba(167, 139, 250, 0.2);
    border: 2px solid var(--purple);
}

.lb-rank {
    font-size: 1.25rem;
    font-weight: 700;
    width: 36px;
    text-align: center;
}

.lb-rank.gold { color: #ffd700; }
.lb-rank.silver { color: #c0c0c0; }
.lb-rank.bronze { color: #cd7f32; }

.lb-user {
    flex: 1;
    font-weight: 500;
    color: var(--light-gold);
}

.lb-value {
    font-weight: 600;
    color: var(--primary-gold);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

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

.empty-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

/* ============================================================
   VIDEO ITEMS
   ============================================================ */

.video-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-brown);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.video-item:hover {
    background: rgba(167, 139, 250, 0.1);
    border-color: var(--purple);
}

.video-item.locked {
    opacity: 0.5;
}

.video-thumb {
    width: 80px;
    height: 45px;
    background: var(--bg-dark);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.video-info {
    flex: 1;
}

.video-title {
    font-weight: 600;
    color: var(--warm-cream);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.video-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.video-status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.video-status.unlocked {
    background: rgba(63, 185, 80, 0.2);
    color: var(--success);
}

.video-status.locked {
    background: rgba(139, 148, 158, 0.2);
    color: var(--text-secondary);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
    .dashboard-columns {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        padding: 1rem;
    }
    
    .dashboard-header {
        padding: 1rem 1.25rem;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .header-text h1 {
        font-size: 1.4rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-card:nth-child(5) {
        grid-column: span 2;
    }
    
    .credits-card {
        flex-direction: column;
        text-align: center;
    }
    
    .credits-visual {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 480px) {
    .header-logo {
        width: 50px;
        height: 50px;
    }
    
    .stat-value {
        font-size: 1.4rem;
    }
    
    .mini-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
}
