/* 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: 20px;
    padding: 20px 0;
}

.challenge-card {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}

.container {
    min-height: 100vh;
}

.challenge-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.challenge-card.completed {
    border-color: #4ade80;
}

.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: 18px;
    flex: 1;
}

.challenge-difficulty {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #000;
    text-transform: uppercase;
}

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

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

.challenge-tabs {
    display: flex;
    gap: 6px;
    justify-content: center;
    max-width: 500px;
    margin: 0 auto 1rem;
    flex-wrap: wrap;
    padding: 0 8px;
}
.challenge-tab-btn {
    flex: 0 0 auto;
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    background: rgba(255,255,255,0.03);
    color: var(--muted,#94a3b8);
    cursor: pointer;
    font-weight: 600;
    font-size: .8rem;
    transition: background .15s,color .15s;
    white-space: nowrap;
}
.challenge-tab-btn.active {
    background: var(--accent,#34d399);
    color: #ffffff;
    border-color: transparent;
}

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

.challenge-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    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 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    font-size: 11px;
    color: #fff;
    font-family: monospace;
}

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

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

.reward-badge.xp {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
}
.reward-badge.cosmetic {
    background: rgba(234, 88, 12, 0.2);
    color: #fb923c;
}

.challenge-requirements {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.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: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

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

.btn-view:hover:not(:disabled) {
    background: #22c55e;
}

.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(--card);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 30px;
}

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

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

.challenge-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    font-size: 14px;
}

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

#viewChallengeDifficulty {
    font-weight: bold;
}

#viewChallengeStatus {
    margin-bottom: 20px;
}

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

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

/* 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(--card);
    border-radius: 8px;
    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(--card);
    border-radius: 14px;
    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(--card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    position: relative;
    z-index: 1;
}

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

.guess-area input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-primary {
    padding: 12px 24px;
    background: var(--accent);
    color: #052018;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #22c55e;
}

.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: 4px;
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    color: #fff;
}

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

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

#challengeFailedAttempts.hidden {
    display: none;
}

/* Hints */
.hints-list {
    background: var(--card);
    border-radius: 8px;
    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.1);
    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: 4px;
    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(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.popup.hidden {
    display: none;
}

.popup-content {
    background: var(--card);
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

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

.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: 8px;
    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: 8px;
    font-weight: 600;
    cursor: pointer;
}

.challenge-success-actions button:hover {
    background: #22c55e;
}

/* 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;
    }
}
