/* Challenges styles - shared with deck cards layout */

.challenges-container, .decks-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

.challenges-header, .decks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.challenges-container .decks-grid,
.challenge-highlight .decks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.challenges-container .deck-card,
.challenge-highlight .deck-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    text-decoration: none;
    margin-bottom: 20px;
    margin-top: 20px;
    margin-left: 20px;
    margin-right: 20px;
}

/* Non-clickable challenge card for home highlight */
.challenge-highlight .challenge-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    margin-top: 20px;
    margin-left: 20px;
    margin-right: 20px;
    cursor: default;
}

.challenges-container .deck-card:hover,
.challenge-highlight .deck-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

/* Disable hover motion for non-clickable challenge card */
.challenge-highlight .challenge-card:hover {
    transform: none;
    box-shadow: none;
}

.challenges-container .deck-header,
.challenge-highlight .deck-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: relative;
}

/* Right-floating CTA inside challenge header on home */
.challenge-highlight .challenge-cta {
    position: absolute;
    right: 16px;
    top: 16px;
}
.challenge-highlight .challenge-cta .btn {
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
@media (max-width: 640px) {
    .challenge-highlight .challenge-cta {
        position: static;
        margin-top: 10px;
        text-align: right;
    }
}

.challenges-container .deck-name,
.challenge-highlight .deck-name {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.challenges-container .deck-description,
.challenge-highlight .deck-description {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 10px;
    line-height: 1.4;
}

.challenges-container .deck-body,
.challenge-highlight .deck-body { padding: 16px; }

.challenges-container .deck-stats,
.challenge-highlight .deck-stats { color:#444; font-size: 14px; }

.text-muted { color:#666; }

.challenge-description { 
    color:rgba(255, 255, 255, 0.95);
}

.challenge-instructions { margin-top: 24px; }

.challenge-deadlines { margin-top: 12px; color:#666; }

.mt-0 { margin-top:0; }
.mb-0 { margin-bottom:0; }
.mr-2 { margin-right:8px; }

@media (max-width: 768px) {
    .decks-grid { grid-template-columns: 1fr; }
}

/* --- Improvements for challenge view --- */
.challenges-header.align-start { align-items: flex-start; }

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.status-badge--active { background: #e8f7ef; color: #1e8e3e; }
.status-badge--ended { background: #fdecea; color: #d93025; }
.status-badge--upcoming { background: #e8f0fe; color: #1a73e8; }

.challenge-meta { display:flex; gap:12px; flex-wrap:wrap; margin-top:8px; }
.challenge-meta__item { color:#555; font-size:14px; }
.challenge-countdown { font-weight:600; }

.icon-heart { color:#e74c3c; }
.icon-trophy { color:#f1c40f; }
.icon-silver { color:#bdc3c7; }
.icon-bronze { color:#cd7f32; }

.leaderboard { display:grid; gap:12px; }
.challenges-container .leaderboard .deck-card,
.challenge-highlight .leaderboard .deck-card { cursor: pointer; }

/* Make leaderboard deck cards visually consistent with public decks grid */
.leaderboard .deck-card .card-info { position: relative; z-index: 2; }

.challenges-container .base-deck-card .deck-header,
.challenge-highlight .base-deck-card .deck-header { background: linear-gradient(135deg, #2c3e50 0%, #4ca1af 100%); }
.challenges-container .base-deck-card .deck-stats,
.challenge-highlight .base-deck-card .deck-stats { display:flex; gap:12px; flex-wrap:wrap; }

/* --- Base Deck redesigned card --- */
.base-deck {
    border: 1px solid #e5e7eb;
    border-left: 4px solid #3b82f6;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}
.base-deck__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.base-deck__label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #1f2937;
}
.base-deck__required {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #1e40af;
    background: #dbeafe;
    border: 1px solid #93c5fd;
}

body.dark-mode .base-deck {
    border-color: #4a5568;
    border-left-color: #60a5fa;
    background: #2d3748;
}
body.dark-mode .base-deck__label { color: #e2e8f0; }
body.dark-mode .base-deck__required {
    color: #bfdbfe;
    background: rgba(96, 165, 250, 0.15);
    border-color: #60a5fa;
}

/* Dark mode adjustments */
body.dark-mode .challenges-container .deck-card,
body.dark-mode .challenge-highlight .deck-card { background: #2d3748; border-color: #4a5568; }
/* Dark mode for non-clickable challenge card */
body.dark-mode .challenge-highlight .challenge-card { background: #2d3748; border-color: #4a5568; }
body.dark-mode .challenges-container .deck-header,
body.dark-mode .challenge-highlight .deck-header { background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%); color: #e2e8f0; }
body.dark-mode .challenges-container .deck-body,
body.dark-mode .challenge-highlight .deck-body { color: #cbd5e0; }
body.dark-mode .challenges-container .section-header h2,
body.dark-mode .challenge-highlight .section-header h2 { color: #e2e8f0; }
/* Ensure stats text is readable in dark mode */
body.dark-mode .challenges-container .deck-stats,
body.dark-mode .challenge-highlight .deck-stats { color: #cbd5e0; }
body.dark-mode .status-badge--active { background: #123b26; color: #72e0a6; }
body.dark-mode .status-badge--ended { background: #3a0d0b; color: #ff8a80; }
body.dark-mode .status-badge--upcoming { background: #0d1b3a; color: #8ab4f8; }
/* Slightly increase badge text contrast */
body.dark-mode .status-badge { font-weight: 700; }

/* --- Base deck summary (simpler than gradient card) --- */
.base-deck-summary {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
}
.base-deck-summary__title { margin: 0 0 6px 0; font-size: 18px; font-weight: 600; color: #1f2937; }
.base-deck-summary__meta { display:flex; gap:12px; flex-wrap:wrap; color:#555; font-size:14px; margin-bottom: 10px; }
.base-deck-summary__actions { display:flex; gap:8px; flex-wrap:wrap; }

body.dark-mode .base-deck-summary { background: #2d3748; border-color: #4a5568; }
body.dark-mode .base-deck-summary__title { color: #e2e8f0; }
body.dark-mode .base-deck-summary__meta { color: #cbd5e0; }
/* Improve contrast for links inside base-deck-summary on dark mode */
body.dark-mode .base-deck-summary a { color: #93c5fd; }
body.dark-mode .base-deck-summary a:hover { color: #bfdbfe; }

/* --- Instructions panel --- */
.instructions-panel {
    background: #f8fafc;
    border-left: 4px solid #3b82f6;
    border-radius: 8px;
    padding: 16px;
}
.instructions-panel .prose p { margin: 0 0 10px 0; }
.instructions-panel .prose ul { padding-left: 18px; margin: 0 0 10px 0; }

body.dark-mode .instructions-panel { background: #1f2937; border-left-color: #60a5fa; }
/* Ensure readable body text in instructions on dark mode */
body.dark-mode .instructions-panel .prose { color: #e5e7eb; }
body.dark-mode .instructions-panel .prose a { color: #93c5fd; }
body.dark-mode .instructions-panel .prose a:hover { color: #bfdbfe; }

/* Base deck card strip */
.base-deck-cards-row {
    display: flex;
    gap: 8px;
    overflow: auto;
    padding-top: 10px;
}
.base-deck-card-link { display: inline-block; flex: 0 0 auto; }
.base-deck-card-thumb {
    height: 96px; /* slightly larger but compact */
    width: auto;
    border-radius: 6px;
    display: block;
}

/* Quantity badge over base deck thumbnails */
.base-deck-card-link { position: relative; }
.base-deck-card-qty {
    position: absolute;
    right: 4px;
    bottom: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1;
}
/* Improve qty badge contrast in dark mode by slightly lightening bg */
body.dark-mode .base-deck-card-qty {
    background: rgba(0, 0, 0, 0.6);
}

/* --- Home challenge layout --- */
.challenge-highlight .deck-name .status-badge { margin-left: 8px; vertical-align: middle; }

/* Header meta inside challenge header (dates + prizes) */
.challenge-highlight .challenge-header-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.95);
}
.challenge-highlight .challenge-header-meta__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.challenge-highlight .challenge-header-meta i { color: #fff; }

@media (max-width: 640px) {
    .challenge-highlight .challenge-header-meta { font-size: 13px; gap: 8px; }
}

/* Dark mode: keep high contrast on gradient header */
body.dark-mode .challenge-highlight .challenge-header-meta {
    color: #94a3b8;
}
body.dark-mode .challenge-highlight .challenge-header-meta i {
    color: #94a3b8;
}

/* Prize badges */
.prize-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #1f2937;
    background: rgba(255, 255, 255, 0.9);
}
.prize-sep { margin: 0 6px; opacity: 0.8; }

/* Themed prize colors with subtle gradient for pop */
.prize-badge--gold {
    background: linear-gradient(135deg, #fde68a 0%, #f59e0b 100%);
    color: #7c4a00;
    border-color: rgba(124, 74, 0, 0.25);
}
.prize-badge--silver {
    background: linear-gradient(135deg, #e5e7eb 0%, #9ca3af 100%);
    color: #263238;
    border-color: rgba(38, 50, 56, 0.25);
}
.prize-badge--bronze {
    background: linear-gradient(135deg, #f1c7a1 0%, #cd7f32 100%);
    color: #4a2b12;
    border-color: rgba(74, 43, 18, 0.25);
}

/* Dark mode adjustments for prize badges */
body.dark-mode .prize-badge {
    color: #111827;
    border-color: rgba(0, 0, 0, 0.25);
}
body.dark-mode .prize-badge--gold { color: #2b1800; }
body.dark-mode .prize-badge--silver { color: #0f172a; }
body.dark-mode .prize-badge--bronze { color: #2b160a; }

.home-challenge-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    align-items: start;
    margin-top: 12px;
}

.deck-challenge-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 16px;
    align-items: start;
    margin-top: 12px;
}

@media (max-width: 1024px) {
    .home-challenge-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .home-challenge-grid { grid-template-columns: 1fr; }
}

/* Reuse base-deck-summary look for compact panels */
.home-challenge-panel { padding: 0; }
.home-challenge-panel .base-deck-summary { margin: 0; }

/* Compact instructions with fade */
.instructions-panel--compact {
    overflow: hidden;
    position: relative;
}
.instructions-panel--compact::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 40px;
}

.leaderboard-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.leaderboard-list__item { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.leaderboard-list__meta { color: #555; display: inline-flex; gap: 10px; align-items: center; }
body.dark-mode .leaderboard-list__meta { color: #cbd5e0; }


