/* =============================================
   DESAFIO LISTAR — Tela de Seleção de Fase
   ============================================= */

/* ---- HERO ---- */
.desafios-hero {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 50%, #4c1d95 100%);
    color: #fff;
    padding: 2.5rem 1rem 2rem;
    text-align: center;
    border-radius: 0 0 2rem 2rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.desafios-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -25%;
    width: 150%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,.06) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content { position: relative; z-index: 1; max-width: 800px; margin: 0 auto; }
.desafios-hero h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: .25rem; }
.desafios-hero h1 i { margin-right: .4rem; }
.hero-subtitle { opacity: .8; font-size: 1rem; margin-bottom: 1.5rem; }

/* Player stats row */
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: .75rem;
}

.hero-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,.12);
    border-radius: 1rem;
    padding: .75rem 1.5rem;
    min-width: 110px;
    backdrop-filter: blur(4px);
}

.hero-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
}

.hero-stat-label {
    font-size: .75rem;
    opacity: .8;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.hero-motivational {
    font-size: .9rem;
    opacity: .9;
    margin: .5rem 0 0;
    font-weight: 600;
}

.hero-motivational i { margin-right: .3rem; }

/* ---- FILTER SECTION ---- */
.filter-section {
    max-width: 1200px;
    margin: 0 auto 1.5rem;
    padding: 0 1rem;
}

/* Search bar */
.search-bar {
    position: relative;
    max-width: 500px;
    margin: 0 auto 1rem;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: .9rem;
}

.search-input {
    width: 100%;
    padding: .7rem 1rem .7rem 2.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 2rem;
    font-size: .95rem;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.search-input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139,92,246,.15);
}

/* Category combobox + Order in a row */
.filters-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.category-select-wrapper {
    position: relative;
    flex: 0 1 320px;
}

.select-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #8b5cf6;
    font-size: .85rem;
    pointer-events: none;
    z-index: 1;
}

.category-select {
    width: 100%;
    padding: .65rem 2.5rem .65rem 2.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 2rem;
    font-size: .9rem;
    font-weight: 500;
    color: #374151;
    background: #fff;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px;
}

.category-select:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139,92,246,.15);
}

.category-select:hover {
    border-color: #a78bfa;
}

/* Order bar */
.order-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
}

.order-label {
    font-size: .85rem;
    color: #6b7280;
    font-weight: 500;
}

.order-pills { display: flex; gap: .4rem; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .35rem .85rem;
    border-radius: 2rem;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    font-size: .8rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all .2s;
}

.pill:hover { border-color: #8b5cf6; color: #8b5cf6; }

.pill-active {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #fff;
}

/* ---- GRID ---- */
.desafios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem 3rem;
}

/* ---- CARD LINK (wrapper) ---- */
.desafio-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    opacity: 0;
    animation: desFadeInUp .5s ease forwards;
    border-radius: 14px;
    cursor: pointer;
}

.desafio-card-link:hover,
.desafio-card-link:focus {
    text-decoration: none;
    color: inherit;
}

/* ---- CARD (bat-card style) ---- */
.desafio-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s, transform .2s;
    display: flex;
    flex-direction: column;
    position: relative;
    flex: 1;
}

.desafio-card-link:hover .desafio-card {
    border-color: rgba(139,92,246,0.3);
    box-shadow: 0 4px 16px rgba(139,92,246,0.13);
    transform: translateY(-2px);
}

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

.desafio-card-inner {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

/* Card Top: emoji + info */
.desafio-card-top {
    display: flex;
    align-items: center;
    gap: .5rem;
    overflow: hidden;
}

.desafio-card-emoji {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.desafio-card-info { flex: 1; min-width: 0; }

.desafio-card-title {
    font-size: .85rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-all;
}

.desafio-card-code {
    font-size: .67rem;
    font-weight: 700;
    color: #8b5cf6;
    margin: 0;
    font-family: monospace;
    letter-spacing: .5px;
}

.desafio-card-meta {
    font-size: .7rem;
    color: #6b7280;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Badges */
.desafio-card-badges { display: flex; gap: .3rem; flex-wrap: wrap; }
.des-badge {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    padding: .15rem .4rem;
    border-radius: 8px;
    font-size: .67rem;
    font-weight: 600;
}
.des-badge-facil { background: rgba(16,185,129,.12); color: #059669; }
.des-badge-medio { background: rgba(245,158,11,.12); color: #d97706; }
.des-badge-dificil { background: rgba(239,68,68,.12); color: #dc2626; }
.des-badge-novo { background: rgba(139,92,246,.1); color: #8b5cf6; }
.des-badge-nova {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #fff;
}
.des-badge-andamento { background: rgba(245,158,11,.12); color: #d97706; }
.des-badge-completo { background: rgba(16,185,129,.12); color: #059669; }

/* Progress */
.desafio-card-progress {
    display: flex;
    align-items: center;
    gap: .35rem;
}
.desafio-card-progress-bar {
    flex: 1;
    height: 4px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}
.desafio-card-progress-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #f59e0b, #f97316);
    transition: width .4s ease;
}
.desafio-card-progress-lbl {
    font-size: .6rem;
    color: #f59e0b;
    font-weight: 700;
    white-space: nowrap;
}

/* Stars */
.desafio-card-stars {
    display: flex;
    gap: .15rem;
    align-items: center;
}
.desafio-card-stars .star-earned { color: #fbbf24; font-size: .8rem; }
.desafio-card-stars .star-empty  { color: #d1d5db; font-size: .8rem; }

/* Stats */
.desafio-card-stats {
    display: flex;
    gap: .6rem;
    font-size: .72rem;
    color: #6b7280;
    margin-top: auto;
}
.desafio-card-stats span {
    display: flex;
    align-items: center;
    gap: .2rem;
}
.desafio-card-stats .fa-list-ol { color: #f59e0b; }
.desafio-card-stats .fa-users { color: #8b5cf6; }
.desafio-card-stats .fa-fire { color: #ef4444; }

/* Card Actions */
.desafio-card-actions {
    padding: .6rem 1rem;
    display: flex;
    gap: .4rem;
    border-top: 1px solid #e5e7eb;
}

.btn-des-play {
    flex: 1;
    padding: .45rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #fff;
    font-weight: 700;
    font-size: .8rem;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
}
.btn-des-play:hover {
    box-shadow: 0 4px 14px rgba(139,92,246,0.25);
    color: #fff;
    text-decoration: none;
}
.btn-des-play.continuar {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}
.btn-des-play.replay {
    background: linear-gradient(135deg, #10b981, #059669);
}

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    max-width: 500px;
    margin: 0 auto;
}

.empty-illustration {
    position: relative;
    display: inline-block;
    margin-bottom: 1.5rem;
}

.empty-illustration > i {
    font-size: 4rem;
    color: #8b5cf6;
    position: relative;
    z-index: 1;
}

.empty-circles {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.circle {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(139,92,246,.15);
    animation: emptyPulse 3s ease-in-out infinite;
}

.c1 { width: 80px; height: 80px; top: -40px; left: -40px; animation-delay: 0s; }
.c2 { width: 120px; height: 120px; top: -60px; left: -60px; animation-delay: .5s; }
.c3 { width: 160px; height: 160px; top: -80px; left: -80px; animation-delay: 1s; }

@keyframes emptyPulse {
    0%, 100% { opacity: .3; transform: scale(1); }
    50%      { opacity: .6; transform: scale(1.05); }
}

.empty-state h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: .5rem;
}

.empty-state p {
    color: #9ca3af;
    margin-bottom: 1.5rem;
}

.empty-actions {
    display: flex;
    gap: .75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-empty-primary {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1.2rem;
    background: #8b5cf6;
    color: #fff;
    border-radius: 2rem;
    text-decoration: none;
    font-weight: 600;
    font-size: .9rem;
    transition: background .2s;
}

.btn-empty-primary:hover { background: #7c3aed; color: #fff; }

.btn-empty-secondary {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1.2rem;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 2rem;
    text-decoration: none;
    font-weight: 500;
    font-size: .9rem;
    transition: background .2s;
}

.btn-empty-secondary:hover { background: #e5e7eb; color: #374151; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .desafios-hero { padding: 2rem 1rem 1.5rem; }
    .desafios-hero h1 { font-size: 1.6rem; }
    .hero-stats { gap: 1rem; }
    .hero-stat { padding: .5rem 1rem; min-width: 85px; }
    .hero-stat-value { font-size: 1.2rem; }

    .filters-row { flex-direction: column; gap: .75rem; }
    .category-select-wrapper { flex: 1 1 100%; }

    .desafios-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0 .75rem 2rem;
    }

    .order-bar { flex-wrap: wrap; }
}

@media (max-width: 480px) {
    .hero-stats { flex-direction: column; align-items: center; gap: .5rem; }
    .hero-stat { width: 80%; }
    .search-bar { margin: 0 auto .75rem; }
}
