/**
 * aprender-gamification.css
 * Estilos del panel de puntos e insignias. Cargado en el dashboard del alumno.
 */

/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
    --alms-gold:        #f59e0b;
    --alms-gold-light:  #fef3c7;
    --alms-gold-border: #fcd34d;
    --alms-locked:      #9ca3af;
    --alms-locked-bg:   #f3f4f6;
    --alms-primary:     #2563eb;
    --alms-success:     #16a34a;
    --alms-text:        #111827;
    --alms-text-muted:  #6b7280;
    --alms-bg:          #ffffff;
    --alms-border:      #e5e7eb;
    --alms-surface:     #f9fafb;
    --alms-radius:      10px;
    --alms-font:        system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* ── Contenedor principal ───────────────────────────────────────────────── */

.alms-gamif {
    font-family: var(--alms-font);
    color: var(--alms-text);
}

.alms-gamif__section {
    margin-bottom: 32px;
}

.alms-gamif__section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--alms-text);
}

.alms-gamif__section-icon {
    font-size: 20px;
    color: var(--alms-gold);
}

.alms-gamif__subsection-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--alms-text-muted);
    margin: 16px 0 8px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ── Balance de puntos ──────────────────────────────────────────────────── */

.alms-gamif__balance-card {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1px solid var(--alms-gold-border);
    border-radius: var(--alms-radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.alms-gamif__balance-number {
    font-size: 48px;
    font-weight: 800;
    color: #92400e;
    line-height: 1;
}

.alms-gamif__balance-label {
    font-size: 13px;
    color: #78350f;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ── Historial de puntos ────────────────────────────────────────────────── */

.alms-gamif__history {
    background: var(--alms-bg);
    border: 1px solid var(--alms-border);
    border-radius: var(--alms-radius);
    overflow: hidden;
}

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

.alms-gamif__history-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--alms-border);
    font-size: 14px;
}

.alms-gamif__history-item:last-child {
    border-bottom: none;
}

.alms-gamif__history-label {
    color: var(--alms-text);
}

.alms-gamif__history-date {
    color: var(--alms-text-muted);
    font-size: 12px;
}

.alms-gamif__history-points {
    font-weight: 700;
    font-size: 15px;
    text-align: right;
}

.alms-gamif__history-points--positive { color: var(--alms-success); }
.alms-gamif__history-points--negative { color: #dc2626; }

/* ── Insignias ──────────────────────────────────────────────────────────── */

.alms-gamif__badge-count {
    margin-left: auto;
    font-size: 13px;
    font-weight: 500;
    color: var(--alms-text-muted);
    background: var(--alms-surface);
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid var(--alms-border);
}

.alms-gamif__badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
}

/* ── Tarjeta de insignia ────────────────────────────────────────────────── */

.alms-gamif__badge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    border-radius: var(--alms-radius);
    border: 2px solid var(--alms-border);
    text-align: center;
    transition: transform .15s, box-shadow .15s;
    cursor: default;
}

.alms-gamif__badge-item--earned {
    border-color: var(--alms-gold-border);
    background: var(--alms-gold-light);
    box-shadow: 0 2px 8px rgba(245, 158, 11, .15);
}

.alms-gamif__badge-item--locked {
    opacity: .6;
    background: var(--alms-locked-bg);
}

.alms-gamif__badge-item--earned:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, .25);
}

/* ── Ícono de la insignia ───────────────────────────────────────────────── */

.alms-gamif__badge-icon-wrap {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alms-gamif__badge-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
}

.alms-gamif__badge-item--locked .alms-gamif__badge-icon {
    filter: grayscale(100%);
}

.alms-gamif__badge-icon-default {
    font-size: 36px;
    line-height: 1;
}

.alms-gamif__badge-check {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: var(--alms-success);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    border: 2px solid var(--alms-bg);
}

/* ── Texto de la insignia ───────────────────────────────────────────────── */

.alms-gamif__badge-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--alms-text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.alms-gamif__badge-criteria {
    font-size: 11px;
    color: var(--alms-text-muted);
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.alms-gamif__badge-date {
    font-size: 11px;
    color: #92400e;
    font-weight: 500;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .alms-gamif__badges-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .alms-gamif__balance-number {
        font-size: 36px;
    }

    .alms-gamif__history-item {
        grid-template-columns: 1fr auto;
    }

    .alms-gamif__history-date {
        display: none;
    }
}
