/**
 * What is BigDataLogin? modal – uses How it Works supply-chain structure & CSS.
 * Only overlay, modal shell, close button, and bdl-wieb-* module positions (same layout as How it Works).
 */

/* --- OVERLAY & MODAL SHELL --- */
.bdl-what-is-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    /* Must exceed mobile sidebar + fixed headers (and other welcome modals) */
    z-index: 50000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    pointer-events: auto;
}

.bdl-what-is-modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.bdl-what-is-modal-overlay.bdl-rotate-phone--active {
    /* Counter the portrait full-screen sheet styles while we show the orientation hint */
    padding: 20px;
    align-items: center;
    justify-content: center;
}

.bdl-what-is-modal {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: min(880px, 90vw);
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    z-index: 50001;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}

.bdl-what-is-modal-overlay.is-open .bdl-what-is-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.bdl-what-is-modal-inner {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    position: relative;
}

.bdl-what-is-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: #fff !important;
    color: #475569;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    z-index: 100;
    transition: box-shadow 0.2s ease;
}

.bdl-what-is-modal-close:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}

.bdl-what-is-modal-body {
    overflow-x: auto;
    overflow-y: auto;
}

/* =========================================================
   Mobile full-screen sheet (portrait only)
   ========================================================= */
@media (max-width: 768px) and (orientation: portrait) {
    .bdl-what-is-modal-overlay {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
        background: rgba(15, 23, 42, 0.6);
    }
    .bdl-what-is-modal {
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        transform: translateY(0);
    }
    .bdl-what-is-modal-inner {
        max-height: 100dvh;
        height: 100%;
    }
    .bdl-what-is-modal-close {
        position: fixed;
        top: 12px;
        right: 12px;
        width: 42px;
        height: 42px;
        z-index: 30000;
    }
    .bdl-what-is-modal-body {
        overflow-x: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        height: 100%;
        padding-top: 52px; /* space for fixed close button */
    }

    /* Supply-chain: keep desktop side-by-side layout on mobile (horizontal scroll) */
    .bdl-what-is-modal-body #bdl-wieb-sc-container.sc-container {
        /* Render a denser “desktop-like” layout that fits better on phones */
        min-width: 600px !important;
        width: max(600px, 100%) !important;
        height: 500px !important;
        border-radius: 16px;
        margin: 0 12px 18px 12px;
        box-shadow: 0 14px 40px rgba(0,0,0,0.10);
        transform: scale(0.86);
        transform-origin: top center;
        will-change: transform;
    }
    .bdl-what-is-modal-body #bdl-wieb-sc-container .sc-header {
        padding: 0 22px;
    }
    .bdl-what-is-modal-body #bdl-wieb-sc-container .sc-header-title {
        font-size: 1.05rem;
        margin-bottom: 2px;
    }
    .bdl-what-is-modal-body #bdl-wieb-sc-container .sc-sub {
        font-size: 0.78rem;
        line-height: 1.25;
    }
    .bdl-what-is-modal-body #bdl-wieb-sc-container .layout-grid {
        flex-direction: row;
        height: 100%;
        padding: 0 16px;
        gap: 12px;
    }
    /* Narrow the columns a bit so more fits */
    .bdl-what-is-modal-body #bdl-wieb-sc-container .col-users {
        width: 210px;
        max-width: 210px;
        flex: 0 0 210px;
    }
    .bdl-what-is-modal-body #bdl-wieb-sc-container .col-modules {
        width: 220px;
        max-width: 220px;
        flex: 0 0 220px;
    }
    .bdl-what-is-modal-body #bdl-wieb-sc-container .col-core {
        width: 210px;
        max-width: 210px;
        flex: 0 0 210px;
    }
    .bdl-what-is-modal-body #bdl-wieb-sc-container .sc-col-header {
        font-size: 0.75rem;
        margin-bottom: 8px;
    }
    .bdl-what-is-modal-body #bdl-wieb-sc-container .sc-modules-inner {
        gap: 8px;
    }
    /* Make cards touch-friendly */
    .bdl-what-is-modal-body #bdl-wieb-sc-container .user-card,
    .bdl-what-is-modal-body #bdl-wieb-sc-container .module-node {
        min-height: 34px;
    }
    .bdl-what-is-modal-body #bdl-wieb-sc-container .user-card {
        padding: 8px 10px;
        border-radius: 12px;
    }
    .bdl-what-is-modal-body #bdl-wieb-sc-container .user-card strong {
        font-size: 0.82rem;
    }
    .bdl-what-is-modal-body #bdl-wieb-sc-container .user-card .rotating-text {
        font-size: 0.72rem;
    }
    .bdl-what-is-modal-body #bdl-wieb-sc-container .user-card .user-icon {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    .bdl-what-is-modal-body #bdl-wieb-sc-container .module-node {
        padding: 8px 10px;
        border-radius: 12px;
        font-size: 0.82rem;
    }
    .bdl-what-is-modal-body #bdl-wieb-output-panel {
        max-height: none;
        margin: 10px 0 12px 0;
    }
    .bdl-what-is-modal-body #bdl-wieb-output-panel .impact-desc {
        font-size: 1rem;
        line-height: 1.55;
    }
}

@media (max-width: 360px) and (orientation: portrait) {
    .bdl-what-is-modal-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
    .bdl-what-is-modal-body {
        padding-top: 50px;
    }
    .bdl-what-is-modal-body #bdl-wieb-sc-container.sc-container {
        min-width: 560px !important;
        height: 480px !important;
        transform: scale(0.82);
    }
}

/* Mobile Landscape: keep modal above header/sidebar and avoid being clipped */
@media (max-width: 768px) and (orientation: landscape) {
    .bdl-what-is-modal-overlay {
        padding: 0;
        align-items: flex-start;
        justify-content: flex-start;
        padding-top: calc(var(--fixed-module-header-height, 78px) + 18px);
        padding-left: 44px; /* collapsed sidebar rail */
        padding-right: 14px;
    }

    .bdl-what-is-modal {
        border-radius: 16px;
        max-height: calc(100vh - var(--fixed-module-header-height, 78px) - 36px);
        max-width: 95%;
    }
}

/* Landscape tablet: viewport width may exceed 768px (so <=768 rules won't apply) */
@media (orientation: landscape) and (min-width: 769px) and (max-width: 1024px) {
    .bdl-what-is-modal-overlay {
        padding: 0;
        align-items: flex-start;
        justify-content: flex-start;
        padding-top: calc(var(--fixed-module-header-height, 62px) + 18px);
        padding-left: 64px; /* default collapsed rail */
        padding-right: 14px;
    }

    .bdl-what-is-modal {
        max-height: calc(100vh - var(--fixed-module-header-height, 62px) - 30px);
        max-width: 95%;
    }
}

/* --- Place output panel above engine (no separate Value to Users column) --- */
.bdl-what-is-modal-body #bdl-wieb-sc-container .col-core {
    width: 240px;
    max-width: 240px;
    flex: 0 0 240px;
}
.bdl-what-is-modal-body #bdl-wieb-output-panel {
    max-height: 200px;
    margin: 6px auto 10px auto;
    text-align: left;
}
.bdl-what-is-modal-body #bdl-wieb-output-panel .impact-header {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin-bottom: 6px;
}
.bdl-what-is-modal-body #bdl-wieb-output-panel .impact-title {
    font-size: 1.25rem;
    margin-bottom: 10px;
}
.bdl-what-is-modal-body #bdl-wieb-output-panel .impact-desc {
    font-size: 1.2rem;
    line-height: 1.6;
}

/* --- Push Neural Engine upward (5x previous nudge) --- */
.bdl-what-is-modal-body #bdl-wieb-sc-container .sc-core-inner {
    margin-top: -90px;
}

/* --- When paused, stop line dash animation + core pulsing (pause state freezes dash in place) --- */
#bdl-wieb-ecosystem.is-paused .flow-line.active-flow,
#bdl-wieb-ecosystem.is-paused .active-flow,
.bdl-what-is-modal-body #bdl-wieb-ecosystem.is-paused .active-flow {
    animation-play-state: paused !important;
}
#bdl-wieb-ecosystem.is-paused .neural-engine.pulse,
.bdl-what-is-modal-body #bdl-wieb-ecosystem.is-paused .neural-engine.pulse {
    animation-play-state: paused !important;
}

/* --- Play/Pause button style (match requested Resume/Pause pill) --- */
.bdl-what-is-modal-body #bdl-wieb-sc-container .controls-wrapper .hover-hint {
    display: none;
}
.bdl-what-is-modal-body #bdl-wieb-play-btn.play-btn {
    width: auto;
    height: auto;
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 999px;
    background: #fff;
    color: #1a73e8;
    border: 1px solid #dbeafe;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 6px 18px rgba(26, 115, 232, 0.18);
    gap: 10px;
}
.bdl-what-is-modal-body #bdl-wieb-play-btn.play-btn:hover {
    transform: translateY(-1px);
    background: #f0f7ff;
}

/* --- Module node positions (same as How it Works; IDs are bdl-wieb-* so supply-chain CSS doesn't target them) --- */
.bdl-what-is-modal-body .how-it-works-supply-chain .sc-modules-inner #bdl-wieb-mod-jobs   { top: 0%; }
.bdl-what-is-modal-body .how-it-works-supply-chain .sc-modules-inner #bdl-wieb-mod-train { top: 12%; }
.bdl-what-is-modal-body .how-it-works-supply-chain .sc-modules-inner #bdl-wieb-mod-tele { top: 24%; }
.bdl-what-is-modal-body .how-it-works-supply-chain .sc-modules-inner #bdl-wieb-mod-data { top: 36%; }
.bdl-what-is-modal-body .how-it-works-supply-chain .sc-modules-inner #bdl-wieb-mod-gigs { top: 48%; }
.bdl-what-is-modal-body .how-it-works-supply-chain .sc-modules-inner #bdl-wieb-mod-vendor { top: 60%; }
.bdl-what-is-modal-body .how-it-works-supply-chain .sc-modules-inner #bdl-wieb-mod-code { top: 72%; }
.bdl-what-is-modal-body .how-it-works-supply-chain .sc-modules-inner #bdl-wieb-mod-search { top: 84%; }
