/* ===================================================================
   FLASHCARD QUIZ — PAINEL DO USUÁRIO & AVANÇO (perfil.css)
   Design System Premium: Glassmorphism, Micro-animações e KPIs
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #2563EB;
    --primary-light: #EFF6FF;
    --primary-glow: rgba(37, 99, 235, 0.25);
    --gold: #F59E0B;
    --gold-light: #FEF3C7;
    --emerald: #10B981;
    --emerald-light: #D1FAE5;
    --rose: #F43F5E;
    --rose-light: #FFE4E6;
    --purple: #8B5CF6;
    --purple-light: #EDE9FE;
    --slate-900: #0F172A;
    --slate-800: #1E293B;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748B;
    --slate-200: #E2E8F0;
    --slate-100: #F1F5F9;
    --slate-50: #F8FAFC;
    --white: #FFFFFF;
    --radius-lg: 20px;
    --radius-md: 14px;
    --shadow-card: 0 10px 25px -5px rgba(15, 23, 42, 0.06), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

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

/*
 * Impede que o root scroller (<html>) crie scroll horizontal.
 * Quando o body tem overflow-x:hidden mas o html não, o browser
 * usa o html como scroller e elementos com position:fixed ancoram
 * ao scrollWidth em vez do viewport real — causando distorção na navbar.
 */
html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #F0F4F8;
    color: var(--slate-800);
    min-height: 100vh;
    padding: 32px 16px 64px;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
}


.profile-container {
    width: 100%;
    max-width: 920px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: slideInFromRight 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

.profile-container.page-exit-right {
    transform: translateX(90px);
    opacity: 0;
}

@keyframes slideInFromRight {
    0% {
        opacity: 0;
        transform: translateX(100px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===================================================================
   1. NAVEGAÇÃO SUPERIOR
   =================================================================== */
.nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--white);
    border: 1.5px solid var(--slate-200);
    border-radius: 999px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.back-link:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    transform: translateX(-3px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--slate-100);
    border: 1px solid var(--slate-200);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: var(--slate-600);
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--emerald);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

/* ===================================================================
   2. CARD HERO DO USUÁRIO
   =================================================================== */
.user-hero-card {
    background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 100%);
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.user-hero-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #2563EB, #F59E0B, #10B981, #8B5CF6);
}

.user-hero-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.user-identity {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-avatar-wrap {
    position: relative;
}

.user-avatar {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border: 2.5px solid var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.25);
    line-height: 1;
}

.avatar-badge-star {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: var(--primary);
    color: var(--white);
    font-size: 11px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 999px;
    border: 2px solid var(--white);
}

.user-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-name-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--slate-900);
    letter-spacing: -0.02em;
}

.edit-name-btn {
    background: transparent;
    border: none;
    color: var(--slate-500);
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
}

.edit-name-btn:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.user-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--slate-600);
}

.user-role-badge b {
    color: var(--primary);
}

.user-date-info {
    font-size: 12px;
    color: var(--slate-500);
    font-weight: 500;
}

.user-hero-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.stat-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.stat-chip-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--slate-500);
}

.stat-chip-val {
    font-size: 18px;
    font-weight: 800;
    color: var(--slate-900);
}

/* Barra de Nível / XP */
.hero-xp-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 16px 20px;
}

.hero-xp-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
}

.hero-xp-title {
    color: var(--slate-900);
    display: flex;
    align-items: center;
    gap: 8px;
}

.hero-xp-vals {
    color: var(--slate-500);
}

.hero-xp-vals b {
    color: var(--gold);
}

.hero-xp-track {
    width: 100%;
    height: 12px;
    background: var(--slate-100);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.hero-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #F59E0B 0%, #FBBF24 50%, #10B981 100%);
    border-radius: 999px;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.hero-xp-bottom {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: var(--slate-500);
}

/* ===================================================================
   3. GRID DE CARDS KPI (INDICADORES DE PERFORMANCE)
   =================================================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.kpi-card {
    background: var(--white);
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    transition: transform 0.22s, box-shadow 0.22s;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
}

.kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.kpi-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.kpi-icon-streak { background: var(--rose-light); color: var(--rose); }
.kpi-icon-combo { background: var(--purple-light); color: var(--purple); }
.kpi-icon-acc { background: var(--emerald-light); color: var(--emerald); }
.kpi-icon-total { background: var(--primary-light); color: var(--primary); }

.kpi-tag {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--slate-100);
    color: var(--slate-600);
}

.kpi-val {
    font-size: 28px;
    font-weight: 900;
    color: var(--slate-900);
    line-height: 1.1;
    margin-bottom: 4px;
}

.kpi-sub {
    font-size: 12px;
    font-weight: 600;
    color: var(--slate-500);
}

/* ===================================================================
   4. METAS DIÁRIAS (DAILY GOALS)
   =================================================================== */
.daily-goal-card {
    background: var(--white);
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--slate-900);
    display: flex;
    align-items: center;
    gap: 8px;
}

.goal-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.goal-btn {
    background: var(--slate-100);
    border: 1px solid var(--slate-200);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 800;
    color: var(--slate-700);
    transition: background 0.15s;
}

.goal-btn:hover {
    background: var(--slate-200);
}

.goal-track {
    width: 100%;
    height: 14px;
    background: var(--slate-100);
    border-radius: 999px;
    overflow: hidden;
}

.goal-fill {
    height: 100%;
    background: linear-gradient(90deg, #10B981 0%, #34D399 100%);
    border-radius: 999px;
    transition: width 0.6s ease;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.goal-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    color: var(--slate-600);
}

/* ===================================================================
   5. VITRINE DE CONQUISTAS (ACHIEVEMENTS SHOWCASE)
   =================================================================== */
.achievements-card {
    background: var(--white);
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.badge-card {
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    background: var(--slate-50);
    transition: all 0.25s ease;
    position: relative;
}

.badge-card.unlocked {
    background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
    border-color: #FDE68A;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.12);
}

.badge-card.locked {
    opacity: 0.55;
    filter: grayscale(0.9);
}

.badge-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--white);
    border: 1.5px solid var(--slate-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.badge-card.unlocked .badge-icon {
    border-color: var(--gold);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.badge-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--slate-900);
    line-height: 1.2;
}

.badge-desc {
    font-size: 11px;
    color: var(--slate-500);
    line-height: 1.3;
}

.badge-status {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 999px;
}

.badge-card.unlocked .badge-status {
    background: #D97706;
    color: var(--white);
}

.badge-card.locked .badge-status {
    background: var(--slate-200);
    color: var(--slate-600);
}

/* ===================================================================
   6. CARD DE PREPARAÇÃO ONLINE (FUTURO DO APK)
   =================================================================== */
.cloud-future-card {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.2);
    position: relative;
    overflow: hidden;
}

.cloud-future-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.3) 0%, transparent 70%);
    pointer-events: none;
}

.cloud-future-info h3 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cloud-future-info p {
    font-size: 13px;
    color: #94A3B8;
    line-height: 1.5;
    max-width: 580px;
}

.cloud-future-badge {
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.25);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #93C5FD;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ===================================================================
   7. FOOTER & AÇÕES DE DADOS (RESET / BACKUP)
   =================================================================== */
.data-actions-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 10px;
}

.data-btn {
    background: transparent;
    border: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--slate-500);
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
}

.data-btn:hover {
    color: var(--slate-800);
}

.data-btn.danger:hover {
    color: var(--rose);
}

/* ===================================================================
   8. RESPONSIVIDADE MOBILE
   =================================================================== */
@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .user-hero-main {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-hero-stats {
        width: 100%;
        justify-content: space-between;
    }

    .cloud-future-card {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    body {
        padding: 16px 10px 48px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .achievements-grid {
        grid-template-columns: 1fr;
    }

    .stat-chip {
        flex: 1;
        align-items: center;
    }
}

/* ═══════════════════════════════════════════════
   HISTÓRICO DE SIMULADOS
   ═══════════════════════════════════════════════ */

.history-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--slate-200);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--slate-200) transparent;
}

.history-list::-webkit-scrollbar {
    width: 4px;
}
.history-list::-webkit-scrollbar-thumb {
    background: var(--slate-200);
    border-radius: 99px;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    transition: background 0.2s, transform 0.15s;
}

.history-item:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    transform: translateX(2px);
}

.history-item-left {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.history-module {
    font-size: 14px;
    font-weight: 700;
    color: var(--slate-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    font-size: 12px;
    color: var(--slate-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta b {
    color: var(--primary);
}

.history-pct {
    flex-shrink: 0;
    font-size: 15px;
    font-weight: 900;
    padding: 6px 12px;
    border-radius: 99px;
    min-width: 56px;
    text-align: center;
}

.history-pct.pct-high {
    background: var(--emerald-light);
    color: #059669;
}

.history-pct.pct-mid {
    background: #FEF3C7;
    color: #D97706;
}

.history-pct.pct-low {
    background: #FFE4E6;
    color: #E11D48;
}

.history-empty {
    text-align: center;
    font-size: 14px;
    color: var(--slate-500);
    padding: 32px 16px;
    line-height: 1.7;
    background: var(--slate-50);
    border-radius: var(--radius-md);
    border: 1.5px dashed var(--slate-200);
}

