/* ========================================
   CHALLENGE DETAIL - PREMIUM UI
   ======================================== */

.challenge-detail-wrapper {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 1. Hero Section */
.challenge-hero {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    padding: 30px 20px;
    border-radius: var(--radius-xl);
    background: rgba(12, 18, 30, 0.4);
    border: 1px solid rgba(0, 234, 255, 0.1);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.hero-bg-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(0, 234, 255, 0.15) 0%, transparent 70%);
    filter: blur(60px);
    pointer-events: none;
    z-index: 0;
}

.difficulty-wrapper {
    position: relative;
    z-index: 2;
    margin-bottom: 20px;
}

.hero-title {
    position: relative;
    z-index: 2;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 900;
    margin-bottom: 20px;
    line-height: 1.1;
    color: #fff;
    text-shadow: 0 0 30px rgba(0, 234, 255, 0.3);
}

.hero-stats {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--color-border);
    border-radius: 50px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-secondary);
    backdrop-filter: blur(5px);
}

.stat-badge.points {
    color: var(--color-accent-yellow);
    border-color: rgba(255, 189, 46, 0.3);
}

.stat-badge.category {
    color: var(--color-accent-purple);
    border-color: rgba(138, 43, 226, 0.3);
}

/* 2. Description Section */
.challenge-body {
    margin-bottom: 12px;
}

.description-card {
    background: rgba(10, 15, 26, 0.95);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 25px 25px 5px 25px;
    position: relative;
    box-shadow: var(--shadow-card);
}

.description-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--gradient-primary);
    opacity: 0.5;
}

.section-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: 0;
    letter-spacing: 2px;
    opacity: 0.7;
}

.description-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--color-text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
    /* Respects DB newlines and breaks long words */
    font-family: 'Inter', sans-serif;
    /* Clean reading font */
    margin-bottom: 0;
}

/* 3. Action Section */
.challenge-actions {
    text-align: center;
    margin-bottom: 16px;
}

.challenge-actions:empty {
    margin-bottom: 0;
}

.btn-action-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px 60px;
    background: var(--gradient-primary);
    color: #000;
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    font-size: 1.25rem;
    border-radius: 6px;
    /* Hacking style usually sharper */
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 0 30px rgba(0, 234, 255, 0.4);
    clip-path: polygon(10% 0, 100% 0, 100% 70%, 90% 100%, 0 100%, 0 30%);
}

.btn-action-primary:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 0 60px rgba(0, 234, 255, 0.6);
    color: #000;
}

.btn-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-action-disabled {
    padding: 15px 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    cursor: not-allowed;
    border-radius: 6px;
}

/* 4. Submission Section */
.challenge-submission {
    max-width: 750px;
    margin: 0 auto;
    text-align: center;
    margin-top: 10px;
}

.submission-card {
    background: rgba(12, 18, 30, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 30px;
    backdrop-filter: blur(10px);
}

.input-group {
    display: flex;
    gap: 10px;
    position: relative;
    flex-wrap: wrap;
    /* Allows wrapping on very small screens */
    justify-content: center;
    /* Center the form elements */
}

.flag-input {
    flex: 0 1 65%;
    /* Restrict to ~65% of container width */
    min-width: 250px;
    /* Keep decent minimum for phones */
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 10px 15px;
    /* Comfortable height (~2em total) */
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    /* Revert to site baseline font-size */
    outline: none;
    transition: all 0.3s ease;
}

.flag-input:focus {
    border-color: var(--color-accent-cyan);
    box-shadow: 0 0 15px rgba(0, 234, 255, 0.1);
}

.btn-submit {
    flex: 0 1 auto;
    /* Scale to button text content */
    padding: 10px 30px;
    /* Matched to flag input height constraints */
    background: var(--color-accent-cyan);
    background: linear-gradient(135deg, #00eaff 0%, #0077ff 100%);
    color: #000;
    font-size: 1rem;
    /* Matched font size */
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0, 234, 255, 0.4);
}

.solved-state {
    text-align: center;
    padding: 40px;
    background: rgba(39, 202, 64, 0.05);
    border: 1px solid rgba(39, 202, 64, 0.2);
    border-radius: var(--radius-lg);
}

.solved-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    display: block;
    animation: pulse 2s infinite;
}

.solved-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-accent-green);
    margin-bottom: 10px;
}

.solved-sub {
    color: var(--color-text-secondary);
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}
