/*
Theme Name: Private Gallery Vault
Theme URI: https://example.com/private-gallery-vault
Author: ChatGPT
Description: 一个轻量级的工作指南文件库主题，支持独立登录、多个查看用户、受保护文件夹、图片查看器、Draw.io 外部打开，安全白名单上传、上传时间显示，以及页内文件重命名。
Version: 1.3.4
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
Text Domain: private-gallery-vault
*/

:root {
    --pgv-bg: #0f172a;
    --pgv-card: #ffffff;
    --pgv-text: #111827;
    --pgv-muted: #64748b;
    --pgv-border: #e5e7eb;
    --pgv-soft: #f8fafc;
    --pgv-soft-blue: #eff6ff;
    --pgv-accent: #2563eb;
    --pgv-accent-dark: #1d4ed8;
    --pgv-danger-bg: #fef2f2;
    --pgv-danger-text: #991b1b;
    --pgv-radius: 18px;
    --pgv-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.35), transparent 28rem), var(--pgv-bg);
    color: var(--pgv-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.pgv-viewer-open {
    overflow: hidden;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

.pgv-page {
    min-height: 100vh;
}

.pgv-site-shell {
    width: min(1480px, calc(100% - 48px));
    margin: 0 auto;
    padding: 38px 0;
}

.pgv-card,
.pgv-login-card,
.pgv-package-card,
.pgv-image-card,
.pgv-topbar {
    background: var(--pgv-card);
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: var(--pgv-shadow);
    border-radius: var(--pgv-radius);
}

.pgv-login-card {
    width: min(460px, 100%);
    margin: min(12vh, 90px) auto 0;
    padding: 34px;
    text-align: left;
}

.pgv-logo-mark {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #0f172a);
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 18px;
}

.pgv-login-card h1,
.pgv-topbar h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 54px);
    line-height: 1.05;
    letter-spacing: -0.05em;
    overflow-wrap: anywhere;
}

.pgv-muted {
    color: var(--pgv-muted);
}

.pgv-login-card .pgv-muted {
    margin: 12px 0 24px;
}

.pgv-alert {
    padding: 12px 14px;
    margin-bottom: 18px;
    border-radius: 12px;
    color: var(--pgv-danger-text);
    background: var(--pgv-danger-bg);
    border: 1px solid #fecaca;
}

.pgv-login-form {
    display: grid;
    gap: 10px;
}

.pgv-login-form label {
    color: #334155;
    font-size: 14px;
    font-weight: 700;
}

.pgv-login-form input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--pgv-border);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 16px;
    outline: none;
}

.pgv-login-form input:focus {
    border-color: var(--pgv-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.pgv-button,
.pgv-logout,
.pgv-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border-radius: 12px;
    border: 0;
    color: #fff;
    background: var(--pgv-accent);
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
}

.pgv-button {
    width: 100%;
    margin-top: 8px;
    font-size: 16px;
}

.pgv-button:hover,
.pgv-logout:hover {
    background: var(--pgv-accent-dark);
}

.pgv-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: clamp(24px, 4vw, 38px);
    margin-bottom: 30px;
}

.pgv-topbar p {
    margin: 10px 0 0;
}

.pgv-logout {
    flex: 0 0 auto;
    background: #0f172a;
}

.pgv-back {
    min-height: auto;
    padding: 0;
    background: transparent;
    color: var(--pgv-accent);
    font-weight: 800;
}

.pgv-package-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.pgv-package-card {
    display: grid;
    align-content: start;
    min-height: 210px;
    gap: 12px;
    padding: 28px;
    color: var(--pgv-text);
    text-decoration: none;
    transition: transform 160ms ease, box-shadow 160ms ease;
    overflow: hidden;
}

.pgv-package-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.26);
}

.pgv-package-icon {
    width: 70px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--pgv-soft-blue);
    color: var(--pgv-accent);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.pgv-package-card strong {
    display: block;
    max-width: 100%;
    font-size: clamp(20px, 2.5vw, 30px);
    line-height: 1.13;
    letter-spacing: -0.035em;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.pgv-package-card span,
.pgv-package-card small {
    color: var(--pgv-muted);
}

.pgv-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.pgv-image-card {
    overflow: hidden;
}

.pgv-image-card img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: var(--pgv-soft);
    border-bottom: 1px solid var(--pgv-border);
}

.pgv-image-meta {
    display: grid;
    gap: 6px;
    padding: 14px;
}

.pgv-image-meta strong {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.pgv-image-meta span {
    color: var(--pgv-muted);
    font-size: 13px;
}

.pgv-image-meta a {
    color: var(--pgv-accent);
    font-weight: 800;
    text-decoration: none;
}

.pgv-card {
    padding: 28px;
}

.pgv-card h2 {
    margin-top: 0;
}

/* Image viewer */
.pgv-viewer-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    height: calc(100vh - 76px);
    min-height: 620px;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.2);
    border-radius: 20px;
    background: #020617;
    box-shadow: 0 24px 80px rgba(2, 6, 23, 0.45);
}

.pgv-viewer-sidebar {
    min-width: 0;
    overflow: hidden;
    border-right: 1px solid rgba(148, 163, 184, 0.22);
    background: #0f172a;
    color: #e5e7eb;
}

.pgv-viewer-sidebar-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.pgv-viewer-sidebar-head strong {
    font-size: 16px;
}

.pgv-viewer-sidebar-head span {
    color: #94a3b8;
    font-size: 12px;
}

.pgv-viewer-thumbs {
    height: calc(100% - 56px);
    overflow-y: auto;
    padding: 12px;
}

.pgv-thumb-link {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 12px;
    color: #e5e7eb;
    text-decoration: none;
    border: 1px solid transparent;
}

.pgv-thumb-link:hover,
.pgv-thumb-link.is-active {
    background: rgba(37, 99, 235, 0.16);
    border-color: rgba(96, 165, 250, 0.45);
}

.pgv-thumb-link img {
    width: 70px;
    height: 54px;
    object-fit: contain;
    border-radius: 10px;
    background: #020617;
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.pgv-thumb-link span {
    min-width: 0;
    color: #dbeafe;
    font-size: 13px;
    line-height: 1.25;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.pgv-viewer-main {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
}

.pgv-viewer-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    color: #e5e7eb;
    background: rgba(15, 23, 42, 0.94);
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.pgv-viewer-back,
.pgv-viewer-actions button,
.pgv-viewer-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: #e5e7eb;
    background: rgba(15, 23, 42, 0.75);
    text-decoration: none;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
}

.pgv-viewer-actions button:hover,
.pgv-viewer-actions a:hover,
.pgv-viewer-back:hover {
    background: rgba(37, 99, 235, 0.26);
    border-color: rgba(96, 165, 250, 0.7);
}

.pgv-viewer-title {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.pgv-viewer-title strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pgv-viewer-title span {
    color: #94a3b8;
    font-size: 12px;
}

.pgv-viewer-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.pgv-viewer-stage {
    position: relative;
    min-height: 0;
    overflow: hidden;
    background: #020617;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.pgv-viewer-stage.is-dragging {
    cursor: grabbing;
}

.pgv-viewer-image {
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    max-width: none;
    max-height: none;
    transform: translate(-50%, -50%) translate(0, 0) scale(1);
    transform-origin: center center;
    will-change: transform;
    user-select: none;
    -webkit-user-drag: none;
}

.pgv-viewer-zoom {
    position: absolute;
    right: 14px;
    bottom: 14px;
    min-width: 58px;
    padding: 7px 9px;
    border-radius: 999px;
    color: #e5e7eb;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.35);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    pointer-events: none;
}

@media (max-width: 1100px) {
    .pgv-package-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pgv-viewer-shell {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .pgv-viewer-toolbar {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .pgv-viewer-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 720px) {
    body.pgv-viewer-open {
        overflow: auto;
    }

    .pgv-site-shell {
        width: min(100% - 20px, 1480px);
        padding: 22px 0;
    }

    .pgv-login-card,
    .pgv-topbar,
    .pgv-card {
        padding: 22px;
    }

    .pgv-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .pgv-logout {
        width: 100%;
    }

    .pgv-package-grid {
        grid-template-columns: 1fr;
    }

    .pgv-viewer-shell {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
    }

    .pgv-viewer-sidebar {
        border-right: 0;
        border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    }

    .pgv-viewer-thumbs {
        height: auto;
        max-height: 180px;
    }

    .pgv-viewer-stage {
        height: 70vh;
    }
}

/* v1.2.1 viewer refinements: fuller viewport and light/dark viewer modes. */
body.pgv-is-viewer-page,
body.pgv-viewer-open,
body.pgv-fullscreen-active {
    background: #020617;
}

body.pgv-is-viewer-page .pgv-site-shell,
body.pgv-viewer-open .pgv-site-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

body.pgv-is-viewer-page .pgv-page,
body.pgv-viewer-open .pgv-page {
    min-height: 100vh;
}

body.pgv-fullscreen-active {
    overflow: hidden !important;
}

body.pgv-fullscreen-active #wpadminbar {
    display: none;
}

.pgv-viewer-shell {
    --pgv-viewer-bg: #020617;
    --pgv-viewer-panel: #0f172a;
    --pgv-viewer-panel-strong: #111827;
    --pgv-viewer-stage: #020617;
    --pgv-viewer-text: #e5e7eb;
    --pgv-viewer-title: #f8fafc;
    --pgv-viewer-muted: #94a3b8;
    --pgv-viewer-border: rgba(148, 163, 184, 0.24);
    --pgv-viewer-button: rgba(15, 23, 42, 0.75);
    --pgv-viewer-button-hover: rgba(37, 99, 235, 0.26);
    --pgv-viewer-thumb: #020617;
    --pgv-viewer-active: rgba(37, 99, 235, 0.16);
    --pgv-viewer-active-border: rgba(96, 165, 250, 0.55);
    height: 100vh;
    min-height: 0;
    width: 100%;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    background: var(--pgv-viewer-bg);
}

.admin-bar.pgv-is-viewer-page .pgv-viewer-shell,
.admin-bar.pgv-viewer-open .pgv-viewer-shell {
    height: calc(100vh - 32px);
}

.pgv-viewer-shell.is-inpage-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    width: 100vw;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.admin-bar.pgv-is-viewer-page .pgv-viewer-shell.is-inpage-fullscreen,
.admin-bar.pgv-viewer-open .pgv-viewer-shell.is-inpage-fullscreen {
    height: 100dvh;
}

.pgv-viewer-shell.is-light-mode {
    --pgv-viewer-bg: #f8fafc;
    --pgv-viewer-panel: #ffffff;
    --pgv-viewer-panel-strong: #f1f5f9;
    --pgv-viewer-stage: #f8fafc;
    --pgv-viewer-text: #111827;
    --pgv-viewer-title: #020617;
    --pgv-viewer-muted: #475569;
    --pgv-viewer-border: rgba(148, 163, 184, 0.38);
    --pgv-viewer-button: #ffffff;
    --pgv-viewer-button-hover: #eff6ff;
    --pgv-viewer-thumb: #f8fafc;
    --pgv-viewer-active: rgba(37, 99, 235, 0.10);
    --pgv-viewer-active-border: rgba(37, 99, 235, 0.55);
}

.pgv-viewer-sidebar {
    background: var(--pgv-viewer-panel);
    color: var(--pgv-viewer-text);
    border-right-color: var(--pgv-viewer-border);
}

.pgv-viewer-sidebar-head {
    border-bottom-color: var(--pgv-viewer-border);
}

.pgv-viewer-sidebar-head strong,
.pgv-viewer-title strong,
.pgv-viewer-back,
.pgv-viewer-actions button,
.pgv-viewer-actions a {
    color: var(--pgv-viewer-title);
}

.pgv-viewer-sidebar-head span,
.pgv-viewer-title span {
    color: var(--pgv-viewer-muted);
}

.pgv-viewer-toolbar {
    color: var(--pgv-viewer-text);
    background: var(--pgv-viewer-panel);
    border-bottom-color: var(--pgv-viewer-border);
}

.pgv-viewer-back,
.pgv-viewer-actions button,
.pgv-viewer-actions a {
    background: var(--pgv-viewer-button);
    border-color: var(--pgv-viewer-border);
}

.pgv-viewer-actions button:hover,
.pgv-viewer-actions a:hover,
.pgv-viewer-back:hover {
    background: var(--pgv-viewer-button-hover);
    border-color: var(--pgv-viewer-active-border);
}

.pgv-viewer-stage {
    background: var(--pgv-viewer-stage);
}

.pgv-thumb-link {
    color: var(--pgv-viewer-text);
}

.pgv-thumb-link:hover,
.pgv-thumb-link.is-active {
    background: var(--pgv-viewer-active);
    border-color: var(--pgv-viewer-active-border);
}

.pgv-thumb-link img {
    background: var(--pgv-viewer-thumb);
    border-color: var(--pgv-viewer-border);
}

.pgv-thumb-link span {
    color: var(--pgv-viewer-title);
}

.pgv-viewer-zoom {
    color: var(--pgv-viewer-title);
    background: color-mix(in srgb, var(--pgv-viewer-panel) 88%, transparent);
    border-color: var(--pgv-viewer-border);
}

.pgv-viewer-shell.is-light-mode .pgv-viewer-zoom {
    background: rgba(255, 255, 255, 0.88);
}

@supports not (background: color-mix(in srgb, white 50%, transparent)) {
    .pgv-viewer-zoom {
        background: rgba(15, 23, 42, 0.82);
    }

    .pgv-viewer-shell.is-light-mode .pgv-viewer-zoom {
        background: rgba(255, 255, 255, 0.88);
    }
}

@media (max-width: 782px) {
    .admin-bar.pgv-is-viewer-page .pgv-viewer-shell,
    .admin-bar.pgv-viewer-open .pgv-viewer-shell {
        height: calc(100vh - 46px);
    }

    .admin-bar.pgv-is-viewer-page .pgv-viewer-shell.is-inpage-fullscreen,
    .admin-bar.pgv-viewer-open .pgv-viewer-shell.is-inpage-fullscreen {
        height: 100dvh;
    }
}


/* v1.2.2 collapsible image list. The list is expanded by default and folds left when collapsed. */
.pgv-viewer-shell {
    transition: grid-template-columns 180ms ease;
}

.pgv-viewer-sidebar-head {
    align-items: center;
}

.pgv-viewer-sidebar-title {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.pgv-sidebar-toggle {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--pgv-viewer-border);
    color: var(--pgv-viewer-title);
    background: var(--pgv-viewer-button);
    cursor: pointer;
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
}

.pgv-sidebar-toggle:hover {
    background: var(--pgv-viewer-button-hover);
    border-color: var(--pgv-viewer-active-border);
}

.pgv-viewer-shell.is-sidebar-collapsed {
    grid-template-columns: 52px minmax(0, 1fr);
}

.pgv-viewer-shell.is-sidebar-collapsed .pgv-viewer-sidebar {
    overflow: hidden;
}

.pgv-viewer-shell.is-sidebar-collapsed .pgv-viewer-sidebar-head {
    justify-content: center;
    padding: 12px 8px;
    border-bottom: 0;
}

.pgv-viewer-shell.is-sidebar-collapsed .pgv-viewer-sidebar-title,
.pgv-viewer-shell.is-sidebar-collapsed .pgv-viewer-thumbs {
    display: none;
}

.pgv-viewer-shell.is-sidebar-collapsed .pgv-sidebar-toggle {
    width: 34px;
    height: 38px;
}

@media (max-width: 720px) {
    .pgv-viewer-shell.is-sidebar-collapsed {
        grid-template-columns: 1fr;
    }

    .pgv-viewer-shell.is-sidebar-collapsed .pgv-viewer-sidebar {
        border-bottom: 1px solid var(--pgv-viewer-border);
    }
}

/* v1.3.0 protected file upload and non-image guide files. */
.pgv-alert-success {
    color: #166534;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.pgv-alert-error {
    color: var(--pgv-danger-text);
    background: var(--pgv-danger-bg);
    border-color: #fecaca;
}

.pgv-upload-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.pgv-upload-card h2,
.pgv-section-head h2 {
    margin: 0;
    font-size: clamp(22px, 2.2vw, 32px);
    letter-spacing: -0.035em;
}

.pgv-upload-card p {
    margin: 8px 0 0;
}

.pgv-upload-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.pgv-upload-form input[type="file"] {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    background: #f8fafc;
    color: #334155;
}

.pgv-upload-button {
    min-height: 48px;
    padding: 0 18px;
    border: 0;
    border-radius: 14px;
    color: #fff;
    background: var(--pgv-accent);
    font-weight: 900;
    cursor: pointer;
}

.pgv-upload-button:hover {
    background: var(--pgv-accent-dark);
}

.pgv-upload-note {
    font-size: 13px;
    color: var(--pgv-muted);
}

.pgv-section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin: 34px 0 14px;
    color: #fff;
}

.pgv-section-head p {
    margin: 0;
    color: rgba(226, 232, 240, 0.82);
    font-weight: 700;
}

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

.pgv-file-card {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 18px;
    background: #fff;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: var(--pgv-radius);
    box-shadow: var(--pgv-shadow);
}

.pgv-file-icon {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: var(--pgv-soft-blue);
    color: var(--pgv-accent);
    font-size: 12px;
    font-weight: 900;
    overflow: hidden;
}

.pgv-file-main {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.pgv-file-main strong {
    min-width: 0;
    color: var(--pgv-text);
    font-size: 17px;
    line-height: 1.22;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.pgv-file-main span {
    color: var(--pgv-muted);
    font-size: 13px;
}

.pgv-file-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 2px;
}

.pgv-file-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid #dbeafe;
    color: var(--pgv-accent);
    background: #eff6ff;
    text-decoration: none;
    font-weight: 900;
}

.pgv-file-actions a:hover {
    border-color: #93c5fd;
    background: #dbeafe;
}

.pgv-file-actions .pgv-file-primary {
    color: #fff;
    background: var(--pgv-accent);
    border-color: var(--pgv-accent);
}

.pgv-file-actions .pgv-file-primary:hover {
    background: var(--pgv-accent-dark);
}

@media (max-width: 720px) {
    .pgv-upload-form {
        grid-template-columns: 1fr;
    }

    .pgv-file-grid {
        grid-template-columns: 1fr;
    }

    .pgv-section-head {
        align-items: start;
        flex-direction: column;
    }
}


/* v1.3.1 file visibility fix, upload time display, and safe in-page renaming. */
.pgv-rename-form {
    display: grid;
    gap: 6px;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--pgv-border);
}

.pgv-rename-form label {
    color: #334155;
    font-size: 12px;
    font-weight: 900;
}

.pgv-rename-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 6px;
}

.pgv-rename-row input {
    width: 100%;
    min-height: 36px;
    padding: 7px 9px;
    border: 1px solid var(--pgv-border);
    border-radius: 10px;
    color: var(--pgv-text);
    background: #fff;
    outline: none;
}

.pgv-rename-row input:focus {
    border-color: var(--pgv-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.pgv-rename-row span {
    color: var(--pgv-muted);
    font-size: 13px;
    font-weight: 800;
}

.pgv-rename-row button {
    min-height: 36px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: var(--pgv-accent);
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
}

.pgv-rename-row button:hover {
    background: var(--pgv-accent-dark);
}

.pgv-rename-form small {
    color: var(--pgv-muted);
    font-size: 12px;
    line-height: 1.35;
}

.pgv-file-card .pgv-rename-form {
    grid-column: 1 / -1;
    margin-top: 0;
}

@media (max-width: 720px) {
    .pgv-rename-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}

/* v1.3.2 category tabs and thumbnail-only cached viewer switching. v1.3.3 login ban list support. */
.pgv-file-browser {
    margin-top: 30px;
}

.pgv-file-tab-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.pgv-file-tab {
    display: grid;
    gap: 6px;
    min-height: 74px;
    padding: 14px 16px;
    border: 1px solid rgba(148, 163, 184, 0.38);
    border-radius: 16px;
    color: rgba(226, 232, 240, 0.92);
    background: rgba(15, 23, 42, 0.68);
    text-align: left;
    cursor: pointer;
    box-shadow: 0 14px 36px rgba(2, 6, 23, 0.18);
}

.pgv-file-tab:hover,
.pgv-file-tab.is-active {
    color: #ffffff;
    background: rgba(37, 99, 235, 0.28);
    border-color: rgba(96, 165, 250, 0.8);
}

.pgv-file-tab-label {
    display: block;
    font-size: 17px;
    font-weight: 900;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.pgv-file-tab-count {
    display: block;
    color: rgba(226, 232, 240, 0.78);
    font-size: 13px;
    font-weight: 800;
}

.pgv-file-tab.is-active .pgv-file-tab-count {
    color: rgba(255, 255, 255, 0.86);
}

.pgv-file-tab-panels {
    min-height: 180px;
}

.pgv-file-tab-panel {
    display: none;
}

.pgv-file-tab-panel.is-active {
    display: block;
}

.pgv-empty-tab {
    box-shadow: none;
}

.pgv-empty-tab p {
    margin: 0;
}

.pgv-viewer-image.is-loading {
    opacity: 0.35;
}

.pgv-viewer-image {
    transition: opacity 120ms ease;
}

@media (max-width: 980px) {
    .pgv-file-tab-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .pgv-file-tab-list {
        grid-template-columns: 1fr;
    }
}
