/* Styles pour les challenges */

/* Header */
.challenge-page header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin-bottom: 18px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.challenge-page {
    padding-top: 60px;
}

.challenge-page header h1 {
    font-size: 20px;
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(100deg, #e6eef8 0%, #22c55e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.challenges-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 0;
}

.challenge-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: clamp(16px, 3vw, 22px);
    width: 100%;
    box-shadow: var(--shadow-sm);
    transition: border-color 180ms ease;
}

.container {
    min-height: 100vh;
}

.challenge-card:hover {
    border-color: rgba(148,163,184,0.26);
}

.challenge-card.completed {
    border-color: rgba(74,222,128,0.55);
}

.challenge-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
    flex-wrap: wrap;
}

.challenge-header h3 {
    margin: 0;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    flex: 1;
}

.challenge-difficulty {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #000;
    text-transform: uppercase;
}

.btn-additional-info {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--line);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-bright);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 180ms, border-color 180ms;
    flex-shrink: 0;
    line-height: 1;
}

.btn-additional-info:hover {
    background: rgba(52,211,153,0.16);
    border-color: rgba(52,211,153,0.45);
}

.challenge-tabs {
    display: flex;
    gap: 6px;
    justify-content: center;
    max-width: 520px;
    margin: 0 auto 1rem;
    flex-wrap: wrap;
    padding: 0 8px;
}
.challenge-tab-btn {
    flex: 0 0 auto;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255,255,255,0.03);
    color: var(--muted,#94a3b8);
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    font-size: .8rem;
    transition: background 150ms, color 150ms, border-color 150ms;
    white-space: nowrap;
}
.challenge-tab-btn:hover {
    color: #fff;
    border-color: rgba(148,163,184,0.3);
}
.challenge-tab-btn.active {
    background: var(--accent,#34d399);
    color: #042014;
    border-color: transparent;
}

.challenge-desc {
    color: var(--muted);
    font-size: 13.5px;
    margin-bottom: 14px;
    line-height: 1.55;
}

.challenge-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--muted);
    align-items: center;
}

.challenge-count {
    font-weight: 600;
    color: #fff;
}

.challenge-dates {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.date-badge {
    padding: 3px 9px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 999px;
    font-size: 11px;
    color: #dbe6f2;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.challenge-rewards {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.reward-badge {
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.reward-badge.xp {
    background: rgba(74,222,128,0.14);
    color: #4ade80;
}
.reward-badge.cosmetic {
    background: rgba(251,146,60,0.14);
    color: #fb923c;
}

/* 1 XP = 1 Pokédollar : le même challenge rapporte aussi des P */
.reward-badge.pokedollars {
    background: rgba(251,191,36,0.16);
    color: #fbbf24;
}

.challenge-requirements {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    padding: 11px 12px;
    background: rgba(0,0,0,0.18);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
}

.requirement-item {
    font-size: 13px;
    font-weight: 500;
}

.completed-badge {
    color: #4ade80;
    font-weight: 600;
}

.locked-badge {
    color: #ef4444;
    font-weight: 600;
}

.challenge-actions {
    display: flex;
    gap: 8px;
}

.challenge-actions button {
    width: 100%;
    padding: 11px 16px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    font-size: 14px;
    transition: filter 150ms;
}

.btn-view {
    background: var(--accent);
    color: #052018;
}

.btn-view:hover:not(:disabled) {
    filter: brightness(1.08);
}

.btn-view:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.requirements-tooltip {
    font-size: 13px;
}

.requirements-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Mode View */
.challenge-view {
    max-width: 600px;
    margin: 40px auto;
}

.challenge-info-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: clamp(22px, 4vw, 30px);
    box-shadow: var(--shadow-sm);
}

.challenge-info-card h2 {
    color: #fff;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.challenge-info-card p {
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 20px;
}

.challenge-info-card .challenge-meta span {
    padding: 6px 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    color: #fff;
}

#viewChallengeDifficulty {
    font-weight: bold;
}

#viewChallengeStatus {
    margin-bottom: 20px;
}

/* Mode Playing */
.challenge-game {
    max-width: 640px;
    margin: 0 auto;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: #fff;
    font-weight: 600;
}

/* Style image comme le daily */
.image-gauge-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.image-container {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.image-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 110%, rgba(22,163,74,0.08) 0%, transparent 65%);
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
}

.image-container img {
    width: 100%;
    height: 340px;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    position: relative;
    z-index: 1;
}

.guess-area {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    position: relative;
    flex-wrap: nowrap;
}

.guess-area input {
    flex: 1 1 auto;
    min-width: 0;
    width: 0;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    font-family: inherit;
    position: relative;
    z-index: 1;
    transition: border-color 150ms, box-shadow 150ms;
}

.guess-area button {
    flex: 0 0 auto;
    white-space: nowrap;
}

.guess-area input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(34,197,94,0.18);
}

.btn-primary {
    padding: 12px 24px;
    background: var(--accent);
    color: #052018;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: filter 150ms;
}

.btn-primary:hover {
    filter: brightness(1.08);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Dropdown autocomplete - positionné en dessous */
.names-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 6px;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.autocomplete-item {
    padding: 9px 12px;
    cursor: pointer;
    color: #fff;
    font-size: 14px;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: rgba(255,255,255,0.08);
}

/* Failed attempts */
#challengeFailedAttempts {
    color: var(--muted);
    font-size: 14px;
    margin-top: 8px;
    text-align: left;
}

#challengeFailedAttempts.hidden {
    display: none;
}

/* Hints */
.hints-list {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 16px;
    min-height: 60px;
    margin-top: 16px;
}

.hints-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hints-list li {
    padding: 9px 13px;
    background: rgba(22,163,74,0.06);
    border: 1px solid rgba(22,163,74,0.12);
    border-radius: 9px;
    margin-bottom: 6px;
    color: #cfe7d6;
    animation: hintReveal 300ms ease-out both;
}

.hints-list li:last-child {
    margin-bottom: 0;
}

@keyframes hintReveal {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Type badges */
.type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

/* Popup de succès */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2,6,16,0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    box-sizing: border-box;
}

.popup.hidden {
    display: none;
}

.popup-content {
    background: var(--surface-strong);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: clamp(20px, 4vw, 30px);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.popup-content h2 {
    color: #fff;
    margin-bottom: 20px;
    text-align: center;
    letter-spacing: -0.02em;
}

.challenge-success-pokemons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.challenge-success-pokemons img {
    width: 100%;
    height: auto;
    image-rendering: pixelated;
    border-radius: 10px;
    background: rgba(0,0,0,0.2);
}

.challenge-success-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.challenge-success-actions button {
    flex: 1;
    padding: 12px;
    background: var(--accent);
    color: #052018;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: filter 150ms;
}

.challenge-success-actions button:hover {
    filter: brightness(1.08);
}

/* Responsive */
@media (max-width: 768px) {
    .challenges-grid {
        grid-template-columns: 1fr;
    }

    .challenge-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .challenge-success-actions {
        flex-direction: column;
    }

    .image-container img { height: 260px; }
}

/* Message affiché quand la grille de défis n'a rien à montrer : données
   indisponibles ou onglet sans défi disponible. */
.challenges-empty {
    grid-column: 1 / -1;
    padding: 36px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
    .hints-list li { animation: none; }
    .challenge-card, .challenge-tab-btn, .btn-primary, .btn-view { transition: none; }
}
