/**
 * 文件：assets/css/modal.css
 * 作用：misc-api 统一弹窗（与后台/安装主题一致）
 * @version 1.0.0
 */

.vs-modal-root {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.vs-modal-root[hidden] {
    display: none !important;
}

.vs-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 17, 17, 0.45);
    backdrop-filter: blur(2px);
}

.vs-modal {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    animation: vsModalIn 0.22s ease;
}

@keyframes vsModalIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.vs-modal__head {
    padding: 20px 24px 0;
}

.vs-modal__title {
    font-size: 18px;
    font-weight: 600;
    color: #111;
    line-height: 1.4;
}

.vs-modal__body {
    padding: 12px 24px 20px;
    font-size: 14px;
    line-height: 1.7;
    color: #6b7280;
}

.vs-modal__foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 24px 20px;
}

.vs-modal__foot .vs-btn {
    min-width: 88px;
}

body.vs-modal-open {
    overflow: hidden;
}

.vs-update-modal__ver {
    margin: 0 0 8px;
    font-size: 14px;
    color: #374151;
}

.vs-update-modal__date,
.vs-update-modal__title-text {
    margin: 0 0 10px;
    font-size: 13px;
    color: #6b7280;
}

.vs-update-modal__title-text {
    font-weight: 600;
    color: #111;
}

.vs-update-modal__list {
    margin: 0 0 12px;
    padding-left: 20px;
    font-size: 14px;
    line-height: 1.7;
    color: #4b5563;
}

.vs-update-modal__list li {
    margin-bottom: 4px;
}

.vs-update-modal__tip,
.vs-update-modal__loading {
    margin: 0;
    font-size: 13px;
    color: #9ca3af;
    line-height: 1.6;
}

.vs-update-modal__tip--warn {
    color: #b45309;
}

.vs-update-modal__backup-tip {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.7;
    color: #4b5563;
}

.vs-update-modal__backup-tip:last-child {
    margin-bottom: 0;
}

.vs-modal {
    max-width: 480px;
}

/* ── 更新进度分步 ── */
.vs-update-progress__hint {
    margin: 0 0 16px;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.6;
}

.vs-update-progress__steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vs-update-progress__step {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f9fafb;
    transition: background 0.2s ease;
}

.vs-update-progress__step.is-active {
    background: #eff6ff;
}

.vs-update-progress__step.is-done {
    background: #f0fdf4;
}

.vs-update-progress__step.is-error {
    background: #fef2f2;
}

.vs-update-progress__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d1d5db;
    justify-self: center;
}

.vs-update-progress__step.is-active .vs-update-progress__dot {
    background: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
    animation: vsUpdatePulse 1.2s ease-in-out infinite;
}

.vs-update-progress__step.is-done .vs-update-progress__dot {
    background: #16a34a;
}

.vs-update-progress__step.is-error .vs-update-progress__dot {
    background: #dc2626;
}

.vs-update-progress__label {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.vs-update-progress__step.is-active .vs-update-progress__label {
    color: #1d4ed8;
}

.vs-update-progress__state {
    font-size: 12px;
    color: #9ca3af;
    white-space: nowrap;
}

.vs-update-progress__step.is-active .vs-update-progress__state {
    color: #2563eb;
    animation: vsUpdateBlink 1s ease-in-out infinite;
}

.vs-update-progress__step.is-done .vs-update-progress__state {
    color: #16a34a;
}

.vs-update-progress__step.is-error .vs-update-progress__state {
    color: #dc2626;
}

@keyframes vsUpdatePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.85; }
}

@keyframes vsUpdateBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* ── 文件/分享管理弹窗壳（全站 admin 共用） ── */
.vs-modal-shell {
    position: fixed;
    inset: 0;
    z-index: 4800;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}

.vs-modal-shell.is-open {
    display: flex;
}

.vs-modal-shell[hidden] {
    display: none !important;
}

.vs-modal-shell--stack {
    z-index: 4900;
}

.vs-modal-shell .vs-modal {
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 40px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    animation: vsModalIn 0.22s ease;
    display: flex;
    flex-direction: column;
}

.vs-modal-shell .vs-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 0;
    flex-shrink: 0;
}

.vs-modal-shell .vs-modal__title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #0f172a;
}

.vs-modal-shell .vs-modal__close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.vs-modal-shell .vs-modal__close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.vs-modal-shell .vs-modal__body {
    padding: 16px 20px 8px;
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.vs-modal-shell .vs-modal__foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px 20px;
    flex-shrink: 0;
}

.vs-modal-shell .vs-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

@media (max-width: 768px) {
    .vs-modal-shell {
        align-items: flex-end;
        padding: 0;
    }

    .vs-modal-shell .vs-modal {
        max-width: none;
        width: 100%;
        height: auto;
        max-height: var(--vs-mobile-drawer-height, 80vh);
        border-radius: 16px 16px 0 0;
    }

    .vs-modal-shell--theme-settings {
        --vs-mobile-drawer-height: 75vh;
    }
}

/* ── 主题设置弹窗（已废弃，保留通用 shell 样式） ── */
.vs-modal-shell--theme-settings {
    z-index: 4850;
}

.vs-modal-shell--theme-settings .vs-modal--theme-settings {
    max-width: 560px;
    width: min(560px, calc(100vw - 40px));
    max-height: min(72vh, 640px);
}

@media (min-width: 769px) {
    .vs-modal-shell--theme-settings {
        align-items: center;
        justify-content: center;
        padding: 24px;
    }
}

/* ── 响应式 Overlay（弹窗开发规范） ── */
:root {
    --vs-overlay-mobile-height: 85vh;
    --vs-overlay-form-max-width: 480px;
    /* LG 大编辑器：桌面更宽更高，便于接口/分类长表单 */
    --vs-overlay-lg-width: 92vw;
    --vs-overlay-lg-height: 88vh;
    --vs-overlay-lg-max-width: 1440px;
    --vs-overlay-lg-max-height: 960px;
}

.vs-overlay {
    position: fixed;
    inset: 0;
    z-index: 4850;
    display: none;
}

.vs-overlay[hidden] {
    display: none !important;
}

.vs-overlay.is-open {
    display: flex;
}

.vs-overlay__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.vs-overlay.is-open .vs-overlay__backdrop {
    opacity: 1;
}

.vs-overlay__panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

.vs-overlay__handle {
    display: none;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: #cbd5e1;
    margin: 10px auto 0;
    flex-shrink: 0;
}

.vs-overlay__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px 16px;
    flex-shrink: 0;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.vs-overlay__title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.4;
}

.vs-overlay__close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.vs-overlay__close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.vs-overlay__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 16px 20px;
}

.vs-overlay__foot {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px 24px;
    flex-shrink: 0;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.vs-overlay__foot .vs-btn {
    min-width: 120px;
}

.vs-overlay__foot .vs-btn--pill {
    min-height: 44px;
    padding: 10px 28px;
    font-size: 15px;
    font-weight: 600;
}

body.is-overlay-open {
    overflow: hidden;
}

@media (max-width: 767px) {
    .vs-overlay {
        align-items: flex-end;
        justify-content: stretch;
        padding: 0;
    }

    .vs-overlay__handle {
        display: block;
    }

    .vs-overlay__panel {
        width: 100% !important;
        max-width: none !important;
        margin: 0;
        height: var(--vs-overlay-mobile-height);
        max-height: var(--vs-overlay-mobile-height);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
        transform: translateY(100%);
        transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    }

    .vs-overlay.is-open .vs-overlay__panel {
        transform: translateY(0);
    }

    .vs-overlay__head {
        padding: 18px 20px 14px;
    }

    .vs-overlay__body {
        padding: 16px 20px;
    }

    .vs-overlay__foot {
        padding: 14px 20px calc(20px + env(safe-area-inset-bottom, 0px));
        gap: 14px;
    }

    .vs-overlay__foot .vs-btn--pill {
        flex: 1 1 0;
        min-width: 0;
        min-height: 48px;
        padding: 12px 20px;
        font-size: 16px;
    }
}

@media (min-width: 768px) {
    .vs-overlay {
        align-items: center;
        justify-content: center;
        padding: 24px;
    }

    .vs-overlay--form .vs-overlay__panel {
        width: min(var(--vs-overlay-form-max-width), calc(100vw - 48px));
        max-height: min(88vh, 640px);
    }

    .vs-overlay--lg .vs-overlay__panel {
        width: min(var(--vs-overlay-lg-width), var(--vs-overlay-lg-max-width), calc(100vw - 48px));
        height: min(var(--vs-overlay-lg-height), var(--vs-overlay-lg-max-height), calc(100vh - 48px));
        max-height: min(var(--vs-overlay-lg-height), var(--vs-overlay-lg-max-height), calc(100vh - 48px));
    }

    .vs-overlay__panel {
        border-radius: 16px;
        transform: scale(0.96);
        opacity: 0;
        transition: transform 0.25s ease, opacity 0.25s ease;
    }

    .vs-overlay.is-open .vs-overlay__panel {
        transform: scale(1);
        opacity: 1;
    }

    .vs-overlay__foot .vs-btn--pill {
        min-width: 128px;
        min-height: 46px;
        padding: 11px 32px;
        font-size: 15px;
    }
}

/* ── 嵌套选择器（弹窗中的弹窗 / 抽屉中的抽屉）── */
.vs-nested-picker {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.vs-nested-picker.vs-nested-picker--viewport {
    position: fixed;
    z-index: 4900;
}

.vs-nested-picker[hidden] {
    display: none !important;
}

.vs-nested-picker.is-open {
    pointer-events: auto;
}

.vs-nested-picker.is-visible {
    opacity: 1;
}

.vs-nested-picker__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(1px);
}

.vs-nested-picker__panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

.vs-nested-picker__handle {
    display: none;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: #cbd5e1;
    margin: 10px auto 0;
    flex-shrink: 0;
}

.vs-nested-picker__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 12px;
    flex-shrink: 0;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.vs-nested-picker__title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: #0f172a;
}

.vs-nested-picker__close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.vs-nested-picker__close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.vs-nested-picker__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px 16px;
}

.vs-nested-picker__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 8px;
}

.vs-nested-picker__chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-height: 52px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.vs-nested-picker__chip:hover {
    border-color: #93c5fd;
    background: #f8fbff;
}

.vs-nested-picker__chip.is-selected {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.vs-nested-picker__chip-en {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    word-break: break-all;
}

.vs-nested-picker__chip-zh {
    font-size: 12px;
    color: #64748b;
}

.vs-nested-picker__custom {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e2e8f0;
}

.vs-nested-picker__custom .vs-label {
    display: block;
    margin-bottom: 8px;
}

.vs-nested-picker__custom-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.vs-nested-picker__custom-row .vs-input {
    flex: 1 1 auto;
    min-width: 0;
}

.vs-nested-picker__foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 16px 16px;
    flex-shrink: 0;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

@media (max-width: 767px) {
    .vs-nested-picker {
        align-items: flex-end;
        justify-content: stretch;
    }

    .vs-nested-picker__handle {
        display: block;
    }

    .vs-nested-picker__panel {
        width: 100%;
        height: 78%;
        max-height: 78%;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.14);
        transform: translateY(18px);
        transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
    }

    .vs-nested-picker.is-visible .vs-nested-picker__panel {
        transform: translateY(0);
    }

    .vs-nested-picker__grid {
        grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
        gap: 8px;
    }

    .vs-nested-picker__foot .vs-btn {
        flex: 1 1 0;
        min-width: 0;
        min-height: 44px;
    }
}

@media (min-width: 768px) {
    .vs-nested-picker {
        align-items: center;
        justify-content: center;
        padding: 28px;
    }

    .vs-nested-picker__panel {
        width: min(560px, 92%);
        max-height: min(72%, 560px);
        border-radius: 14px;
        transform: scale(0.97);
        opacity: 0.96;
        transition: transform 0.22s ease, opacity 0.22s ease;
    }

    .vs-nested-picker.is-visible .vs-nested-picker__panel {
        transform: scale(1);
        opacity: 1;
    }

    .vs-nested-picker__foot .vs-btn {
        min-width: 100px;
    }
}
