/**
 * Scenario Selection Modal, Editor & Challenge Panel Styles
 */

/* ===================== Scenario Selection Modal ===================== */
#scenarioModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: var(--z-control-bar);
    display: flex;
    justify-content: center;
    align-items: center;
}

#scenarioModal.hidden {
    display: none !important;
}

.scenario-modal-content {
    background: rgba(20, 20, 40, 0.98);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(100, 100, 255, 0.3);
    border-radius: 12px;
    padding: 20px;
    min-width: 500px;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    color: #fff;
}

.scenario-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.scenario-modal-header h2 {
    margin: 0;
    font-size: 16px;
    color: #7c8aff;
}

.scenario-modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.scenario-modal-close:hover {
    color: #fff;
}

/* Scenario List Grid */
.scenario-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.scenario-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.scenario-card:hover {
    border-color: rgba(61, 90, 254, 0.6);
    background: rgba(61, 90, 254, 0.1);
    transform: translateY(-1px);
}

.scenario-card h3 {
    margin: 0 0 4px;
    font-size: 13px;
    color: #ccc;
}

.scenario-card p {
    margin: 0;
    font-size: 11px;
    color: #888;
    line-height: 1.3;
}

.scenario-card .scenario-tags {
    margin-top: 6px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.scenario-card .scenario-tag {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(61, 90, 254, 0.2);
    color: #7c8aff;
}

/* Scenario Progress Bar */
#scenarioProgress {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-scenario-progress);
    background: rgba(20, 20, 40, 0.95);
    border: 1px solid rgba(100, 100, 255, 0.3);
    border-radius: 8px;
    padding: 8px 16px;
    color: #fff;
    font-size: 12px;
    min-width: 300px;
}

#scenarioProgress.hidden {
    display: none !important;
}

/* Scenario Overlay (Start/Result Screen) */
#scenarioOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: var(--z-header);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
}

#scenarioOverlay.hidden {
    display: none !important;
}

/* Shared panel base */
.scenario-panel,
.challenge-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 40, 0.97);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(100, 100, 255, 0.3);
    border-radius: 12px;
    padding: 16px;
    z-index: 1100;
    color: #fff;
    min-width: 420px;
    max-width: 520px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* Headers */
.scenario-header,
.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.scenario-header h4,
.challenge-header h4 {
    margin: 0;
    font-size: 14px;
    color: #7c8aff;
}

.scenario-close,
.challenge-close {
    background: none;
    border: none;
    color: #888;
    font-size: 18px;
    cursor: pointer;
}

.scenario-close:hover,
.challenge-close:hover {
    color: #fff;
}

.scenario-header button {
    background: rgba(61, 90, 254, 0.2);
    border: 1px solid rgba(61, 90, 254, 0.4);
    color: #7c8aff;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    margin-left: 4px;
}

.scenario-header button:hover {
    background: rgba(61, 90, 254, 0.4);
}

/* Scenario Form */
.scenario-field {
    margin-bottom: 6px;
}

.scenario-field label {
    display: block;
    font-size: 9px;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.scenario-field input,
.scenario-field select {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 4px 6px;
    color: #fff;
    font-size: 12px;
    box-sizing: border-box;
}

.scenario-field-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.scenario-field-row .scenario-field {
    flex: 1;
    margin-bottom: 0;
}

.scenario-form h5 {
    margin: 10px 0 4px;
    font-size: 11px;
    color: #7c8aff;
}

/* Scenario Steps */
.scenario-step {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
    align-items: center;
}

.scenario-step select,
.scenario-step input {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    padding: 3px 4px;
    color: #fff;
    font-size: 11px;
}

.scenario-step select {
    width: 70px;
}

.scenario-step input[type="number"] {
    width: 60px;
}

.scenario-step input[type="text"] {
    flex: 1;
}

.scenario-remove-step {
    background: none;
    border: none;
    color: #f44336;
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
}

/* Scenario Actions */
.scenario-actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
}

.scenario-actions button {
    flex: 1;
    background: rgba(61, 90, 254, 0.2);
    border: 1px solid rgba(61, 90, 254, 0.3);
    color: #7c8aff;
    padding: 5px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
}

.scenario-actions button:hover {
    background: rgba(61, 90, 254, 0.4);
}

/* Challenge Presets */
.challenge-presets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.challenge-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
}

.challenge-card:hover {
    border-color: rgba(61, 90, 254, 0.6);
    background: rgba(61, 90, 254, 0.1);
}

.challenge-card .emoji {
    font-size: 24px;
    display: block;
    margin-bottom: 4px;
}

.challenge-card .name {
    font-size: 12px;
    font-weight: bold;
    color: #ccc;
}

.challenge-card .desc {
    font-size: 9px;
    color: #888;
    margin-top: 2px;
}

/* Progress Bar */
.challenge-progress {
    margin-bottom: 10px;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3d5afe, #448aff);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s;
}

#challengeStatus {
    font-size: 11px;
    color: #aaa;
}

/* Leaderboard */
.challenge-leaderboard h5 {
    font-size: 11px;
    color: #7c8aff;
    margin: 8px 0 4px;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 11px;
    color: #aaa;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.leaderboard-entry .score {
    color: #ffab40;
    font-weight: bold;
}