/* ==========================================================================
   Quranic Detective — setup screen
   Re-themed to match the rest of AyaKids (light surface, purple/blue accents)
   instead of the old dark "noir" palette. Every rule is scoped under
   #qdSetup so nothing leaks into the shared navbar or the page's
   .game-info-section further down.
   ========================================================================== */

#qdSetup {
    --qd-purple: #8b5cf6;
    --qd-purple-dark: #7453ac;
    --qd-indigo: #667eea;
    --qd-indigo-dark: #764ba2;
    --qd-ink: #1f2937;
    --qd-muted: #6b7280;
    --qd-line: #e6e8f0;

    min-height: 100vh;
    padding: 90px 20px 50px;
    background: linear-gradient(135deg, #667eea 0%, #8b5cf6 55%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
}

/* Soft decorative dot grid, kept subtle and non-animated so it never
   competes with the content or costs paint time on low-end phones. */
#qdSetup::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .18) 1px, transparent 1px);
    background-size: 26px 26px;
    z-index: 0;
    pointer-events: none;
}

#qdSetup .setup-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 860px;
    background: #fff;
    border: none;
    border-radius: 24px;
    padding: 0 0 34px;
    box-shadow: 0 20px 60px rgba(31, 41, 55, .18);
    overflow: hidden;
}

/* ---------- header ---------- */
#qdSetup .setup-header {
    background: linear-gradient(135deg, var(--qd-indigo), var(--qd-indigo-dark));
    color: #fff;
    padding: 38px 30px 32px;
    text-align: center;
    margin-bottom: 30px;
}

#qdSetup .setup-icon {
    width: 92px;
    height: 92px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
}

#qdSetup .setup-header h1 {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
}

#qdSetup .setup-header p {
    color: rgba(255, 255, 255, .9);
    font-size: 1rem;
    margin: 0;
}

#qdSetup .setup-body {
    padding: 0 34px;
}

/* Deliberately named .qd-section-title (not .section-title) so it can never
   clash with the shared homepage/section styling used lower on the page. */
#qdSetup .qd-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--qd-ink);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---------- guest notice ---------- */
#qdSetup .alert-notice {
    background: linear-gradient(135deg, var(--qd-indigo), var(--qd-indigo-dark));
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 26px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: #fff;
}

#qdSetup .alert-icon {
    font-size: 26px;
    background: rgba(255, 255, 255, .2);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#qdSetup .alert-content h4 {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 800;
}

#qdSetup .alert-content p {
    margin: 0;
    font-size: .85rem;
    opacity: .92;
}

/* ---------- case-type tabs ---------- */
#qdSetup .type-selector {
    display: flex;
    background: #f3f4f6;
    border: 2px solid var(--qd-line);
    padding: 6px;
    border-radius: 16px;
    margin-bottom: 26px;
    gap: 6px;
}

#qdSetup .type-tab {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .25s ease;
    text-align: center;
    color: var(--qd-muted);
    user-select: none;
}

#qdSetup .type-tab:hover {
    color: var(--qd-purple-dark);
    background: #fff;
}

#qdSetup .type-tab.active {
    background: linear-gradient(135deg, var(--qd-indigo), var(--qd-indigo-dark));
    color: #fff;
    box-shadow: 0 6px 16px rgba(102, 126, 234, .34);
}

/* ---------- case cards ---------- */
#qdSetup .cases-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

#qdSetup .case-card {
    background: #fff;
    border: 2px solid var(--qd-line);
    border-radius: 18px;
    padding: 20px;
    cursor: pointer;
    transition: all .25s ease;
    position: relative;
}

#qdSetup .case-card:hover {
    transform: translateY(-4px);
    border-color: var(--qd-purple);
    box-shadow: 0 12px 26px rgba(139, 92, 246, .16);
}

#qdSetup .case-card.active {
    border-color: var(--qd-purple);
    background: #f5f3ff;
    box-shadow: 0 10px 26px rgba(139, 92, 246, .22);
}

#qdSetup .case-badge {
    font-size: .75rem;
    font-weight: 700;
    background: #ede9fe;
    color: var(--qd-purple-dark);
    padding: 4px 12px;
    border-radius: 50px;
    display: inline-block;
    margin-bottom: 10px;
}

#qdSetup .case-card.active .case-badge {
    background: var(--qd-purple);
    color: #fff;
}

#qdSetup .case-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--qd-ink);
    margin-bottom: 6px;
}

#qdSetup .case-desc {
    color: var(--qd-muted);
    font-size: .85rem;
    line-height: 1.6;
}

/* ---------- dynamic (custom range) panel ---------- */
#qdSetup .dynamic-settings {
    display: none;
    background: #f9fafb;
    border: 2px solid var(--qd-line);
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 28px;
    animation: qdFadeIn .35s ease;
}

@keyframes qdFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#qdSetup .surah-select-container {
    position: relative;
}

#qdSetup .surah-search {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid var(--qd-line);
    background: #fff;
    color: var(--qd-ink);
    border-radius: 14px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color .25s, box-shadow .25s;
}

#qdSetup .surah-search:focus {
    border-color: var(--qd-indigo);
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, .15);
}

#qdSetup .surah-list {
    max-height: 220px;
    overflow-y: auto;
    border: 2px solid var(--qd-indigo);
    border-radius: 14px;
    display: none;
    position: absolute;
    z-index: 20;
    background: #fff;
    width: 100%;
    top: 100%;
    margin-top: 6px;
    box-shadow: 0 18px 36px rgba(31, 41, 55, .16);
}

#qdSetup .surah-list .surah-item {
    padding: 12px 16px;
    cursor: pointer;
    color: var(--qd-ink);
    border-bottom: 1px solid #f0f0f0;
    transition: background .2s, color .2s;
    text-align: right;
}

#qdSetup .surah-list .surah-item:last-child {
    border-bottom: none;
}

#qdSetup .surah-list .surah-item:hover {
    background: #f3e8ff;
    color: var(--qd-purple-dark);
    font-weight: 700;
}

#qdSetup .surah-range-inputs {
    display: flex;
    gap: 16px;
}

#qdSetup .surah-range-inputs .surah-select-container {
    flex: 1;
    min-width: 0;
}

#qdSetup .range-label {
    font-size: .85rem;
    font-weight: 700;
    color: var(--qd-muted);
    margin-bottom: 7px;
    display: block;
}

/* ---------- shared form bits ---------- */
#qdSetup .form-group {
    margin-bottom: 26px;
}

#qdSetup label {
    font-size: .95rem;
    font-weight: 700;
    color: var(--qd-ink);
    margin-bottom: 10px;
    display: block;
}

#qdSetup select.form-control {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid var(--qd-line);
    background: #fff;
    color: var(--qd-ink);
    border-radius: 14px;
    font-size: 1rem;
    font-family: inherit;
}

#qdSetup select.form-control:focus {
    border-color: var(--qd-indigo);
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, .15);
}

/* ---------- difficulty cards ---------- */
#qdSetup .level-cards {
    display: flex;
    gap: 14px;
    justify-content: center;
}

#qdSetup .level-card {
    flex: 1 1 0;
    min-width: 0;
    padding: 18px 12px;
    border: 2px solid var(--qd-line);
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    transition: all .25s ease;
    background: #fff;
}

#qdSetup .level-card:hover {
    border-color: var(--qd-indigo);
    transform: translateY(-3px);
    box-shadow: 0 10px 22px rgba(102, 126, 234, .16);
}

#qdSetup .level-card.active {
    border-color: var(--qd-indigo);
    background: linear-gradient(135deg, var(--qd-indigo), var(--qd-indigo-dark));
    box-shadow: 0 12px 26px rgba(102, 126, 234, .32);
    transform: scale(1.04);
}

#qdSetup .level-icon {
    font-size: 1.7rem;
    margin-bottom: 6px;
}

#qdSetup .level-name {
    font-weight: 800;
    color: var(--qd-ink);
    margin-bottom: 4px;
}

#qdSetup .level-desc {
    font-size: .78rem;
    color: var(--qd-muted);
    line-height: 1.5;
}

#qdSetup .level-card.active .level-name,
#qdSetup .level-card.active .level-desc {
    color: #fff;
}

#qdSetup .level-card.active .level-desc {
    color: rgba(255, 255, 255, .85);
}

/* ---------- actions ---------- */
#qdSetup .btn-start-game {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--qd-indigo), var(--qd-indigo-dark));
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    transition: all .25s ease;
    margin-top: 10px;
}

#qdSetup .btn-start-game:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(102, 126, 234, .38);
}

#qdSetup .btn-start-game:disabled {
    opacity: .5;
    cursor: not-allowed;
}

#qdSetup .back-link {
    display: block;
    text-align: center;
    margin-top: 18px;
    color: var(--qd-muted);
    text-decoration: none;
    font-weight: 700;
    font-size: .95rem;
    transition: color .2s;
}

#qdSetup .back-link:hover {
    color: var(--qd-purple-dark);
}

/* ---------- responsive ---------- */
@media (max-width: 768px) {
    #qdSetup {
        padding: 80px 14px 40px;
    }
    #qdSetup .setup-card {
        border-radius: 20px;
    }
    #qdSetup .setup-header {
        padding: 28px 20px 24px;
        margin-bottom: 24px;
    }
    #qdSetup .setup-icon {
        width: 68px;
        height: 68px;
        font-size: 2rem;
        margin-bottom: 10px;
    }
    #qdSetup .setup-header h1 {
        font-size: 1.4rem;
    }
    #qdSetup .setup-header p {
        font-size: .9rem;
    }
    #qdSetup .setup-body {
        padding: 0 16px;
    }
    #qdSetup .cases-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    #qdSetup .case-card {
        padding: 16px;
    }
    #qdSetup .surah-range-inputs {
        flex-direction: column;
        gap: 14px;
    }
    #qdSetup .type-tab {
        padding: 11px 8px;
        font-size: .9rem;
    }
    /* Keep the three difficulty cards on one row — stacking them made the
       form very long on phones. */
    #qdSetup .level-cards {
        gap: 8px;
    }
    #qdSetup .level-card {
        padding: 12px 6px;
    }
    #qdSetup .level-icon {
        font-size: 1.35rem;
    }
    #qdSetup .level-name {
        font-size: .82rem;
    }
    #qdSetup .level-desc {
        display: none;
    }
    #qdSetup .dynamic-settings {
        padding: 18px 14px;
    }
}
