/* Sistema de Desafios - CSS Fase 2 */

/* ===== CONTAINER PRINCIPAL ===== */
.challenges-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 25px;
    margin: 20px 0;
    color: white;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    position: relative;
    overflow: hidden;
}

.challenges-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

/* ===== CABEÇALHO DOS DESAFIOS ===== */
.challenges-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
}

.challenges-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: bold;
    margin: 0;
}

.challenges-title .icon {
    font-size: 1.5rem;
    animation: pulse 2s infinite;
}

.challenges-stats {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
}

.stat-item {
    text-align: center;
    background: rgba(255,255,255,0.15);
    padding: 8px 12px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.stat-value {
    display: block;
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffd700;
}

/* ===== LISTA DE DESAFIOS ===== */
.challenges-list {
    display: grid;
    gap: 15px;
    position: relative;
    z-index: 2;
}

.challenge-item {
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 18px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.challenge-item:hover {
    background: rgba(255,255,255,0.15);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.challenge-item.completed {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.3), rgba(21, 128, 61, 0.3));
    border-color: rgba(34, 197, 94, 0.5);
}

.challenge-item.available {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(29, 78, 216, 0.3));
    border-color: rgba(59, 130, 246, 0.5);
}

/* ===== CABEÇALHO DO DESAFIO ===== */
.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.challenge-info {
    flex: 1;
}

.challenge-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.challenge-type {
    font-size: 0.75rem;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 4px;
}

.challenge-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 12px;
    white-space: nowrap;
}

.challenge-status.disponivel {
    background: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

.challenge-status.ativo {
    background: rgba(251, 191, 36, 0.3);
    color: #fcd34d;
}

.challenge-status.concluido {
    background: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

/* ===== PROGRESSO DO DESAFIO ===== */
.challenge-progress {
    margin: 12px 0;
}

.progress-bar-container {
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    height: 8px;
    overflow: hidden;
    margin: 8px 0;
    position: relative;
}

.progress-bar-fill {
    background: linear-gradient(90deg, #ffd700, #ffed4e);
    height: 100%;
    border-radius: 8px;
    transition: width 0.6s ease;
    position: relative;
}

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

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-top: 4px;
    opacity: 0.9;
}

/* ===== RECOMPENSAS ===== */
.challenge-rewards {
    display: flex;
    gap: 12px;
    margin: 12px 0;
    flex-wrap: wrap;
}

.reward-item {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.1);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.75rem;
}

.reward-points {
    color: #ffd700;
}

.reward-kz {
    color: #86efac;
}

/* ===== TEMPO RESTANTE ===== */
.challenge-time {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 8px;
}

.time-urgent {
    color: #fca5a5 !important;
    animation: blink 1s infinite;
}

/* ===== BOTÃO DE AÇÃO ===== */
.challenge-action {
    margin-top: 12px;
}

.btn-join-challenge {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #1a1a1a;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-join-challenge:hover {
    background: linear-gradient(45deg, #ffed4e, #ffd700);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.btn-join-challenge:disabled {
    background: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.5);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== BADGES ===== */
.badges-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.badge-item {
    text-align: center;
    background: rgba(255,255,255,0.1);
    padding: 12px 8px;
    border-radius: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.badge-item:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
}

.badge-icon {
    font-size: 2rem;
    margin-bottom: 4px;
    display: block;
}

.badge-name {
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0.9;
}

.badge-rarity {
    font-size: 0.6rem;
    margin-top: 2px;
    opacity: 0.7;
    text-transform: uppercase;
}

.badge-comum { border-left: 3px solid #90EE90; }
.badge-raro { border-left: 3px solid #FFD700; }
.badge-epico { border-left: 3px solid #FF6347; }
.badge-lendario { border-left: 3px solid #8A2BE2; }

/* ===== STREAKS ===== */
.streaks-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.streaks-list {
    display: grid;
    gap: 10px;
    margin-top: 15px;
}

.streak-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.08);
    padding: 12px 15px;
    border-radius: 8px;
}

.streak-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.streak-count {
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffd700;
}

.streak-status.ativo {
    color: #86efac;
}

.streak-status.risco {
    color: #fbbf24;
}

.streak-status.quebrado {
    color: #f87171;
    opacity: 0.7;
}

/* ===== LOADING E EMPTY STATES ===== */
.challenges-loading {
    text-align: center;
    padding: 40px 20px;
    opacity: 0.7;
}

.challenges-empty {
    text-align: center;
    padding: 40px 20px;
    opacity: 0.8;
}

.challenges-empty .icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* ===== ANIMAÇÕES ===== */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

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

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.5; }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.challenge-item {
    animation: slideInUp 0.5s ease-out;
}

.challenge-item:nth-child(1) { animation-delay: 0.1s; }
.challenge-item:nth-child(2) { animation-delay: 0.2s; }
.challenge-item:nth-child(3) { animation-delay: 0.3s; }

/* ===== RESPONSIVO ===== */
@media (max-width: 768px) {
    .challenges-container {
        padding: 20px 15px;
        margin: 15px 0;
    }
    
    .challenges-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .challenges-stats {
        align-self: stretch;
        justify-content: space-around;
    }
    
    .challenge-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .challenge-rewards {
        justify-content: flex-start;
    }
    
    .badges-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 8px;
    }
    
    .badge-icon {
        font-size: 1.5rem;
    }
}