.challenges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(20em, 1fr));
    gap: 1.5em;
    margin-top: 2em;
}

.challenge-card {
    background: linear-gradient(135deg, #313244 0%, #2a2a40 100%);
    border: 1px solid #45475a;
    border-left: 4px solid var(--difficulty-color, #cba6f7);
    border-radius: 0.5em;
    padding: 1.5em;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.challenge-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--difficulty-color, #cba6f7) 15%, transparent) 0%, color-mix(in srgb, var(--difficulty-color, #cba6f7) 5%, transparent) 100%);
    border-radius: 0 0.5em 0 100%;
    pointer-events: none;
}


.challenge-card:hover {
    transform: translateY(-0.125em) scale(1.02);
    box-shadow: 0 0.5em 1.5em color-mix(in srgb, var(--difficulty-color, #cba6f7) 20%, transparent), 0 0.25em 0.5em rgba(0, 0, 0, 0.2);
}

.challenge-validated {
    border-left-color: #a6e3a1 !important;
    background: linear-gradient(135deg, #313244 0%, #2d3a2d 100%);
}

.challenge-validated::before {
    background: linear-gradient(135deg, rgba(166, 227, 161, 0.15) 0%, rgba(166, 227, 161, 0.05) 100%);
}

.validation-indicator {
    margin-left: 0.5em;
    font-size: 0.9em;
    animation: validatedPulse 2s ease-in-out infinite;
}

.challenge-index-page .challenge-card:nth-child(1) { animation-delay: 0.1s; }
.challenge-index-page .challenge-card:nth-child(2) { animation-delay: 0.2s; }
.challenge-index-page .challenge-card:nth-child(3) { animation-delay: 0.3s; }
.challenge-index-page .challenge-card:nth-child(4) { animation-delay: 0.4s; }
.challenge-index-page .challenge-card:nth-child(5) { animation-delay: 0.5s; }
.challenge-index-page .challenge-card:nth-child(6) { animation-delay: 0.6s; }
.challenge-index-page .challenge-card:nth-child(7) { animation-delay: 0.7s; }
.challenge-index-page .challenge-card:nth-child(8) { animation-delay: 0.8s; }
.challenge-index-page .challenge-card:nth-child(9) { animation-delay: 0.9s; }
.challenge-index-page .challenge-card:nth-child(n+10) { animation-delay: 1s; }

.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1em;
    margin-bottom: 1em;
}

.challenge-title {
    margin: 0;
    font-size: 1.25em;
    font-weight: 600;
    flex: 1;
}

.challenge-title a {
    color: #cdd6f4;
    text-decoration: none;
    transition: color 0.2s ease;
}

.challenge-title a:hover {
    color: #cba6f7;
    text-shadow: 0 0 8px rgba(203, 166, 247, 0.3);
    transform: translateX(4px);
    transition: all 0.3s ease;
}

.challenge-difficulty {
    background-color: var(--difficulty-color, #6c7086);
    color: #1e1e2e;
    padding: 0.25em 0.75em;
    border-radius: 1em;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}


.challenge-description {
    color: #bac2de;
    line-height: 1.5;
    margin-bottom: 1.5em;
    flex: 1;
}

.challenge-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875em;
    color: #a6adc8;
    border-top: 1px solid #45475a;
    padding-top: 1em;
}

.challenge-author {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.meta-label {
    color: #9399b2;
}

.challenge-author strong {
    color: #cdd6f4;
}

.challenge-date {
    font-variant-numeric: tabular-nums;
}

/* Classes empty communes définies dans app.css */

.challenge-detail {
    max-width: 60rem;
    margin: 0 auto;
    padding: 2rem;
}

.challenge-detail-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #45475a;
    position: relative;
}

.challenge-detail-title {
    font-size: 3rem;
    font-weight: 700;
    color: #cdd6f4;
    margin: 0 0 1rem 0;
    line-height: 1.2;
    background: linear-gradient(135deg, #cba6f7, #89b4fa, #a6e3a1);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 200%;
    position: relative;
}

.challenge-show-page .challenge-detail-title {
    animation: gradientShift 4s ease-in-out infinite;
}

.challenge-detail-title::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, #f38ba8, #fab387, #f9e2af, #a6e3a1, #89b4fa, #cba6f7);
    border-radius: 2px;
}

.challenge-show-page .challenge-detail-title::after {
    animation: shimmer 3s ease-in-out infinite;
}

.challenge-detail-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.challenge-show-page .challenge-detail-meta > *:nth-child(1) { animation-delay: 0.3s; }
.challenge-show-page .challenge-detail-meta > *:nth-child(2) { animation-delay: 0.4s; }
.challenge-show-page .challenge-detail-meta > *:nth-child(3) { animation-delay: 0.5s; }
.challenge-show-page .challenge-detail-meta > *:nth-child(4) { animation-delay: 0.6s; }

.challenge-detail-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
}

.challenge-detail-description {
    background: linear-gradient(135deg, #313244 0%, #2a2a40 100%);
    border: 1px solid #45475a;
    border-left: 4px solid #a6e3a1;
    border-radius: 0.75rem;
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
}

.challenge-detail-description::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(166, 227, 161, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(25%, -25%);
}


.challenge-detail-description h2 {
    color: #a6e3a1;
    font-size: 1.55rem;
    font-weight: 600;
    margin: 0 0 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.challenge-detail-description h2::before {
    content: '📝';
    font-size: 1.2em;
}

.description-content {
    color: #bac2de;
    font-size: 1.125rem;
    line-height: 1.7;
}

.header-info {
    color: #a6adc8;
    font-size: 0.9rem;
    font-weight: 500;
}

.challenge-detail-submission {
    background: linear-gradient(135deg, #313244 0%, #2a2a40 100%);
    border: 1px solid #45475a;
    border-left: 4px solid #fab387;
    border-radius: 0.75rem;
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.challenge-detail-submission::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(250, 179, 135, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-25%, -25%);
}

.challenge-detail-submission:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(250, 179, 135, 0.15);
}

.challenge-detail-submission h2 {
    color: #fab387;
    font-size: 1.55rem;
    font-weight: 600;
    margin: 0 0 2rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.challenge-detail-submission h2::before {
    content: '🚀';
    font-size: 1.2em;
}

.challenge-show-page .challenge-detail-submission h2::before {
    animation: pulse 2s infinite;
}

.submission-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-field label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.answer-field {
    background: #1e1e2e;
    border: 2px solid #45475a;
    border-radius: 0.5rem;
    padding: 1rem;
    color: #cdd6f4;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.answer-field:focus {
    outline: none;
    border-color: #89b4fa;
    box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.3), 0 0 20px rgba(137, 180, 250, 0.1);
    transform: translateY(-2px);
}

.answer-field::placeholder {
    color: #6c7086;
}

.submit-button {
    background: linear-gradient(135deg, #a6e3a1 0%, #89b4fa 50%, #cba6f7 100%);
    background-size: 200% 200%;
    color: #1e1e2e;
    border: none;
    border-radius: 0.5rem;
    padding: 1rem 2rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-position 0.3s ease;
    align-self: flex-start;
    position: relative;
    overflow: hidden;
}

.submit-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.submit-button:hover::before {
    width: 300px;
    height: 300px;
}

.submit-button:active {
    transform: translateY(0);
}

/* Answer Status */
.answer-status {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.answer-status-success {
    background: linear-gradient(135deg, rgba(166, 227, 161, 0.1) 0%, rgba(148, 226, 213, 0.1) 100%);
    border-color: #a6e3a1;
    border-left: 4px solid #a6e3a1;
}

.answer-status::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent 30%, rgba(166, 227, 161, 0.05) 50%, transparent 70%);
    transform: translateX(-100%);
    animation: shimmerSuccess 2s ease-in-out infinite;
}

.status-icon {
    font-size: 2rem;
    animation: bounce 2s infinite;
    flex-shrink: 0;
}

.status-content {
    flex: 1;
}

.status-content h3 {
    color: #a6e3a1;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.status-content p {
    color: #bac2de;
    margin: 0;
    line-height: 1.5;
}

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

/* Animations */
@keyframes shimmer {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

@keyframes gradientShift {
    0%, 100% { background-position: 0 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
    60% { transform: translateY(-3px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes validatedPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.input-file-link {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #45475a;
}

.file-download-link {
    color: #cba6f7;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease, text-shadow 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.file-download-link:hover {
    color: #b4befe;
    text-shadow: 0 0 8px rgba(203, 166, 247, 0.4);
}

@media (max-width: 48rem) {
    .challenge-detail {
        padding: 1rem;
    }

    .challenge-detail-title {
        font-size: 2rem;
    }

    .challenge-detail-description,
    .challenge-detail-submission {
        padding: 1.5rem;
    }

    .challenge-detail-meta {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* Section des validations récentes */
.challenge-recent-validations {
    padding: 2rem;
    background: var(--ctp-surface0);
    border-radius: 15px;
    border: 1px solid var(--ctp-surface1);
}

.challenge-recent-validations h2 {
    color: var(--ctp-yellow);
    font-size: 1.5rem;
    margin: 0 0 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recent-validations-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.validation-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--ctp-mantle);
    border-radius: 12px;
    border: 1px solid var(--ctp-surface1);
    transition: all 0.3s ease;
}

.validation-item:hover {
    border-color: var(--ctp-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(137, 180, 250, 0.1);
}

.validation-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ctp-blue), var(--ctp-mauve));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.validation-avatar .avatar-initial {
    color: white;
    font-weight: bold;
    font-size: 1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.validation-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.validation-username {
    color: var(--ctp-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.validation-username:hover {
    color: var(--ctp-blue);
    text-decoration: none;
}

.validation-date {
    color: var(--ctp-subtext1);
    font-size: 0.85rem;
}

.validation-badge {
    background: var(--ctp-green);
    color: var(--ctp-base);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Responsive pour les validations récentes */
@media (max-width: 768px) {
    .challenge-recent-validations {
        margin: 2rem 0;
        padding: 1.5rem;
    }

    .validation-item {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .validation-avatar {
        width: 32px;
        height: 32px;
    }

    .validation-avatar .avatar-initial {
        font-size: 0.85rem;
    }

    .validation-username {
        font-size: 0.9rem;
    }

    .validation-date {
        font-size: 0.8rem;
    }

    .validation-badge {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
}
