/* ══════════════════════════════════════════════════════════
   Edu Gamification – Public Styles
   ══════════════════════════════════════════════════════════ */

/* ── Variables ────────────────────────────────────────────── */
:root {
    --eg-primary: #667eea;
    --eg-secondary: #764ba2;
    --eg-gold: #FFD700;
    --eg-silver: #C0C0C0;
    --eg-bronze: #CD7F32;
    --eg-bg: #f5f7fb;
    --eg-card: #ffffff;
    --eg-text: #333333;
    --eg-text-light: #888888;
    --eg-radius: 12px;
    --eg-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* ── Base ──────────────────────────────────────────────────── */
.eg-notice {
    padding: 15px 20px;
    background: #fff3cd;
    border-radius: var(--eg-radius);
    color: #856404;
    text-align: center;
}
.eg-empty-msg {
    text-align: center;
    color: var(--eg-text-light);
    padding: 30px;
}
.eg-section {
    margin-bottom: 30px;
}
.eg-section h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--eg-text);
    margin-bottom: 15px;
}

/* ══════════════════════════════════════════════════════════
   PROFESSOR PANEL
   ══════════════════════════════════════════════════════════ */

.eg-professor-panel {
    max-width: 900px;
    margin: 0 auto;
}
.eg-panel-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--eg-text);
    margin-bottom: 20px;
}
.eg-panel-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    background: var(--eg-card);
    padding: 20px;
    border-radius: var(--eg-radius);
    box-shadow: var(--eg-shadow);
    margin-bottom: 20px;
}
.eg-control-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.eg-control-row label {
    font-size: 12px;
    font-weight: 600;
    color: var(--eg-text-light);
    text-transform: uppercase;
}
.eg-select, .eg-input-small {
    padding: 8px 12px;
    border: 2px solid #e0e5ec;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}
.eg-select:focus, .eg-input-small:focus {
    border-color: var(--eg-primary);
}
.eg-input-small { width: 80px; }

/* ── Student Cards Grid ───────────────────────────────────── */
.eg-students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.eg-student-card {
    background: var(--eg-card);
    border-radius: var(--eg-radius);
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--eg-shadow);
    transition: transform 0.15s, box-shadow 0.15s;
}
.eg-student-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.eg-student-avatar {
    position: relative;
    flex-shrink: 0;
}
.eg-student-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}
.eg-student-level {
    position: absolute;
    bottom: -4px;
    right: -4px;
    font-size: 14px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}
.eg-student-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.eg-student-name { font-size: 14px; font-weight: 600; color: var(--eg-text); }
.eg-student-points { font-size: 12px; color: var(--eg-text-light); }
.eg-student-streak { font-size: 11px; color: var(--eg-primary); }
.eg-award-btn {
    background: linear-gradient(135deg, var(--eg-primary), var(--eg-secondary));
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    white-space: nowrap;
}
.eg-award-btn:hover { opacity: 0.9; transform: scale(1.05); }
.eg-award-btn:active { transform: scale(0.95); }

/* ── Toast ─────────────────────────────────────────────────── */
.eg-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    animation: egToastIn 0.3s ease;
}
@keyframes egToastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ══════════════════════════════════════════════════════════
   STUDENT DASHBOARD
   ══════════════════════════════════════════════════════════ */

.eg-student-dashboard {
    max-width: 800px;
    margin: 0 auto;
}

/* ── Hero ──────────────────────────────────────────────────── */
.eg-hero {
    background: linear-gradient(135deg, var(--level-color, var(--eg-primary)), var(--eg-secondary));
    border-radius: 16px;
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    color: #fff;
    margin-bottom: 20px;
}
.eg-hero-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.5);
}
.eg-hero-info { flex: 1; }
.eg-hero-info h2 { margin: 0 0 8px; font-size: 24px; }
.eg-level-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}
.eg-xp-bar-wrap { margin-top: 12px; }
.eg-xp-bar {
    height: 12px;
    background: rgba(255,255,255,0.25);
    border-radius: 6px;
    overflow: hidden;
}
.eg-xp-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.8s ease;
}
.eg-xp-text {
    font-size: 12px;
    opacity: 0.85;
    margin-top: 4px;
    display: block;
}

/* ── Quick Stats ──────────────────────────────────────────── */
.eg-quick-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}
.eg-qs-card {
    background: var(--eg-card);
    border-radius: var(--eg-radius);
    padding: 18px;
    text-align: center;
    box-shadow: var(--eg-shadow);
}
.eg-qs-number {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: var(--eg-primary);
}
.eg-qs-label {
    display: block;
    font-size: 12px;
    color: var(--eg-text-light);
    margin-top: 4px;
}

/* ── Achievements Showcase ────────────────────────────────── */
.eg-achievements-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.eg-achievement {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px;
    border-radius: var(--eg-radius);
    text-align: center;
    width: 80px;
    transition: transform 0.2s;
}
.eg-achievement:hover { transform: scale(1.1); }
.eg-unlocked {
    background: linear-gradient(135deg, #fff8e1, #fff3c4);
    box-shadow: 0 2px 8px rgba(255,193,7,0.2);
}
.eg-locked {
    background: #f5f5f5;
    opacity: 0.5;
    filter: grayscale(1);
}
.eg-ach-icon { font-size: 28px; }
.eg-ach-name { font-size: 10px; font-weight: 600; color: var(--eg-text); line-height: 1.2; }

/* ── Category Bars ────────────────────────────────────────── */
.eg-cat-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.eg-cat-label { width: 140px; font-size: 13px; font-weight: 500; }
.eg-cat-bar {
    flex: 1;
    height: 18px;
    background: #f0f0f0;
    border-radius: 9px;
    overflow: hidden;
}
.eg-cat-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--eg-primary), var(--eg-secondary));
    border-radius: 9px;
    transition: width 0.6s ease;
}
.eg-cat-value { width: 40px; text-align: right; font-weight: 700; font-size: 13px; color: var(--eg-text); }

/* ── Weekly Chart ─────────────────────────────────────────── */
.eg-weekly-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 150px;
    padding: 10px 0;
}
.eg-week-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}
.eg-week-bar {
    width: 100%;
    flex: 1;
    background: #f0f0f0;
    border-radius: 6px 6px 0 0;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}
.eg-week-fill {
    width: 100%;
    background: linear-gradient(180deg, var(--eg-primary), var(--eg-secondary));
    border-radius: 6px 6px 0 0;
    transition: height 0.6s ease;
    min-height: 4px;
}
.eg-week-label { font-size: 10px; color: var(--eg-text-light); margin-top: 4px; }
.eg-week-value { font-size: 11px; font-weight: 700; color: var(--eg-text); }

/* ── Activity List ────────────────────────────────────────── */
.eg-activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.eg-activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}
.eg-act-icon { font-size: 18px; flex-shrink: 0; }
.eg-act-text { flex: 1; font-size: 13px; color: var(--eg-text); }
.eg-act-time { font-size: 11px; color: var(--eg-text-light); white-space: nowrap; }

/* ══════════════════════════════════════════════════════════
   RANKING
   ══════════════════════════════════════════════════════════ */

.eg-ranking-wrap {
    max-width: 700px;
    margin: 0 auto;
}
.eg-ranking-title {
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    color: var(--eg-text);
    margin-bottom: 25px;
}

/* ── Podium ───────────────────────────────────────────────── */
.eg-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 30px;
}
.eg-podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 15px 15px;
    border-radius: 16px;
    background: var(--eg-card);
    box-shadow: var(--eg-shadow);
    position: relative;
    width: 140px;
    text-align: center;
}
.eg-podium-gold {
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(255,215,0,0.3);
    border: 2px solid var(--eg-gold);
    order: 0;
}
.eg-podium-silver {
    border: 2px solid var(--eg-silver);
    order: -1;
}
.eg-podium-bronze {
    border: 2px solid var(--eg-bronze);
    order: 1;
}
.eg-podium-pos {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: #fff;
}
.eg-podium-gold .eg-podium-pos { background: var(--eg-gold); color: #333; }
.eg-podium-silver .eg-podium-pos { background: var(--eg-silver); color: #333; }
.eg-podium-bronze .eg-podium-pos { background: var(--eg-bronze); color: #fff; }
.eg-podium-avatar img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
}
.eg-podium-name { font-size: 13px; font-weight: 700; color: var(--eg-text); }
.eg-podium-points { font-size: 16px; font-weight: 800; color: var(--eg-primary); }
.eg-podium-level {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
}

/* ── Ranking List ─────────────────────────────────────────── */
.eg-ranking-list {
    background: var(--eg-card);
    border-radius: var(--eg-radius);
    box-shadow: var(--eg-shadow);
    overflow: hidden;
}
.eg-rank-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
}
.eg-rank-row:hover { background: #fafbff; }
.eg-rank-me {
    background: #f0f4ff !important;
    border-left: 4px solid var(--eg-primary);
}
.eg-rank-pos {
    width: 30px;
    font-size: 16px;
    font-weight: 800;
    color: var(--eg-text-light);
    text-align: center;
}
.eg-rank-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}
.eg-rank-name { flex: 1; font-weight: 600; font-size: 14px; color: var(--eg-text); }
.eg-rank-level { font-size: 12px; font-weight: 500; }
.eg-rank-points { font-size: 14px; font-weight: 800; color: var(--eg-primary); white-space: nowrap; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */

@media (max-width: 600px) {
    .eg-hero { flex-direction: column; text-align: center; }
    .eg-quick-stats { grid-template-columns: repeat(2, 1fr); }
    .eg-podium { flex-direction: column; align-items: center; }
    .eg-podium-gold { transform: none; order: 0; }
    .eg-podium-silver { order: 1; }
    .eg-podium-bronze { order: 2; }
    .eg-panel-controls { flex-direction: column; }
    .eg-students-grid { grid-template-columns: 1fr; }
    .eg-cat-bar-row { flex-wrap: wrap; }
    .eg-cat-label { width: 100%; }
}
