@layer vsg-universal {
/* ─────────────────────────────────────────────────────────────────────────
   Media Vault — modal de subida y biblioteca de medios (independiente del
   explorador anterior mgMediaBrowserModal). Prefijo de clases: mv-
   ───────────────────────────────────────────────────────────────────────── */

.mv-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 16, 0.72);
    
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.mv-overlay.mv-visible { display: flex; }

.mv-shell {
    box-sizing: border-box;
    width: min(1440px, calc(100vw - 32px));
    height: min(860px, calc(100vh - 32px));
    max-height: none;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at 90% 0%, rgba(56, 189, 248, .12), transparent 32%), linear-gradient(170deg, #0c1526, #060b16);
    border: 1px solid rgba(125, 211, 252, .25);
    border-radius: 22px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .03) inset;
    overflow: hidden;
}

.mv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mv-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mv-brand > img { width: 42px; height: 42px; object-fit: contain; filter: drop-shadow(0 0 12px rgba(56, 189, 248, .4)); }
.mv-brand span { display: block; color: #7dd3fc; font-size: .62rem; font-weight: 800; letter-spacing: .12em; }
.mv-header h3 { margin: 0; color: #f8fafc; font-size: 1.15rem; }
.mv-header p { margin: 2px 0 0; color: #8ea2c4; font-size: 0.8rem; }
.mv-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}
.mv-close:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

.mv-tabs {
    display: flex;
    gap: 6px;
    padding: 12px 22px 0;
    flex-wrap: wrap;
}

.mv-tab {
    border: 1px solid rgba(148, 194, 255, 0.22);
    background: rgba(148, 194, 255, 0.05);
    color: #cfe1ff;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.mv-tab.mv-active {
    background: linear-gradient(120deg, #38bdf8, #8bc5ff);
    color: #05101e;
    border-color: transparent;
}

.mv-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mv-toolbar input[type="text"] {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    min-width: 180px;
}

.mv-search-box {
    display: flex;
    align-items: center;
    flex: 1 1 360px;
    min-width: min(270px, 100%);
    margin-left: auto;
    padding: 0 6px 0 12px;
    border: 1px solid rgba(125, 211, 252, .21);
    border-radius: 11px;
    background: rgba(2, 9, 23, .72);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.mv-search-box:focus-within { border-color: rgba(56,189,248,.72); box-shadow: 0 0 0 3px rgba(56,189,248,.11); }
.mv-search-box > span { color: #6dd8ff; font-size: 1.25rem; line-height: 1; }
.mv-search-box .mv-search { min-width: 0; flex: 1; padding: 10px 8px; border: 0; outline: 0; color: #edf7ff; background: transparent; font-size: .83rem; }
.mv-search-box .mv-search::placeholder { color: #71829c; }
.mv-search-box button { width: 28px; height: 28px; border: 0; border-radius: 8px; color: #8ea2c4; background: transparent; font-size: 1.25rem; line-height: 1; cursor: pointer; }
.mv-search-box button:hover { color: #f8fafc; background: rgba(148, 194, 255, .12); }

.mv-filter-group { display: flex; align-items: center; gap: 5px; padding: 4px; border: 1px solid rgba(148,194,255,.13); border-radius: 10px; background: rgba(2,9,23,.48); }
.mv-filter { border: 0; border-radius: 7px; padding: 6px 9px; color: #91a5c2; background: transparent; font-size: .7rem; font-weight: 800; cursor: pointer; transition: color .16s ease, background .16s ease; }
.mv-filter:hover { color: #e7f6ff; background: rgba(125,211,252,.09); }
.mv-filter.mv-filter-active { color: #031220; background: linear-gradient(120deg, #79dbff, #b7e9ff); }
.mv-sort-label { display: flex; align-items: center; gap: 7px; color: #8194b0; font-size: .68rem; font-weight: 800; white-space: nowrap; }
.mv-sort-label select { max-width: 138px; border: 1px solid rgba(148,194,255,.18); border-radius: 8px; padding: 7px 24px 7px 8px; color: #dcecff; background: #091426; font: inherit; cursor: pointer; }

.mv-btn {
    border: none;
    border-radius: 8px;
    padding: 9px 16px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
}
.mv-btn-primary { background: linear-gradient(120deg, #38bdf8, #8bd2ff); color: #05101e; }
.mv-btn-outline { background: transparent; border: 1px solid rgba(182, 210, 255, 0.4); color: #d8e9ff; }
.mv-btn-outline:hover { background: rgba(150, 190, 255, 0.1); }
.mv-btn-danger { background: transparent; border: 1px solid rgba(248, 113, 113, 0.5); color: #fca5a5; }
.mv-btn-danger:hover { background: rgba(239, 68, 68, .14); border-color: #fb7185; color: #fff1f2; }
.mv-btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.mv-confirm-layer { position: absolute; z-index: 8; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(2, 6, 23, .72);  padding: 28px; border: 1px solid rgba(248, 113, 113, .28); border-radius: 18px; text-align: center; background: radial-gradient(circle at 50% 0%, rgba(239,68,68,.13), transparent 42%), linear-gradient(160deg, #121b2e, #080d19); box-shadow: 0 24px 55px rgba(0,0,0,.55); }
.mv-confirm-icon { width: 40px; height: 40px; display: grid; place-items: center; margin: 0 auto 12px; border: 1px solid rgba(251,113,133,.45); border-radius: 50%; color: #fda4af; font-size: 1.1rem; font-weight: 900; background: rgba(239,68,68,.12); }
.mv-confirm-card h4 { margin: 0; color: #fff1f2; }.mv-confirm-card p { margin: 10px 0 22px; color: #b8c5d9; font-size: .84rem; line-height: 1.55; }.mv-confirm-card p strong { display: inline-block; max-width: 100%; overflow: hidden; color: #f8fafc; text-overflow: ellipsis; vertical-align: bottom; white-space: nowrap; }.mv-confirm-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.mv-progress {
    flex: 1;
    min-width: 120px;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
    display: none;
}
.mv-progress.mv-active { display: block; }
.mv-progress-bar { height: 100%; width: 0%; background: linear-gradient(120deg, #38bdf8, #22c55e); transition: width 0.15s ease; }

.mv-status { font-size: 0.78rem; color: #94a3b8; margin-left: auto; }

.mv-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, .45fr);
    gap: 0;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.mv-body.mv-editing { grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); }

.mv-grid-wrap {
    min-height: 0;
    overflow-y: auto;
    padding: 18px 22px;
}

.mv-inspector { min-height: 0; border-left: 1px solid rgba(255, 255, 255, .07); background: rgba(2, 6, 23, .34); overflow-y: auto; }
.mv-preview { min-height: 100%; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.mv-preview-empty { min-height: 240px; display: grid; place-content: center; text-align: center; gap: 8px; color: #8ea2c4; font-size: .79rem; line-height: 1.55; }
.mv-preview-empty img { width: 58px; height: 58px; object-fit: contain; margin: 0 auto 4px; filter: drop-shadow(0 0 14px rgba(56,189,248,.45)); }
.mv-preview-empty strong { color: #e0f2fe; font-size: .95rem; }
.mv-preview-empty span { max-width: 28ch; }
.mv-preview-media { aspect-ratio: 16 / 10; overflow: hidden; border-radius: 14px; background: #020617; border: 1px solid rgba(125, 211, 252, .16); }
.mv-preview-media img, .mv-preview-media video { display: block; width: 100%; height: 100%; object-fit: contain; }
.mv-preview-meta { display: grid; gap: 4px; min-width: 0; }
.mv-preview-meta span { color: #7dd3fc; font-size: .64rem; font-weight: 850; letter-spacing: .1em; }
.mv-preview-meta strong { color: #f8fafc; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-preview-meta small { color: #94a3b8; }
.mv-preview-actions { display: grid; gap: 8px; margin-top: auto; }
.mv-preview-use { width: 100%; }

.mv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 18px;
}

.mv-empty { display: grid; justify-items: center; gap: 7px; padding: 42px 18px; color: #71839e; font-size: .82rem; text-align: center; line-height: 1.55; }
.mv-empty strong { color: #dcecff; font-size: .94rem; }.mv-empty span { max-width: 42ch; }

.mv-card {
    background: linear-gradient(160deg, rgba(15, 30, 53, .9), rgba(5, 12, 25, .94));
    border: 1px solid rgba(148, 194, 255, .14);
    border-radius: 13px;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.mv-card:hover { transform: translateY(-2px); box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35); }
.mv-card.mv-selected { box-shadow: 0 0 0 2px #38bdf8; }

.mv-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: transparent;
    display: block;
    overflow: hidden;
    border-radius: 10px;
}
.mv-thumb img, .mv-thumb video { display: block; width: 100%; height: 100%; object-fit: cover; }
.mv-thumb .mv-type-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 6px;
    border: 1px solid rgba(225,245,255,.26);
    border-radius: 999px;
    color: #e8f7ff;
    background: rgba(2,9,23,.72);
    
    font-weight: 900;
    letter-spacing: .07em;
}

.mv-card-meta {
    padding: 8px 10px;
    font-size: 0.72rem;
    color: #9fb3d1;
}
.mv-card-name { display: block; color: #e2e8f0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-card-owner { color: #7dd3fc; }

.mv-card-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
    gap: 7px;
    padding: 0 10px 11px;
}
.mv-card-actions button {
    min-width: 0;
    font-size: 0.68rem;
    padding: 7px 6px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #d8e9ff;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mv-card-actions button:hover { background: rgba(255, 255, 255, 0.1); }
.mv-card-actions .mv-act-insert { border-color: rgba(34, 197, 94, 0.5); color: #bbf7d0; }
.mv-card-actions .mv-act-delete { border-color: rgba(248, 113, 113, 0.5); color: #fca5a5; }

.mv-editor {
    padding: 18px 22px;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    gap: 14px;
}
.mv-editing .mv-editor { display: flex; }
.mv-body.mv-editing .mv-preview { display: none; }

.mv-editor h4 { margin: 0; color: #f1f5f9; font-size: 1rem; }
.mv-editor label { font-size: 0.75rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; display: block; margin-bottom: 4px; }

.mv-crop-wrap {
    position: relative;
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: #05070d;
    user-select: none;
}
.mv-crop-wrap img { width: 100%; display: block; }
.mv-crop-rect {
    position: absolute;
    border: 2px dashed #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    pointer-events: none;
}

.mv-editor-row { display: flex; align-items: center; gap: 10px; }
.mv-editor-row input[type="number"] {
    width: 90px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    padding: 6px 10px;
    border-radius: 8px;
}
.mv-editor-hint { font-size: 0.72rem; color: #64748b; line-height: 1.5; }
.mv-editor-actions { display: flex; gap: 10px; margin-top: auto; }

@media (max-width: 760px) {
    .mv-search-box { order: 5; flex-basis: 100%; margin-left: 0; }
    .mv-body.mv-editing { grid-template-columns: 1fr; }
    .mv-body { grid-template-columns: 1fr; }
    .mv-inspector { border-left: none; border-top: 1px solid rgba(255, 255, 255, .07); max-height: 46vh; }
}

@media (max-width: 520px) {
    .mv-overlay { padding: 10px; }
    .mv-shell { width: calc(100vw - 20px); height: calc(100vh - 20px); border-radius: 16px; }
    .mv-header, .mv-tabs, .mv-toolbar { padding-left: 14px; padding-right: 14px; }
    .mv-grid-wrap, .mv-preview { padding: 14px; }
    .mv-brand > img { width: 34px; height: 34px; }
    .mv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .mv-status { width: 100%; margin-left: 0; }
    .mv-filter-group { order: 4; }.mv-sort-label { order: 4; }
}
}
