/* ============================================================================
   create-wizard.css — shared stepped "create" modal used by every creator
   (worlds, family trees, books, maps, campaigns, lore).

   Generalised from the gold-standard worlds wizard (formerly .pl-wz-*) and
   given an "Aero" frosted-glass treatment. Driven by assets/js/create-wizard.js
   (window.TalWizard). Classes are theme-aware via the site CSS vars, so this
   works in both light and dark (html.dark-mode) and inherits per-portal accents.
   ========================================================================== */

/* ── Overlay: dim + blur the page behind ─────────────────────────────────── */
.cw-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: var(--z-modal, 400);                 /* custom-select menu (300) + confirmDialog (500) must sit above this */
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(10, 12, 18, 0.38);
    -webkit-backdrop-filter: blur(9px) saturate(1.1);
    backdrop-filter: blur(9px) saturate(1.1);
}
.cw-overlay.active { display: flex; animation: cwOverlayIn 0.22s ease both; }
@keyframes cwOverlayIn { from { opacity: 0; } to { opacity: 1; } }

body.cw-open { overflow: hidden; }

/* ── Box: translucent frosted glass panel ────────────────────────────────── */
.cw-box {
    position: relative;
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 14px;
    padding: 2rem 2rem 1.75rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-light);
    /* Fill = the theme panel tinted with the section color (--cw-tint, set per
       portal in nav.php; falls back to worlds blue), kept translucent. */
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 42%),
        color-mix(in srgb, color-mix(in srgb, var(--cw-tint, #3d8ce8) 17%, var(--card-bg-light)) 70%, transparent);
    -webkit-backdrop-filter: blur(24px) saturate(1.45);
    backdrop-filter: blur(24px) saturate(1.45);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        0 24px 70px rgba(0, 0, 0, 0.45);
    animation: cwBoxIn 0.30s cubic-bezier(0.34, 1.18, 0.64, 1) both;
}
@keyframes cwBoxIn {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
    to   { opacity: 1; transform: none; }
}

/* Light theme: a deep, saturated tinted "smoked glass" — leans into the section
   color (--cw-tint) over a near-black base so it goes dark WITHOUT muddy grey.
   Because the panel is now dark, the modal's internals flip to light text +
   recessed inputs (scoped here so nothing else on the light page is affected). */
html:not(.dark-mode) .cw-box {
    --text-light: #eaeef6;
    --accent-secondary: #aebccf;
    --accent-primary: var(--cw-tint, #3d8ce8);
    --bg-light: rgba(0, 0, 0, 0.22);
    --border-light: rgba(255, 255, 255, 0.16);

    color: var(--text-light);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0) 42%),
        color-mix(in srgb, color-mix(in srgb, var(--cw-tint, #3d8ce8) 45%, #161a26) 82%, transparent);
    border-color: color-mix(in srgb, var(--cw-tint, #3d8ce8) 30%, rgba(255, 255, 255, 0.16));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 26px 70px rgba(8, 14, 28, 0.42);
}

/* Graceful fallback where backdrop-filter is unsupported: go (mostly) opaque */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .cw-overlay { background: rgba(10, 12, 18, 0.72); }
    .cw-box     { background: color-mix(in srgb, var(--cw-tint, #3d8ce8) 14%, var(--card-bg-light)); }
    html:not(.dark-mode) .cw-box { background: color-mix(in srgb, var(--cw-tint, #3d8ce8) 45%, #161a26); }
}

/* ── Step header (numbered indicators) ───────────────────────────────────── */
.cw-steps { display: flex; align-items: center; gap: 0; margin-bottom: 2rem; }
.cw-step  { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.cw-step-num {
    width: 30px; height: 30px; border-radius: 50%;
    border: 2px solid var(--border-light); background: var(--bg-light);
    color: var(--text-light); opacity: 0.5;
    font-family: 'Inter', sans-serif; font-size: 0.82rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.2s, background 0.2s, color 0.2s, opacity 0.2s;
}
.cw-step.active .cw-step-num { border-color: var(--accent-primary); background: var(--accent-primary); color: #1a1400; opacity: 1; }
.cw-step.done   .cw-step-num { border-color: var(--accent-primary); background: transparent; color: var(--accent-primary); opacity: 1; }
.cw-step-label {
    font-family: 'Inter', sans-serif; font-size: 0.68rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.07em;
    color: var(--text-light); opacity: 0.45; white-space: nowrap;
}
.cw-step.active .cw-step-label { color: var(--accent-primary); opacity: 1; }
.cw-connector { flex: 1; height: 2px; background: var(--border-light); margin: 0 0.5rem 0.95rem; transition: background 0.2s; }
.cw-connector.done { background: var(--accent-primary); }

/* ── Panels (one per step) ───────────────────────────────────────────────── */
.cw-panel { display: none; }
.cw-panel.active { display: block; animation: cwPanelIn 0.22s ease both; }
@keyframes cwPanelIn { from { opacity: 0; transform: translateX(6px); } to { opacity: 1; transform: none; } }

.cw-question {
    font-family: 'Inter', sans-serif; font-size: 1.05rem; font-weight: 700;
    color: var(--text-light); margin-bottom: 1.1rem; line-height: 1.35;
}
.cw-question em { color: var(--accent-primary); font-style: normal; }

/* Single-step wizards: a plain heading instead of the step bar */
.cw-title {
    font-family: 'Inter', sans-serif; font-size: 1.2rem; font-weight: 700;
    color: var(--text-light); margin: 0 0 1.4rem; line-height: 1.3;
}

/* ── Fields ──────────────────────────────────────────────────────────────── */
.cw-field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.cw-field label,
.cw-field > .cw-field-label {
    font-size: 0.75rem; font-weight: 600; color: var(--accent-secondary);
    text-transform: uppercase; letter-spacing: 0.05em;
}
.cw-field input,
.cw-field textarea,
.cw-field select {
    padding: 0.55rem 0.7rem; border: 1px solid var(--border-light); border-radius: 6px;
    background: var(--bg-light); color: var(--text-light);
    font-family: 'Inter', sans-serif; font-size: 0.88rem;
    outline: none; transition: border-color 0.15s; width: 100%; box-sizing: border-box;
}
.cw-field input:focus,
.cw-field textarea:focus,
.cw-field select:focus { border-color: var(--accent-primary); }
.cw-field input::placeholder,
.cw-field textarea::placeholder { color: var(--text-light); opacity: 0.4; }
.cw-field textarea { resize: vertical; min-height: 70px; }
.cw-req { color: #ef5350; }
.cw-optional { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-light); opacity: 0.45; }
.cw-char-count { font-size: 0.75rem; color: var(--text-light); opacity: 0.45; margin-top: 0.2rem; }
.cw-hint { font-family: 'Inter', sans-serif; font-size: 0.74rem; color: var(--accent-secondary); margin-top: 0.3rem; line-height: 1.4; }

.cw-section-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-light); opacity: 0.5; margin-bottom: 0.5rem; }
.cw-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin-bottom: 0.9rem; }
.cw-row-2 .cw-field { margin-bottom: 0; }
.cw-field-label { font-family: 'Inter', sans-serif; font-size: 0.78rem; font-weight: 600; color: var(--accent-secondary); margin-bottom: 0.3rem; }
.cw-divider { border: none; border-top: 1px solid var(--border-light); margin: 1rem 0; }

/* ── Repeatable rows (months / week-days / etc.) ─────────────────────────── */
.cw-month-row, .cw-week-row { display: grid; align-items: center; gap: 0.4rem; margin-bottom: 0.4rem; }
.cw-month-row { grid-template-columns: 2fr 1fr auto; }
.cw-week-row  { grid-template-columns: 1fr auto; }
.cw-month-row input, .cw-week-row input {
    padding: 0.45rem 0.55rem; font-size: 0.85rem;
    border: 1px solid var(--border-light); border-radius: 5px;
    background: var(--bg-light); color: var(--text-light); font-family: 'Inter', sans-serif;
    outline: none; transition: border-color 0.15s;
}
.cw-month-row input:focus, .cw-week-row input:focus { border-color: var(--accent-primary); }
.cw-remove {
    background: none; border: 1px solid var(--border-light); color: var(--text-light); opacity: 0.5;
    width: 26px; height: 26px; border-radius: 4px; cursor: pointer; font-size: 0.85rem;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s, opacity 0.15s;
}
.cw-remove:hover { border-color: #c62828; color: #c62828; opacity: 1; }

.cw-add-btn {
    font-family: 'Inter', sans-serif; font-size: 0.78rem; font-weight: 600;
    color: var(--accent-primary); background: none;
    border: 1px dashed var(--accent-primary); border-radius: 4px;
    padding: 0.28rem 0.65rem; cursor: pointer; margin-top: 0.2rem;
    transition: background 0.15s;
}
.cw-add-btn:hover { background: color-mix(in srgb, var(--accent-primary) 10%, transparent); }

.cw-skip {
    font-family: 'Inter', sans-serif; font-size: 0.8rem; color: var(--text-light); opacity: 0.45;
    background: none; border: none; cursor: pointer; padding: 0;
    text-decoration: underline; text-underline-offset: 3px;
}
.cw-skip:hover { opacity: 0.8; }

/* ── Footer nav (Back / Next / Cancel / Create) ──────────────────────────── */
.cw-nav { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 1.5rem; flex-wrap: wrap; }
.cw-nav--end { justify-content: flex-end; }

/* ── Choice tiles (e.g. map type picker, status pills) ───────────────────── */
.cw-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin-bottom: 0.5rem; }
.cw-choice {
    display: flex; flex-direction: column; gap: 0.3rem; text-align: left;
    padding: 0.85rem 0.9rem; border-radius: 9px; cursor: pointer;
    border: 1px solid var(--border-light); background: var(--bg-light);
    color: var(--text-light); font-family: 'Inter', sans-serif;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.cw-choice:hover { border-color: var(--accent-primary); transform: translateY(-2px); }
.cw-choice.active { border-color: var(--accent-primary); background: color-mix(in srgb, var(--accent-primary) 12%, transparent); }
.cw-choice-title { font-size: 0.92rem; font-weight: 700; }
.cw-choice-desc  { font-size: 0.74rem; opacity: 0.7; line-height: 1.35; }

@media (max-width: 768px) {
    .cw-row-2,
    .cw-choice-grid { grid-template-columns: 1fr; }
}
