/* ============================================================
   BBT Tutorial – Custom Styles
   Modal für Level-Auswahl + Driver.js Popover-Overrides
   ============================================================ */

/* ── Level-Auswahl-Overlay ─────────────────────────────────── */

.bbt-tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    transition: background 0.4s ease, backdrop-filter 0.4s ease;
    padding: 20px;
}

.bbt-tutorial-overlay-visible {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
}

.bbt-tutorial-overlay-exit {
    background: rgba(0, 0, 0, 0) !important;
    backdrop-filter: blur(0px) !important;
}

.bbt-tutorial-overlay-exit .bbt-tutorial-modal {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
}

/* ── Modal-Box ─────────────────────────────────────────────── */

.bbt-tutorial-modal {
    position: relative;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e0e0e0);
    border-radius: 16px;
    padding: 40px 36px 32px;
    max-width: 520px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    transition: opacity 0.4s ease 0.1s, transform 0.4s ease 0.1s;
}

.bbt-tutorial-overlay-visible .bbt-tutorial-modal {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* ── Close-Button (X) oben rechts im Modal ────────────────── */

.bbt-tutorial-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary, #888);
    font-size: 1.5rem;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.bbt-tutorial-modal-close:hover {
    background: var(--border, #e0e0e0);
    color: var(--text, #1a1a1a);
}

body.dashboard-theme-dark .bbt-tutorial-modal-close:hover {
    background: var(--border, #444);
    color: var(--text, #e0e0e0);
}

.bbt-tutorial-modal-icon {
    margin-bottom: 16px;
    color: var(--primary, #0891b2);
}

.bbt-tutorial-modal-icon svg {
    width: 48px;
    height: 48px;
}

.bbt-tutorial-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text, #1a1a1a);
    margin: 0 0 12px;
}

.bbt-tutorial-modal-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary, #555);
    margin: 0 0 28px;
}

/* ── Level-Buttons ─────────────────────────────────────────── */

.bbt-tutorial-modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bbt-tutorial-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border: 2px solid var(--border, #ddd);
    border-radius: 10px;
    background: var(--card-bg, #fff);
    color: var(--text, #1a1a1a);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bbt-tutorial-btn:hover {
    border-color: var(--primary, #0891b2);
    background: linear-gradient(135deg, var(--primary, #0891b2) 0%, var(--accent, #14b8a6) 100%);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(8, 145, 178, 0.3);
}

.bbt-tutorial-btn:active {
    transform: translateY(0);
}

.bbt-tutorial-btn i {
    font-size: 1.2rem;
}

/* ── Driver.js Popover-Anpassungen ─────────────────────────── */

.bbt-tutorial-popover {
    --djs-theme-color: var(--primary, #0891b2) !important;
}

.bbt-tutorial-popover .driver-popover {
    max-width: 420px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e0e0e0);
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
    padding: 24px 24px 20px;
    color: var(--text-primary, #1a1a1a);
}

.bbt-tutorial-popover .driver-popover-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary, #1a1a1a);
}

.bbt-tutorial-popover .driver-popover-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary, #555);
}

/* ── Driver.js Button Overrides ───────────────────────────── */

.bbt-tutorial-popover .driver-popover-navigation-btns {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

.bbt-tutorial-popover .driver-popover-next-btn {
    all: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--primary, #0891b2) 0%, var(--accent, #14b8a6) 100%);
    border-radius: 9px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
    box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.bbt-tutorial-popover .driver-popover-next-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(8, 145, 178, 0.4);
}

.bbt-tutorial-popover .driver-popover-next-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(8, 145, 178, 0.25);
}

.bbt-tutorial-popover .driver-popover-prev-btn {
    all: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary, #555);
    background: var(--bg-secondary, #f1f5f9);
    border: 1px solid var(--border, #e0e0e0);
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.bbt-tutorial-popover .driver-popover-prev-btn:hover {
    background: var(--bg-card, #fff);
    border-color: var(--primary, #0891b2);
    color: var(--primary, #0891b2);
    transform: translateY(-1px);
}

.bbt-tutorial-popover .driver-popover-close-btn {
    all: unset;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text-secondary, #888);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.bbt-tutorial-popover .driver-popover-close-btn:hover {
    background: var(--bg-secondary, #f1f5f9);
    color: var(--text-primary, #1a1a1a);
}

/* Arrow-Farbe an Popover-Hintergrund anpassen */
.bbt-tutorial-popover .driver-popover-arrow-side-left.driver-popover-arrow,
.bbt-tutorial-popover .driver-popover-arrow-side-right.driver-popover-arrow,
.bbt-tutorial-popover .driver-popover-arrow-side-top.driver-popover-arrow,
.bbt-tutorial-popover .driver-popover-arrow-side-bottom.driver-popover-arrow {
    border-color: var(--card-bg, #fff) !important;
}

/* Anfänger-Zusatzinfo */
.bbt-tutorial-extra {
    margin-top: 14px;
    padding: 12px 14px;
    background: rgba(8, 145, 178, 0.08);
    border-left: 3px solid var(--primary, #0891b2);
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.55;
}

.bbt-tutorial-extra strong {
    display: inline-block;
    margin-bottom: 4px;
    color: var(--primary, #0891b2);
}

/* ── Dark-Mode Overrides ───────────────────────────────────── */

body.dashboard-theme-dark .bbt-tutorial-modal {
    background: var(--card-bg, #1e1e2e);
    border-color: var(--border, #333);
}

body.dashboard-theme-dark .bbt-tutorial-modal-title {
    color: var(--text, #e0e0e0);
}

body.dashboard-theme-dark .bbt-tutorial-modal-text {
    color: var(--text-secondary, #aaa);
}

body.dashboard-theme-dark .bbt-tutorial-btn {
    background: var(--card-bg, #1e1e2e);
    color: var(--text, #e0e0e0);
    border-color: var(--border, #444);
}

body.dashboard-theme-dark .bbt-tutorial-btn:hover {
    border-color: var(--primary, #0e7490);
    background: var(--primary, #0e7490);
    color: #fff;
}

body.dashboard-theme-dark .bbt-tutorial-extra {
    background: rgba(8, 145, 178, 0.12);
}

/* Dark-Mode Driver.js Popover */
body.dashboard-theme-dark .bbt-tutorial-popover .driver-popover {
    background: var(--card-bg, #1e1e2e);
    border-color: var(--border, #333);
    color: var(--text-primary, #e0e0e0);
}

body.dashboard-theme-dark .bbt-tutorial-popover .driver-popover-title {
    color: var(--text-primary, #e0e0e0);
}

body.dashboard-theme-dark .bbt-tutorial-popover .driver-popover-description {
    color: var(--text-secondary, #aaa);
}

body.dashboard-theme-dark .bbt-tutorial-popover .driver-popover-prev-btn {
    background: var(--bg-secondary, #2a2a3a);
    border-color: var(--border, #444);
    color: var(--text-secondary, #aaa);
}

body.dashboard-theme-dark .bbt-tutorial-popover .driver-popover-prev-btn:hover {
    background: var(--card-bg, #1e1e2e);
    border-color: var(--primary, #0e7490);
    color: var(--primary-light, #22d3ee);
}

body.dashboard-theme-dark .bbt-tutorial-popover .driver-popover-close-btn {
    color: var(--text-secondary, #777);
}

body.dashboard-theme-dark .bbt-tutorial-popover .driver-popover-close-btn:hover {
    background: var(--bg-secondary, #2a2a3a);
    color: var(--text-primary, #e0e0e0);
}

body.dashboard-theme-dark .bbt-tutorial-popover .driver-popover-arrow-side-left.driver-popover-arrow,
body.dashboard-theme-dark .bbt-tutorial-popover .driver-popover-arrow-side-right.driver-popover-arrow,
body.dashboard-theme-dark .bbt-tutorial-popover .driver-popover-arrow-side-top.driver-popover-arrow,
body.dashboard-theme-dark .bbt-tutorial-popover .driver-popover-arrow-side-bottom.driver-popover-arrow {
    border-color: var(--card-bg, #1e1e2e) !important;
}

/* ── Scroll-Fix: SlideOut-Panel bei aktivem Driver.js scrollbar ───
   Driver.js setzt `.driver-active * { pointer-events: none }` und
   `:not(body):has(>.driver-active-element) { overflow: hidden !important }`.
   Beides verhindert Scrollen im SlideOut-Panel.
   Wir heben das hier mit hoher Spezifität auf.
   ─────────────────────────────────────────────────────────────────── */

html.driver-active body .slide-out-panel,
html.driver-active body .slide-out-panel *,
html.driver-active body .slide-out-overlay {
    pointer-events: auto !important;
}

html.driver-active body .slide-out-panel {
    z-index: 1000000001 !important;
    overflow: hidden !important;
}

html.driver-active body .slide-out-panel .slide-out-content {
    overflow: hidden !important;
}

html.driver-active body .slide-out-panel .slide-out-main {
    overflow: hidden !important;
}

html.driver-active body .slide-out-panel .slide-out-main-inner,
html.driver-active body .slide-out-panel .slide-out-detail-inner {
    overflow-y: auto !important;
}

html.driver-active .slide-out-main-inner:has(.driver-active-element),
html.driver-active .slide-out-detail-inner:has(.driver-active-element) {
    overflow-y: auto !important;
}

html.driver-active .slide-out-main:has(.driver-active-element),
html.driver-active .slide-out-detail:has(.driver-active-element),
html.driver-active .slide-out-content:has(.driver-active-element) {
    overflow: hidden !important;
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 540px) {
    .bbt-tutorial-modal {
        padding: 28px 20px 24px;
    }

    .bbt-tutorial-modal-title {
        font-size: 1.25rem;
    }

    .bbt-tutorial-modal-text {
        font-size: 0.9rem;
    }

    .bbt-tutorial-btn {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
}
