/**
 * Guide Video popup
 * Load after popup.css (common)
 */

/* Above sticky public headers (e.g. .bk-pub-header 1030); must stay below Bootstrap’s backdrop
   paint order is handled by BS (backdrop 1050, .modal 1055). If #video_modal is nested in a
   low z-index ancestor, fix that ancestor — z-index here cannot escape that context. */
#video_modal.modal {
    z-index: 1060;
}

/* Legacy main.css (#video_modal .modal-dialog display:inline-block; height:90%; width:900px) breaks
   Bootstrap 5 flex centering on landing — home has no custom.css .video-container aspect ratio. */
#video_modal .modal-dialog {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: auto !important;
    height: auto !important;
    margin: 1.75rem auto;
}


#video_modal .modal-content {
    width: 100% !important;
    max-width: 100% !important;
}

#video_modal.modal::before,
#video_modal.modal:before {
    display: none !important;
    content: none !important;
    height: 0 !important;
}

.guide-video-popup {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.1);
    background: #fff;
}

.guide-video-popup .guide-video-popup-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e9ecef;
    background: #fff !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: nowrap;
}

.guide-video-popup .guide-video-popup-header-inner {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-width: 0;
}

.guide-video-popup .guide-video-popup-header-inner > div {
    min-width: 0;
}

.guide-video-popup .guide-video-popup-header-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--popup-icon-gradient, linear-gradient(135deg, #1a47e8 0%, #012cae 100%));
    color: #fff;
    border-radius: 10px;
    font-size: 1.35rem;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.35);
}

.guide-video-popup .guide-video-popup-title,
.guide-video-popup h5.guide-video-popup-title,
.guide-video-popup .modal-title.guide-video-popup-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    color: #212529 !important;
    letter-spacing: -0.01em;
    line-height: 1.3;
    visibility: visible !important;
    opacity: 1 !important;
}

.guide-video-popup .guide-video-popup-subtitle {
    font-size: 0.8125rem;
    color: #6c757d !important;
    margin-top: 0.2rem;
    line-height: 1.4;
}

.guide-video-popup .guide-video-popup-close {
    flex-shrink: 0;
    padding: 0.5rem;
    margin: -0.5rem -0.5rem -0.5rem auto;
    opacity: 0.6;
    border-radius: 0.375rem;
}

.guide-video-popup .guide-video-popup-close:hover {
    opacity: 1;
    background-color: #f8f9fa;
}

.guide-video-popup .guide-video-popup-body {
    padding: 1.5rem;
    background: #eef1f5;
}

/* ── 16:9 video frame (same idea as custom.css .video-container; landing has no custom.css) ─── */
.guide-video-popup .guide-video-frame-wrap .video-container,
.guide-video-popup .video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.guide-video-popup .video-container iframe.rumble {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

[data-theme="dark"] .guide-video-popup .video-container iframe.rumble {
    background: #111;
}

/* ── Video loading overlay ──────────────────────────────────────────────── */
.guide-video-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.875rem;
}

.guide-video-loading.d-none {
    display: none !important;
}

.guide-video-loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #fff;
    border-radius: 50%;
    animation: guide-video-spin 0.75s linear infinite;
}

@keyframes guide-video-spin {
    to { transform: rotate(360deg); }
}

.guide-video-loading-text {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.65);
    letter-spacing: 0.02em;
}

/* ── No-video empty state ───────────────────────────────────────────────── */
.guide-video-popup .guide-video-no-src .guide-video-no-src-icon {
    width: 60px;
    height: 60px;
    background: #fff0f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 1.6rem;
    color: #dc3545;
}

.guide-video-popup .guide-video-no-src .guide-video-no-src-title {
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
}

.guide-video-popup .guide-video-no-src .guide-video-no-src-text {
    font-size: 0.8125rem;
    color: #6c757d;
}

[data-theme="dark"] .guide-video-popup .guide-video-no-src .guide-video-no-src-icon {
    background: #3a1a1a;
    color: #ff6b6b;
}

[data-theme="dark"] .guide-video-popup .guide-video-no-src .guide-video-no-src-title {
    color: #e0e0e0;
}

[data-theme="dark"] .guide-video-popup .guide-video-no-src .guide-video-no-src-text {
    color: #a7a7a7;
}

.guide-video-popup .guide-video-popup-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e9ecef;
}

.guide-video-popup .guide-video-popup-btn-back {
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--popup-back-btn-color, #012cae);
    background: var(--popup-back-btn-bg, #e8ecfc);
    border: 1px solid var(--popup-back-btn-border, #b8c6f0);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.guide-video-popup .guide-video-popup-btn-back:hover {
    background: var(--popup-back-btn-hover-bg, #d4dcf7);
    color: var(--popup-back-btn-hover-color, #011e8a);
}

/* ========== Dark theme ========== */
[data-theme="dark"] .guide-video-popup {
    background: #202020;
    box-shadow: var(--popup-shadow, 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.08));
}

[data-theme="dark"] .guide-video-popup .guide-video-popup-header {
    background: #202020 !important;
    border-bottom-color: var(--popup-header-border, #2a2a2a);
}

[data-theme="dark"] .guide-video-popup .guide-video-popup-title,
[data-theme="dark"] .guide-video-popup h5.guide-video-popup-title,
[data-theme="dark"] .guide-video-popup .modal-title.guide-video-popup-title {
    color: #f1f1f1 !important;
}

[data-theme="dark"] .guide-video-popup .guide-video-popup-subtitle {
    color: #a7a7a7 !important;
}

[data-theme="dark"] .guide-video-popup .guide-video-popup-close:hover {
    background-color: #2c3138;
}

[data-theme="dark"] .guide-video-popup .guide-video-popup-body {
    background: var(--popup-body-bg, #1a1b1e);
}

[data-theme="dark"] .guide-video-popup .guide-video-popup-footer {
    background: #202020;
    border-top-color: var(--popup-header-border, #2a2a2a);
}
