/* ============================================
   GAMIFICATION - VARIÁVEIS CSS
   Paleta: Espectro Clínico
   ============================================ */

:root {
    /* Cores do Espectro Clínico */
    --scopsy-blue: #2952CC;
    --module-act: #0891B2;
    --module-dbt: #7C3AED;

    /* Gradientes de Gamificação */
    --cognit-gradient: linear-gradient(135deg, #0891B2 0%, #2952CC 50%, #7C3AED 100%);
    --streak-gradient: linear-gradient(135deg, #7C3AED 0%, #2952CC 50%, #0891B2 100%);
    --levelup-gradient: linear-gradient(135deg, #0891B2 0%, #2952CC 50%, #7C3AED 100%);

    /* Estados */
    --success: #059669;
    --error: #DC2626;
    --warning: #F59E0B;

    /* Neutros */
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --bg-tertiary: #F1F5F9;
    --border-light: #E2E8F0;
}

/* =========================================
   LEVEL CARD (Cognits)
   ========================================= */

.level-card {
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    border: 2px solid #e0e7ff;
    border-radius: 16px;
    padding: 24px;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 220px; /* Altura mínima igual */
}

.level-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.15);
    border-color: #c7d2fe;
}

.level-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}

.level-icon {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
}

.level-info {
    flex: 1;
}

.level-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6366f1;
    margin: 0 0 4px 0;
}

.level-name {
    font-size: 20px; /* MESMO TAMANHO */
    font-weight: 700; /* MESMO PESO */
    color: #1e293b;
    margin: 0;
    line-height: 1.2;
}

.level-progress {
    margin-top: auto; /* Empurra para baixo */
    padding-top: 16px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #e0e7ff;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 6px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 14px;
    color: #64748b;
}

.progress-text .current {
    font-weight: 700;
    color: #6366f1;
    font-size: 16px;
}

.progress-text .separator {
    color: #cbd5e1;
}

.progress-text .target {
    font-weight: 600;
    color: #475569;
}

.progress-text .unit {
    font-weight: 500;
    color: #94a3b8;
}

.level-next {
    font-size: 13px;
    color: #64748b;
    margin: 12px 0 0 0;
    line-height: 1.4;
}

.level-next strong {
    color: #6366f1;
    font-weight: 700;
}

.level-next .next-level {
    color: #8b5cf6;
    font-weight: 600;
}

.cognit-counter {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(99, 102, 241, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: help;
}

.cognit-icon {
    width: 20px;
    height: 20px;
}

.cognit-amount {
    font-size: 16px;
    font-weight: 700;
    color: #6366f1;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */

@media (max-width: 640px) {
    .level-card {
        padding: 16px;
    }

    .level-name {
        font-size: 20px;
    }

    .level-icon {
        font-size: 36px;
    }

    .cognit-counter {
        padding: 6px 12px;
    }

    .cognit-amount {
        font-size: 16px;
    }
}

/* ============================================
   DAILY MISSIONS
   ============================================ */

.missions-section {
    margin-bottom: 40px;
    padding: 0 16px;
}

.missions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.missions-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.missions-timer {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    padding: 4px 12px;
    border-radius: 99px;
}

.missions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.mission-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.mission-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.05);
    border-color: #CBD5E1;
}

.mission-card.completed {
    border-color: #22C55E;
    /* Verde */
    background: linear-gradient(to bottom right, #ffffff, #F0FDF4);
}

.mission-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.mission-desc {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.4;
    flex: 1;
    margin-right: 12px;
}

.mission-reward {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    color: #0891B2;
    /* Scopsy Blue */
    font-size: 0.9rem;
    background: #ECFEFF;
    padding: 4px 8px;
    border-radius: 8px;
}

.mission-card.completed .mission-reward {
    color: #22C55E;
    background: #DCFCE7;
}

.mission-progress-container {
    margin-top: 12px;
}

.mission-progress-bar {
    height: 8px;
    background: #E2E8F0;
    border-radius: 99px;
    overflow: hidden;
}

.mission-progress-fill {
    height: 100%;
    background: var(--cognit-gradient);
    border-radius: 99px;
    transition: width 0.5s ease-out;
}

.mission-card.completed .mission-progress-fill {
    background: #22C55E;
}

.mission-progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 6px;
    font-weight: 500;
}

.check-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #22C55E;
    width: 24px;
    height: 24px;
    display: none;
    animation: bounce-in 0.4s;
}

.mission-card.completed .check-icon {
    display: block;
}

/* Esconder meta original se completado */
.mission-card.completed .mission-meta {
    justify-content: space-between;
    width: auto;
}

@keyframes bounce-in {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* ============================================
   BADGES SYSTEM
   ============================================ */

.badges-section {
    margin-bottom: 40px;
    padding: 0 16px;
}

.badges-scroller {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 8px 4px 16px 4px;
    /* Scrollbar space */
    scrollbar-width: thin;
    scrollbar-color: var(--primary) #f1f5f9;
}

.badges-scroller::-webkit-scrollbar {
    height: 6px;
}

.badges-scroller::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.badges-scroller::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

.badge-item {
    min-width: 100px;
    text-align: center;
    opacity: 0.6;
    /* Locked state */
    filter: grayscale(100%);
    transition: all 0.3s ease;
    cursor: default;
    position: relative;
}

.badge-item:hover {
    transform: translateY(-4px);
}

.badge-item.unlocked {
    opacity: 1;
    filter: none;
    cursor: pointer;
}

.badge-icon-container {
    width: 72px;
    height: 72px;
    background: #f1f5f9;
    border-radius: 50%;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s;
}

.badge-item.unlocked .badge-icon-container {
    background: linear-gradient(135deg, #fff, #f8fafc);
    border-color: #ffd700;
    box-shadow: 0 8px 16px rgba(255, 215, 0, 0.2);
}

.badge-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Tooltip simples */
.badge-item::after {
    content: attr(data-desc);
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 100;
    width: max-content;
    max-width: 200px;
    white-space: normal;
}

.badge-item:hover::after {
    opacity: 1;
}