/* ============================================================ */
/* === ADMIN.CSS — qwizzle Admin Panel                      === */
/* === Discord-Kompatibilität, Modals, Editor, Controls     === */
/* ============================================================ */


/* ============================================================ */
/* === 1. DISCORD COMPATIBILITY & POINTER-EVENTS            === */
/* ============================================================ */

/* Hintergrund & Canvas ignorieren — dürfen keine Klicks blocken.
   FIX: z-index auf 0 statt -1, da -1 in Discord Webview body-Klicks abfing. */
.bg-animations,
.bg-animations *,
#particles-canvas,
canvas {
    pointer-events: none !important;
    position: fixed !important;
    z-index: 0 !important;
}

/* Body Interaktion erzwingen.
   FIX: isolation:isolate erstellt sauberen Stacking Context in Discord Webview. */
body.admin-mode {
    pointer-events: auto !important;
    isolation: isolate;
    /* Discord: box-sizing verhindert dass padding-top 100vh sprengt */
    padding-top: 15px;
    box-sizing: border-box;
}

/* Discord Activity: kein body-zoom, overflow sichern */
body.admin-mode.discord-activity {
    zoom: unset !important;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

body.admin-mode.discord-activity .container {
    zoom: unset !important;
    width: 100vw !important;
    height: calc(100vh - 15px) !important;
    transform-origin: top left;
    transform: scale(0.8);
    /* Fallback — JS überschreibt das */
}

/* Interaktive Elemente explizit freischalten.
   FIX: position:relative aus diesem Selektor entfernt — per * erzeugte es in Discord
   hunderte Stacking Contexts die sich gegenseitig überdeckten. */
button,
input,
select,
textarea,
a,
.card,
.team-card,
.ctrl-btn,
.action-btn,
.admin-tb-btn,
.q-tool-btn,
.admin-input,
.q-editor-textarea,
.q-dropzone,
.team-edit-btn,
.btn-add-team,
.btn-admin-tool,
.sidebar,
#admin-toolbar {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Icons in Buttons fangen keine Klicks — oft das Hauptproblem in Discord */
button svg,
button path,
.admin-tb-btn svg,
.admin-tb-btn path,
.ctrl-btn svg,
.ctrl-btn path {
    pointer-events: none !important;
}

/* Globale SVG/Path-Regel für Admin-Ansicht */
svg,
path {
    pointer-events: none !important;
}

/* Admin Floating Controls explizit nach vorne holen */
#admin-floating-controls {
    z-index: 10000 !important;
    pointer-events: none !important;
    position: fixed !important;
}

#admin-floating-controls > * {
    pointer-events: auto !important;
}

/* Aggressives Whitelisting — FIX: position:relative aus .container * entfernt */
.container,
.container *,
.game-area,
.sidebar,
.sidebar *,
button,
input,
select,
.admin-tb-btn,
.ctrl-btn,
.action-btn {
    pointer-events: auto !important;
}


/* ============================================================ */
/* === 2. Z-INDEX HIERARCHIE                                === */
/* ============================================================ */

#admin-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5000 !important;
}

#admin-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 6000 !important;
    pointer-events: auto !important;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000 !important;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(5, 0, 10, 0.85);
    pointer-events: auto !important;
}

.modal-box,
.q-editor-box {
    position: relative;
    z-index: 100001 !important;
    pointer-events: auto !important;
}


/* ============================================================ */
/* === 3. ADMIN FLOATING CONTROLS (TOOLBAR OBEN RECHTS)     === */
/* ============================================================ */

#admin-floating-controls {
    position: fixed;
    top: 15px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    align-items: flex-start;
    pointer-events: none;
}

.admin-menu-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#admin-menu-btn {
    background: rgba(108, 92, 231, 0.4);
    border-color: rgba(108, 92, 231, 0.6);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#admin-menu-btn:hover {
    background: rgba(108, 92, 231, 0.7);
    transform: scale(1.05);
}

/* --- Toolbar Buttons --- */

.admin-tb-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    width: 45px;
    height: 45px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}

.admin-tb-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.admin-tb-btn:hover {
    background: rgba(108, 92, 231, 0.35);
    border-color: rgba(108, 92, 231, 0.6);
    color: #fff;
}

.admin-tb-danger {
    color: rgba(255, 118, 117, 0.7) !important;
    border-color: rgba(214, 48, 49, 0.3) !important;
}

.admin-tb-danger:hover {
    background: rgba(214, 48, 49, 0.3) !important;
    border-color: rgba(214, 48, 49, 0.7) !important;
    color: #ff7675 !important;
}

.admin-tb-divider {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 4px;
}

.admin-tb-back {
    width: auto !important;
    padding: 0 14px !important;
    gap: 7px;
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #a29bfe !important;
    border-color: rgba(108, 92, 231, 0.4) !important;
    background: rgba(108, 92, 231, 0.12) !important;
}

.admin-tb-back:hover {
    background: rgba(108, 92, 231, 0.35) !important;
    border-color: rgba(108, 92, 231, 0.7) !important;
    color: #fff !important;
}

.admin-tb-back span {
    line-height: 1;
}

/* --- Dropdown --- */

.admin-dropdown {
    position: absolute;
    top: 55px;
    right: 0;
    width: 250px;
    background: rgba(20, 10, 35, 0.95);
    border: 1px solid rgba(108, 92, 231, 0.4);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
    z-index: 5001;
}

.admin-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 8px 20px 12px;
    color: #a29bfe;
    font-size: 0.75em;
    font-weight: 700;
    letter-spacing: 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 8px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s;
}

.dropdown-item svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    opacity: 0.8;
}

.dropdown-item:hover {
    background: rgba(108, 92, 231, 0.2);
    color: #fff;
}

.dropdown-item.danger {
    color: #ff7675;
}

.dropdown-item.danger:hover {
    background: rgba(214, 48, 49, 0.15);
    color: #ff7675;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 8px 0;
}


/* ============================================================ */
/* === 4. ADMIN ROW CONTROL (SPALTEN-SLIDER)                === */
/* ============================================================ */

#admin-row-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 30px;
    padding: 0 14px;
    height: 45px;
}

@supports not (backdrop-filter: blur(5px)) {
    .admin-row-control {
        backdrop-filter: none;
    }
}

.admin-row-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
}

#admin-row-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 90px;
    height: 4px;
    border-radius: 2px;
    background: rgba(162, 155, 254, 0.3);
    outline: none;
    cursor: pointer;
}

#admin-row-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #a29bfe;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(108, 92, 231, 0.6);
    transition: transform 0.15s, box-shadow 0.15s;
}

#admin-row-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(108, 92, 231, 0.9);
}

#admin-row-val {
    font-size: 1em;
    font-weight: 700;
    color: #a29bfe;
    min-width: 14px;
    text-align: center;
}


/* ============================================================ */
/* === 5. ADMIN MENU & GRID CONTROLS                        === */
/* ============================================================ */

.admin-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    font-family: 'Lobster', cursive;
    font-size: 1.5em;
    color: #a29bfe;
}

.admin-grid-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn-admin-tool {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: 0.2s;
    font-size: 0.9em;
}

.btn-admin-tool:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-sidebar-mini {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #aaa;
    font-size: 0.8em;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    margin-right: 5px;
}

.btn-sidebar-mini:hover {
    background: #ff7675;
    color: white;
}


/* ============================================================ */
/* === 6. ADMIN KARTEN-ZUSTÄNDE                             === */
/* ============================================================ */

.admin-card-empty {
    opacity: 0.45;
}

.admin-card-filled {
    opacity: 1;
    border: 2px solid rgba(0, 184, 148, 0.65) !important;
    box-shadow: 0 0 14px rgba(0, 184, 148, 0.28), inset 0 0 8px rgba(0, 184, 148, 0.08) !important;
}

.admin-card-filled::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(0, 184, 148, 0.06);
    pointer-events: none;
    z-index: 1;
}

/* Grüner Checkmark-Badge oben rechts auf befüllten Karten */
.admin-card-filled::after {
    content: '' !important;
    position: absolute !important;
    top: 7px !important;
    right: 7px !important;
    width: 16px !important;
    height: 16px !important;
    background: #00b894 !important;
    border-radius: 50% !important;
    opacity: 1 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") !important;
    background-size: 11px !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    z-index: 5 !important;
    pointer-events: none !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35) !important;
}

.admin-card-played {
    opacity: 0.38;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    box-shadow: none !important;
    filter: saturate(0.2);
}

.admin-card-played::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: repeating-linear-gradient(-45deg,
    transparent,
    transparent 6px,
    rgba(255, 255, 255, 0.07) 6px,
    rgba(255, 255, 255, 0.07) 7px);
    pointer-events: none;
    z-index: 2;
}

.admin-card-played::after {
    opacity: 0 !important;
}

.admin-card-played:hover {
    opacity: 0.65;
    border-color: rgba(255, 118, 117, 0.4) !important;
    cursor: pointer;
}


/* ============================================================ */
/* === 7. SIDEBAR (ADMIN-ANSICHT)                           === */
/* ============================================================ */

.sidebar {
    opacity: 1 !important;
    transform: none !important;
}

body.admin-mode .sidebar {
    margin-top: 0;
    padding-top: 10px;
    justify-content: flex-start !important;
}

.cat-header {
    cursor: pointer;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: 0.2s;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.2;
    padding: 5px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.cat-header:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-sidebar-action {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ccc;
    margin-top: 5px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
}

.btn-sidebar-action:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-danger {
    color: #ff7675;
    border-color: rgba(214, 48, 49, 0.3);
}

.btn-danger:hover {
    background: rgba(214, 48, 49, 0.2);
}


/* ============================================================ */
/* === 8. ADMIN LAYOUT ANPASSUNGEN                          === */
/* ============================================================ */

.game-area {
    position: relative;
}

body.admin-mode .game-area {
    justify-content: flex-start;
    padding-top: 10px;
}

.game-area .header-wrapper {
    margin-bottom: 0;
}

body.admin-mode .container {
    padding-top: 8px;
}

body.admin-mode .host-display {
    padding: 10px !important;
    margin-bottom: 8px !important;
}

body.admin-mode .host-display #host-avatar {
    width: clamp(50px, 6vw, 70px) !important;
    height: clamp(50px, 6vw, 70px) !important;
}

body.admin-mode .host-crown {
    font-size: 1.4em !important;
    top: -12px !important;
}

body.admin-mode .sidebar-title {
    font-size: clamp(1.4em, 2vw, 2.2em) !important;
    margin: 4px 0 !important;
}

body.admin-mode .team-scroll {
    gap: 6px;
    padding-bottom: 60px !important;
}

#admin-io-controls {
    display: flex;
    gap: 10px;
    z-index: 3000;
}


/* ============================================================ */
/* === 9. MODAL OVERLAY & CLOSE BUTTON                      === */
/* ============================================================ */

.modal-overlay .close-x {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    z-index: 999999 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    border: none !important;
    cursor: pointer !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    font-size: 20px !important;
    line-height: 1 !important;
    padding: 0 !important;
    margin: 0 !important;
    pointer-events: auto !important;
    transition: background 0.2s ease, transform 0.2s ease !important;
}

.modal-overlay .close-x:hover {
    background: rgba(214, 48, 49, 0.8) !important;
    transform: scale(1.1) !important;
    color: white !important;
    text-shadow: none !important;
}

/* Close-Button am Editor-Overlay (außerhalb modal-overlay) */
.close-x {
    position: absolute !important;
    top: 15px !important;
    right: 20px !important;
    z-index: 100002 !important;
    pointer-events: auto !important;
}

.close-x:hover {
    color: #ff7675 !important;
    transform: scale(1.1) rotate(90deg) !important;
    text-shadow: 0 0 15px rgba(255, 118, 117, 0.8) !important;
}


/* ============================================================ */
/* === 10. MODAL INPUTS & BUTTONS                           === */
/* ============================================================ */

.modal-box h2 {
    font-family: 'Lobster', cursive;
    color: #a29bfe;
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
    margin-bottom: 20px;
    text-align: center;
    letter-spacing: 1px;
}

.admin-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 15px;
    border-radius: 12px;
    width: 100%;
    margin-bottom: 15px;
    font-size: 1rem;
    transition: 0.2s;
    font-family: 'Roboto', sans-serif;
    box-sizing: border-box;
}

.admin-input:focus {
    background: rgba(0, 0, 0, 0.5);
    border-color: #a29bfe;
    outline: none;
    box-shadow: 0 0 0 3px rgba(162, 155, 254, 0.2);
}

.admin-input.huge {
    font-size: 1.5rem;
    text-align: center;
    font-weight: bold;
    background: transparent;
    border: none;
    border-bottom: 2px solid #a29bfe;
    border-radius: 0;
}

label {
    display: block;
    color: #b2bec3;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

.modal-btns {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-modal-save {
    background: linear-gradient(90deg, #6c5ce7, #a29bfe);
    color: white;
    border: none;
    padding: 12px 35px;
    border-radius: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 5px 15px rgba(108, 92, 231, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Roboto', sans-serif;
}

.btn-modal-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.6);
    background: linear-gradient(90deg, #5f4dd0, #9189f0);
}

.btn-modal-cancel {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ccc;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
}

.btn-modal-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-modal-delete {
    background: rgba(255, 70, 70, 0.1);
    border: 1px solid rgba(255, 70, 70, 0.3);
    color: #ff7675;
    padding: 12px 25px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-modal-delete:hover {
    background: rgba(255, 70, 70, 0.2);
    color: white;
    border-color: #ff7675;
}

.team-player-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.team-player-row select {
    flex: 1;
    background: #1e1e2e;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px;
    border-radius: 6px;
}


/* ============================================================ */
/* === 11. STATUS TOAST                                     === */
/* ============================================================ */

#status-msg {
    position: fixed;
    bottom: 20px;
    right: 90px;
    background: #00b894;
    padding: 10px 20px;
    border-radius: 10px;
    color: white;
    font-weight: bold;
    display: none;
    z-index: 6000;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
}


/* ============================================================ */
/* === 12. QUESTION EDITOR                                  === */
/* ============================================================ */

.q-editor-box {
    max-width: 1100px;
    width: 96%;
    padding: 0;
    overflow: visible !important;
    border-radius: 20px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(108, 92, 231, 0.15);
    background: #1e0a32;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative !important;
}

.q-floating-title {
    font-family: 'Lobster', cursive;
    font-size: 3em;
    color: #ffffff;
    margin-bottom: 25px;
    text-align: center;
    z-index: 2002;
    animation: fadeIn 0.3s ease-out;
}

/* --- Zweispalten-Layout --- */

.q-editor-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.q-editor-col {
    padding: 25px;
    padding-top: 35px;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.q-editor-col:last-child {
    border-right: none;
}

.q-editor-col-label {
    font-size: 0.8em;
    font-weight: 700;
    color: #b2bec3;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

/* --- Toolbar --- */

.q-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    padding: 8px 10px;
    flex-wrap: wrap;
    min-height: 46px;
    margin-bottom: 12px;
}

.q-toolbar-right {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(255, 255, 255, 0.04);
    justify-content: flex-start;
}

.q-toolbar-hint {
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.8em;
    font-style: italic;
}

.q-tool-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ccc;
    padding: 5px 13px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: 0.15s;
    text-align: center;
    line-height: 1.4;
    font-family: 'Roboto', sans-serif;
    letter-spacing: 0.3px;
}

.q-tool-btn:hover {
    background: rgba(162, 155, 254, 0.18);
    border-color: #a29bfe;
    color: white;
}

.q-tool-btn.active {
    background: rgba(108, 92, 231, 0.35);
    border-color: #6c5ce7;
    color: #a29bfe;
}

.q-tool-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 0;
    gap: 5px;
}

.q-tool-image {
    background: rgba(108, 92, 231, 0.12);
    border-color: rgba(108, 92, 231, 0.25);
    color: #a29bfe;
    display: inline-flex;
    align-items: center;
}

.q-tool-image:hover,
.q-tool-image.active {
    background: rgba(108, 92, 231, 0.28);
    border-color: #a29bfe;
    color: #fff;
}

.q-tool-youtube {
    background: rgba(255, 70, 70, 0.1);
    border-color: rgba(255, 70, 70, 0.2);
    color: #ff7675;
}

.q-tool-youtube:hover,
.q-tool-youtube.active {
    background: rgba(255, 70, 70, 0.22);
    border-color: #ff7675;
    color: #fff;
}

.q-tool-geo {
    background: rgba(0, 184, 148, 0.1);
    border-color: rgba(0, 184, 148, 0.2);
    color: #00b894;
}

.q-tool-geo:hover,
.q-tool-geo.active {
    background: rgba(0, 184, 148, 0.25);
    border-color: #00b894;
    color: #fff;
}

.q-tool-imgseq {
    color: #a29bfe;
}

.q-tool-imgseq.active {
    background: rgba(162, 155, 254, 0.18);
    border-color: #a29bfe;
    color: #a29bfe;
}

.q-tool-textseq {
    color: #fd79a8;
}

.q-tool-textseq.active {
    background: rgba(253, 121, 168, 0.18);
    border-color: #fd79a8;
    color: #fd79a8;
}

.q-tool-seq {
    background: rgba(253, 121, 168, 0.1);
    border-color: rgba(253, 121, 168, 0.2);
    color: #fd79a8;
}

.q-tool-seq:hover,
.q-tool-seq.active {
    background: rgba(253, 121, 168, 0.25);
    border-color: #fd79a8;
    color: #fff;
}

.q-tool-sep {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 2px;
    flex-shrink: 0;
}

/* --- Textarea --- */

.q-editor-textarea {
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.09);
    color: white;
    padding: 13px 14px;
    border-radius: 10px;
    width: 100%;
    min-height: 105px;
    font-size: 0.95rem;
    font-family: 'Roboto', sans-serif;
    resize: vertical;
    transition: 0.2s;
    box-sizing: border-box;
    line-height: 1.6;
    margin-bottom: 15px;
}

.q-editor-textarea:focus {
    background: rgba(0, 0, 0, 0.5);
    border-color: #a29bfe;
    outline: none;
    box-shadow: 0 0 0 3px rgba(162, 155, 254, 0.12);
}

.q-editor-textarea::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.q-solution-textarea {
    border-color: rgba(0, 184, 148, 0.15);
}

.q-solution-textarea:focus {
    border-color: #00b894;
    box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.1);
}

/* --- Drag & Drop Zone --- */

.q-dropzone {
    border: 1.5px dashed rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.18);
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    gap: 6px;
}

.q-dropzone:hover {
    border-color: rgba(162, 155, 254, 0.4);
    background: rgba(108, 92, 231, 0.05);
}

.q-dropzone.drag-over {
    border-color: #a29bfe;
    background: rgba(108, 92, 231, 0.12);
    box-shadow: 0 0 0 3px rgba(162, 155, 254, 0.15);
}

.q-dropzone-geo {
    border-color: rgba(0, 184, 148, 0.2);
}

.q-dropzone-geo:hover,
.q-dropzone-geo.drag-over {
    border-color: #00b894;
    background: rgba(0, 184, 148, 0.06);
    box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.12);
}

.q-img-preview-inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70px;
}

.q-img-preview-inner img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 6px;
    object-fit: contain;
}

.q-dropzone-hint {
    color: rgba(255, 255, 255, 0.25);
    font-size: 0.82em;
    text-align: center;
    padding: 12px;
    line-height: 1.6;
    pointer-events: none;
}

.q-dropzone-hint small {
    font-size: 0.88em;
    opacity: 0.7;
}

/* --- Entfernen-Button (in Dropzone) --- */

.q-remove-btn {
    background: rgba(214, 48, 49, 0.12);
    border: 1px solid rgba(214, 48, 49, 0.3);
    color: #ff7675;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78em;
    font-weight: 600;
    transition: 0.2s;
    flex-shrink: 0;
    margin-bottom: 6px;
}

.q-remove-btn:hover {
    background: rgba(214, 48, 49, 0.25);
    color: white;
}

.q-remove-btn-geo {
    background: rgba(0, 184, 148, 0.1);
    border-color: rgba(0, 184, 148, 0.3);
    color: #00b894;
}

.q-remove-btn-geo:hover {
    background: rgba(0, 184, 148, 0.22);
    color: white;
}

/* --- Toggle-Zeilen (Checkboxen) --- */

.q-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    padding: 9px 12px;
    cursor: pointer;
    margin: 0;
    font-size: 0.86em;
    color: #ccc;
    text-transform: none;
    letter-spacing: 0;
    font-weight: normal;
    transition: 0.2s;
}

.q-toggle-row:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.q-toggle-row input[type="checkbox"] {
    accent-color: #6c5ce7;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* --- Footer im Editor --- */

.q-editor-box .modal-btns {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    margin: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.18);
    flex-shrink: 0;
    gap: 10px;
    box-sizing: border-box;
}

/* --- Responsive --- */

@media (max-width: 680px) {
    .q-editor-columns {
        grid-template-columns: 1fr;
    }

    .q-editor-col {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
}


/* ============================================================ */
/* === 13. BILD-SEQUENZ GRID                                === */
/* ============================================================ */

.img-seq-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 4px;
}

.img-seq-slot {
    position: relative;
    aspect-ratio: 16/9;
    border-radius: 10px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.18s, background 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-seq-slot:hover {
    border-color: #a29bfe;
    background: rgba(162, 155, 254, 0.08);
}

.img-seq-slot.drag-over {
    border-color: #fd79a8;
    background: rgba(253, 121, 168, 0.1);
}

.img-seq-slot.has-image {
    border-style: solid;
    border-color: rgba(162, 155, 254, 0.5);
}

.img-seq-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.seq-slot-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    pointer-events: none;
    padding: 6px;
}

.seq-slot-num {
    font-size: 1.4em;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.15);
    line-height: 1;
}

.seq-slot-hint {
    font-size: 0.68em;
    color: rgba(255, 255, 255, 0.3);
    text-align: center;
    line-height: 1.3;
}

.seq-slot-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(162, 155, 254, 0.85);
    color: #fff;
    font-size: 0.72em;
    font-weight: 800;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.seq-slot-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(255, 118, 117, 0.85);
    border: none;
    color: #fff;
    font-size: 0.85em;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.seq-slot-remove:hover {
    background: #ff7675;
}


/* ============================================================ */
/* === 14. TEXT-SEQUENZ                                     === */
/* ============================================================ */

.text-seq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.text-seq-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.text-seq-num {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(253, 121, 168, 0.25);
    border: 1px solid rgba(253, 121, 168, 0.5);
    color: #fd79a8;
    font-size: 0.75em;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
}

.text-seq-input {
    flex: 1;
    min-height: 52px;
    resize: vertical;
    font-size: 0.88em !important;
    padding: 8px 10px !important;
}


/* ============================================================ */
/* === 15. SEQUENZ SUB-TOOLBAR                              === */
/* ============================================================ */

.seq-sub-btns {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    background: rgba(162, 155, 254, 0.07);
    border: 1px solid rgba(162, 155, 254, 0.2);
    border-radius: 10px;
}

.seq-sub-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.seq-sub-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.seq-sub-btn.active-img {
    background: rgba(162, 155, 254, 0.2);
    border-color: #a29bfe;
    color: #a29bfe;
}

.seq-sub-btn.active-text {
    background: rgba(253, 121, 168, 0.2);
    border-color: #fd79a8;
    color: #fd79a8;
}


/* ============================================================ */
/* === 16. URL-EINGABE UNTER DROPZONE                       === */
/* ============================================================ */

.img-url-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.img-url-label {
    font-size: 0.78em;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    flex-shrink: 0;
}

.img-url-input {
    flex: 1;
    margin: 0 !important;
    padding: 6px 10px !important;
    font-size: 0.82em !important;
    min-width: 0;
}

.img-url-apply-btn {
    background: rgba(108, 92, 231, 0.5);
    border: 1px solid #a29bfe;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82em;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s;
    pointer-events: auto !important;
}

.img-url-apply-btn:hover {
    background: rgba(108, 92, 231, 0.8);
}