/* VideoKit — in-app video player, share sheet and "Add a video" dialog (js/tools/VideoKit.js).
   Loaded after the theme files; every rule is scoped to .vk-overlay so themes cannot reach in. */

.vk-overlay {
    position: fixed; inset: 0; z-index: 2147483645;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    opacity: 0; transition: opacity .2s ease;
    font-family: 'Outfit', 'Cairo', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}
.vk-overlay[dir="rtl"] { font-family: 'Cairo', 'Outfit', system-ui, sans-serif; }
.vk-overlay.show { opacity: 1; }
.vk-overlay * { box-sizing: border-box; }
.vk-overlay h3, .vk-overlay b, .vk-overlay p { margin: 0; }
.vk-overlay svg { display: block; }

/* ---------- player ---------- */
.vk-player {
    --vk-w: min(calc(var(--app-vw, 100vw) - 32px), calc((var(--app-vh, 100vh) - 120px) * 16 / 9), 1280px);
    width: var(--vk-w);
    border-radius: 18px; overflow: hidden;
    background: #0b1020;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .08);
    transform: translateY(14px) scale(.98); transition: transform .25s cubic-bezier(.2, .9, .3, 1.2);
}
.vk-overlay.show .vk-player { transform: none; }
.vk-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 12px 10px 16px;
    background: linear-gradient(180deg, #151b33, #0f1428);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.vk-overlay[dir="rtl"] .vk-bar { padding: 10px 16px 10px 12px; }
.vk-bar-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.vk-logo { width: 34px; height: 24px; flex: none; }
.vk-logo svg { width: 100%; height: 100%; }
.vk-logo-lg { width: 46px; height: 33px; }
.vk-globe { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; background: #6366f1; color: #fff; font-size: 15px; }
.vk-titles { display: flex; flex-direction: column; min-width: 0; }
.vk-titles b { color: #fff !important; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vk-titles small { color: #94a3b8; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vk-bar-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.vk-btn {
    display: inline-flex; align-items: center; gap: 7px;
    height: 36px; padding: 0 13px; border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .06);
    color: #e2e8f0 !important; font: 600 13px/1 inherit; text-decoration: none !important; cursor: pointer;
    transition: background .15s, border-color .15s, transform .1s;
}
.vk-btn svg { width: 16px; height: 16px; }
.vk-btn:hover { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .22); }
.vk-btn:active { transform: scale(.96); }
.vk-btn.vk-icon { width: 36px; padding: 0; justify-content: center; }
.vk-btn.vk-icon svg { width: 18px; height: 18px; }
.vk-frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.vk-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; z-index: 1; }
.vk-spinner {
    position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px;
    border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); border-top-color: #ff0033;
    animation: vk-spin .8s linear infinite;
}
@keyframes vk-spin { to { transform: rotate(360deg); } }

/* web pages: taller, white */
.vk-player.vk-web { --vk-w: min(calc(var(--app-vw, 100vw) - 32px), 1280px); }
.vk-frame-web { aspect-ratio: auto; height: min(calc(var(--app-vh, 100vh) - 110px), 860px); background: #fff; }
.vk-frame-web .vk-spinner { border-color: rgba(15, 23, 42, .1); border-top-color: #6366f1; }
.vk-blocked {
    position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 2;
    max-width: min(560px, 90%); padding: 10px 16px; border-radius: 12px;
    background: #0f172a; color: #e2e8f0; font-size: 13px; text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}

/* ---------- share sheet + insert dialog (light cards) ---------- */
.vk-share, .vk-insert {
    position: relative;
    width: min(460px, calc(var(--app-vw, 100vw) - 32px));
    max-height: calc(var(--app-vh, 100vh) - 32px); overflow: auto;
    padding: 22px;
    border-radius: 22px;
    background: #ffffff; color: #0f172a;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .4);
    transform: translateY(14px) scale(.98); transition: transform .25s cubic-bezier(.2, .9, .3, 1.2);
}
.vk-overlay.show .vk-share, .vk-overlay.show .vk-insert { transform: none; }
.vk-share-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding-inline-end: 34px; }
.vk-share-head h3 { font-size: 20px; font-weight: 800; color: #0f172a !important; -webkit-text-fill-color: #0f172a !important; }
.vk-share-head p { font-size: 13.5px; color: #64748b; margin-top: 2px; line-height: 1.35; }
.vk-share-x { position: absolute; top: 14px; inset-inline-end: 14px; color: #475569 !important; background: #f1f5f9; border-color: #e2e8f0; }
.vk-share-x:hover { background: #e2e8f0; border-color: #cbd5e1; }
.vk-share-body { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; }
.vk-qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.vk-qr { width: 164px; height: 164px; padding: 8px; border-radius: 16px; background: #fff; border: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: center; font-size: 40px; color: #94a3b8; }
.vk-qr img, .vk-qr canvas { width: 148px !important; height: 148px !important; }
.vk-qr-wrap small { font-size: 12px; color: #64748b; }
.vk-share-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 6px; }
.vk-target {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 6px 2px; border: 0; border-radius: 12px; background: transparent;
    color: #334155 !important; font: 600 12px/1.2 inherit; text-decoration: none !important; cursor: pointer;
    transition: background .15s, transform .1s;
}
.vk-target:hover { background: #f1f5f9; }
.vk-target:active { transform: scale(.95); }
.vk-target span { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 19px; box-shadow: 0 4px 12px rgba(15, 23, 42, .15); }
.vk-copy { display: flex; gap: 8px; margin-top: 18px; padding: 6px; border-radius: 14px; background: #f1f5f9; border: 1px solid #e2e8f0; }
.vk-copy input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0 8px; font: 500 13px/1 'Inter', monospace; color: #334155; outline: none; }
.vk-copy-btn { flex: none; height: 38px; padding: 0 16px; border: 0; border-radius: 10px; background: #0f172a; color: #fff; font: 700 13px/1 inherit; cursor: pointer; transition: background .15s; }
.vk-copy-btn:hover { background: #1e293b; }
.vk-copy-btn.done { background: #16a34a; }
.vk-subscribe {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: 12px; height: 46px; border-radius: 14px;
    background: #ff0033; color: #fff !important; font: 700 15px/1 inherit; text-decoration: none !important;
    box-shadow: 0 8px 20px rgba(255, 0, 51, .28); transition: transform .1s, box-shadow .15s;
}
.vk-subscribe svg { width: 18px; height: 18px; }
.vk-subscribe:hover { box-shadow: 0 10px 26px rgba(255, 0, 51, .38); }
.vk-subscribe:active { transform: scale(.98); }

/* insert dialog */
.vk-insert .vk-share-head { margin-bottom: 16px; }
.vk-field { display: block; margin-bottom: 12px; }
.vk-field span { display: block; font-size: 13px; font-weight: 700; color: #334155; margin-bottom: 6px; }
.vk-field input {
    width: 100%; height: 44px; padding: 0 14px; border-radius: 12px;
    border: 1.5px solid #e2e8f0; background: #f8fafc; color: #0f172a; font: 500 14px/1 inherit; outline: none;
    transition: border-color .15s, background .15s;
}
.vk-field input:focus { border-color: #ff0033; background: #fff; }
.vk-preview {
    position: relative; aspect-ratio: 16 / 9; margin-bottom: 14px; border-radius: 14px; overflow: hidden;
    background: #f1f5f9; border: 1.5px dashed #cbd5e1; display: flex; align-items: center; justify-content: center;
}
.vk-preview.ok { border: 0; background: #0f172a; }
.vk-preview.bad { border-color: #fca5a5; background: #fef2f2; }
.vk-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vk-preview-play { position: relative; width: 64px; height: 46px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .4)); }
.vk-preview-play svg { width: 100%; height: 100%; }
.vk-preview-msg { padding: 0 18px; font-size: 13px; color: #64748b; text-align: center; line-height: 1.45; }
.vk-preview.bad .vk-preview-msg { color: #b91c1c; }
.vk-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.vk-ghost, .vk-primary { height: 44px; padding: 0 20px; border-radius: 12px; font: 700 14px/1 inherit; cursor: pointer; transition: background .15s, opacity .15s; }
.vk-ghost { border: 1.5px solid #e2e8f0; background: #fff; color: #334155; }
.vk-ghost:hover { background: #f8fafc; }
.vk-primary { border: 0; background: #ff0033; color: #fff; box-shadow: 0 8px 20px rgba(255, 0, 51, .25); }
.vk-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

@media (max-width: 560px) {
    .vk-btn span { display: none; }
    .vk-btn { width: 36px; padding: 0; justify-content: center; }
    .vk-share-body { grid-template-columns: 1fr; justify-items: center; }
    .vk-share-grid { width: 100%; }
    .vk-titles small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .vk-overlay, .vk-player, .vk-share, .vk-insert { transition: none; }
}
.vk-overlay.vk-top { z-index: 2147483646; background: rgba(2, 6, 23, 0.45); }
/* themes set their own heading fonts (e.g. a serif): keep ours */
.vk-overlay h1, .vk-overlay h2, .vk-overlay h3, .vk-overlay h4, .vk-overlay b, .vk-overlay button, .vk-overlay a, .vk-overlay input { font-family: inherit !important; letter-spacing: normal; }
html body .vk-overlay.vk-overlay :is(h1, h2, h3, h4, b, button, a, input) { font-family: inherit !important; letter-spacing: normal !important; }
html body .vk-overlay.vk-overlay .vk-titles b { color: #fff !important; -webkit-text-fill-color: #fff !important; }
html body .vk-overlay.vk-overlay .vk-share-head h3 { color: #0F172A !important; -webkit-text-fill-color: #0F172A !important; }
