/* ===== Video Detail Modal (Redesigned) ===== */

:root {
    --vd-primary: #7c3aed;
    --vd-primary-light: #ede9fe;
    --vd-bg: #f8f9fb;
    --vd-card: #ffffff;
    --vd-border: #e5e7eb;
    --vd-text: #1e293b;
    --vd-text-secondary: #64748b;
    --vd-text-muted: #94a3b8;
    --vd-danger: #ef4444;
    --vd-success: #22c55e;
    --vd-warning: #f59e0b;
}

/* ===== Overlay ===== */
.video-detail-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10000;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(8px);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    overflow: hidden; padding: 20px;
    animation: vdOverlayIn .2s ease;
}
@keyframes vdOverlayIn { from { opacity: 0 } to { opacity: 1 } }

/* ===== Close & Nav Buttons ===== */
.vd-close-btn {
    position: fixed; top: 16px; right: 24px;
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,.12); border: none;
    color: #fff; font-size: 22px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 10002; backdrop-filter: blur(4px);
    transition: all .2s;
}
.vd-close-btn:hover { background: rgba(255,255,255,.25); transform: scale(1.05); }

.vd-nav-arrow {
    position: fixed; top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(255,255,255,.1); border: none;
    color: #fff; font-size: 22px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 10002; backdrop-filter: blur(4px); transition: all .2s;
}
.vd-nav-arrow:hover { background: rgba(255,255,255,.25); }
.vd-nav-prev { left: 16px; }
.vd-nav-next { right: 16px; }

/* ===== Scroll Wrapper ===== */
.vd-detail-scroll {
    display: flex; flex-direction: column; gap: 0;
    max-width: 1280px; width: 100%;
    max-height: 94vh;
    overflow-y: auto; overflow-x: hidden;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 4px 16px rgba(0,0,0,0.06);
    animation: vdCardIn .35s cubic-bezier(.16,1,.3,1);
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,.15) transparent;
}
.vd-detail-scroll::-webkit-scrollbar { width: 6px; }
.vd-detail-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 3px; }
.vd-detail-scroll::-webkit-scrollbar-track { background: transparent; }
@keyframes vdCardIn {
    from { opacity: 0; transform: translateY(20px) scale(.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== Main Card: Phone + Right Panel ===== */
.vd-main-card {
    display: flex; flex-direction: row; gap: 0;
    background: var(--vd-bg);
    border-radius: 16px 16px 0 0;
    max-width: 1280px; width: 100%;
    height: 58vh; min-height: 420px;
}

/* ===== Phone Section (Left) ===== */
.vd-phone-section {
    flex-shrink: 0; width: 280px;
    display: flex; flex-direction: column; align-items: center;
    padding: 24px 20px 16px;
    background: #fafbfc;
    border-right: 1px solid var(--vd-border);
}

/* Platform icons */
.vd-platform-icons {
    display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; justify-content: center;
}
.vd-platform-icon {
    width: 32px; height: 32px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 500; cursor: pointer;
    background: #f0f0f0; color: #999;
    transition: all .2s; text-align: center; line-height: 1.1;
}
.vd-platform-icon.active {
    background: #333; color: white;
}
.vd-platform-icon.inactive {
    background: #f0f0f0; color: #999;
}
.vd-platform-icon:hover { transform: scale(1.05); }

/* Phone mockup */
.vd-phone-mockup {
    width: 260px; height: 500px;
    background: #1a1a1a; border-radius: 32px;
    padding: 10px; position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.vd-phone-screen {
    width: 100%; height: 100%;
    border-radius: 24px; overflow: hidden;
    background: #000; position: relative;
}
.vd-phone-video {
    width: 100%; height: 100%; position: relative; overflow: hidden;
}
.vd-phone-player {
    width: 100%; height: 100%; object-fit: contain;
}

/* ===== Right Panel ===== */
.vd-right {
    flex: 1; display: flex; flex-direction: column;
    background: var(--vd-card);
    min-width: 0;
}

/* Panel header */
.vd-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--vd-border);
    background: #fff;
}
.vd-panel-header-left {
    display: flex; align-items: center; gap: 12px;
}
.vd-panel-id {
    font-size: 12px; color: #999; background: #f5f5f5;
    padding: 2px 8px; border-radius: 4px;
}
.vd-panel-sort {
    font-size: 12px; color: #666; background: #f5f5f5;
    padding: 2px 8px; border-radius: 4px;
}
.vd-panel-status {
    font-size: 11px; padding: 3px 10px; border-radius: 12px;
    color: #fff; font-weight: 500;
}

/* Info tabs */
.vd-info-tabs {
    display: flex; gap: 0; border-bottom: 1px solid var(--vd-border);
    background: #fff;
}
.vd-info-tab {
    padding: 12px 20px; font-size: 13px; font-weight: 500;
    cursor: pointer; color: var(--vd-text-secondary);
    border-bottom: 2px solid transparent;
    transition: all .15s;
}
.vd-info-tab.active {
    color: var(--vd-primary);
    border-bottom-color: var(--vd-primary);
    background: var(--vd-primary-light);
}
.vd-info-tab:hover:not(.active) {
    color: var(--vd-text); background: #f5f5f5;
}

/* Content area */
.vd-content-area {
    flex: 1; overflow-y: auto; padding: 20px;
}

/* Info blocks */
.vd-info-block {
    margin-bottom: 20px;
}
.vd-info-block-title {
    font-size: 14px; font-weight: 600; color: var(--vd-text);
    margin-bottom: 10px; padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}
.vd-info-block-value {
    font-size: 13px; color: var(--vd-text);
}

/* Info rows */
.vd-info-row {
    display: flex; align-items: baseline; padding: 6px 0;
    border-bottom: 1px solid #f8f8f8; font-size: 13px;
}
.vd-info-row:last-child { border-bottom: none; }
.vd-info-row-label {
    width: 80px; flex-shrink: 0; color: var(--vd-text-secondary);
}
.vd-info-row-value {
    flex: 1; color: var(--vd-text); min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Tags */
.vd-tag-row {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 0; flex-wrap: wrap; font-size: 13px;
}
.vd-tag-sub {
    color: var(--vd-text-secondary); font-size: 12px; margin-right: 4px; flex-shrink: 0;
}
.vd-tag {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: 11px; font-weight: 500;
}
.vd-tag-blue { background: #dbeafe; color: #1e40af; }
.vd-tag-purple { background: #ede9fe; color: #6d28d9; }
.vd-tag-orange { background: #fed7aa; color: #c2410c; }
.vd-tag-empty { color: #ccc; font-size: 12px; }

.vd-add-tag-row {
    display: flex; gap: 8px; margin-top: 8px; padding-top: 8px;
}
.vd-add-tag {
    padding: 4px 12px; border-radius: 6px; border: 1px dashed var(--vd-primary);
    background: none; color: var(--vd-primary); font-size: 12px;
    cursor: pointer; transition: all .15s;
}
.vd-add-tag:hover {
    background: var(--vd-primary); color: #fff;
}

/* ===== Stats Grid / Metric Cards ===== */
.vd-stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
    margin-top: 16px;
}
.vd-metric-card {
    background: #f8fafc; border: 1px solid var(--vd-border);
    border-radius: 10px; padding: 14px 12px;
    transition: all .15s;
}
.vd-metric-card:hover {
    border-color: #cbd5e1; box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.vd-metric-label {
    font-size: 11px; color: var(--vd-text-muted); font-weight: 500;
    margin-bottom: 6px;
}
.vd-metric-value {
    display: flex; align-items: baseline; gap: 4px;
}
.vd-metric-value > span {
    font-size: 16px; font-weight: 700; color: var(--vd-text);
}
.vd-metric-icon {
    font-size: 11px; padding: 1px 4px; border-radius: 3px;
}
.vd-metric-icon.blue { background: #dbeafe; color: #3b82f6; }
.vd-metric-icon.red { background: #fee2e2; color: #ef4444; }
.vd-metric-icon.green { background: #dcfce7; color: #16a34a; }
.vd-metric-icon.purple { background: #ede9fe; color: #7c3aed; }

/* ===== Data Controls ===== */
.vd-data-controls {
    display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
    flex-wrap: wrap;
}
.vd-refresh-link {
    background: none; border: none; color: var(--vd-primary);
    font-size: 12px; cursor: pointer; padding: 0;
}
.vd-refresh-link:hover { text-decoration: underline; }
.vd-date-input {
    padding: 4px 8px; border: 1px solid var(--vd-border);
    border-radius: 6px; font-size: 12px; color: var(--vd-text);
}
.vd-date-sep { font-size: 12px; color: var(--vd-text-muted); }

/* ===== Review Tab ===== */
.vd-review-status { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.vd-audit-log { display: flex; flex-direction: column; gap: 0; }
.vd-audit-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 0;
    border-bottom: 1px solid #f1f5f9; font-size: 13px;
}
.vd-audit-item:last-child { border-bottom: none; }
.vd-audit-time { color: var(--vd-text-muted); font-size: 12px; min-width: 140px; }
.vd-audit-action { color: var(--vd-text); font-weight: 500; }
.vd-audit-user { color: var(--vd-text-secondary); margin-left: auto; font-size: 12px; }

/* ===== Interact Tab ===== */
.vd-interact-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.vd-interact-card {
    background: #f8fafc; border: 1px solid var(--vd-border);
    border-radius: 10px; padding: 16px; text-align: center;
    transition: all .15s;
}
.vd-interact-card:hover { border-color: #cbd5e1; }
.vd-interact-icon { font-size: 22px; margin-bottom: 6px; }
.vd-interact-value { font-size: 20px; font-weight: 700; color: var(--vd-text); }
.vd-interact-label { font-size: 11px; color: var(--vd-text-muted); margin-top: 2px; }

/* ===== Plan Section (Bottom) ===== */
.vd-plan-section {
    background: #fff; border-radius: 0 0 16px 16px;
    border-top: 1px solid var(--vd-border);
    padding: 16px 20px;
}
.vd-plan-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px;
}
.vd-plan-title {
    font-size: 14px; font-weight: 600; color: var(--vd-text);
}
.vd-plan-tabs {
    display: flex; gap: 6px; flex-wrap: wrap;
}
.vd-plan-tab {
    padding: 4px 10px; border-radius: 6px; font-size: 11px;
    background: #f1f5f9; color: var(--vd-text-secondary);
    border: 1px solid transparent; cursor: pointer;
    transition: all .15s;
}
.vd-plan-tab.active {
    background: var(--vd-primary-light); color: var(--vd-primary);
    border-color: var(--vd-primary);
}
.vd-plan-tab:hover:not(.active) { background: #e2e8f0; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .vd-main-card { flex-direction: column; height: auto; min-height: 0; }
    .vd-phone-section { width: 100%; flex-direction: row; padding: 16px; border-right: none; border-bottom: 1px solid var(--vd-border); }
    .vd-phone-mockup { width: 180px; height: 360px; }
    .vd-right { width: 100%; }
    .vd-stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
    .vd-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .vd-info-tabs { flex-wrap: wrap; }
    .vd-info-tab { padding: 10px 14px; font-size: 12px; }
    .vd-platform-icons { gap: 4px; }
    .vd-platform-icon { width: 28px; height: 28px; font-size: 10px; }
}

/* ===== Backward compat: _showError uses these ===== */
.vd-primary-btn {
    padding: 8px 20px; border-radius: 8px; border: none;
    background: var(--vd-primary); color: #fff;
    font-size: 14px; cursor: pointer; transition: all .15s;
}
.vd-primary-btn:hover { opacity: .9; }

/* ===== Tag picker styles (from old CSS) ===== */
.vd-tag-picker-modal {
    background: #fff; border-radius: 12px; padding: 20px;
    max-width: 500px; width: 100%; max-height: 70vh;
    overflow-y: auto;
}
