.pm-media-row,
.pm-admin-media-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 18px;
}

.pm-media-box,
.pm-admin-media-card {
    width: 160px;
}

.pm-media-link {
    display: block;
    text-decoration: none;
}

.pm-media-box:hover {
    transform: translateY(-2px);
}

.pm-media-thumb,
.pm-admin-media-thumb {
    width: 160px;
    height: 130px;
    object-fit: cover;
    display: block;
    border: 3px solid #111827;
    border-radius: 24px;
    background: #f8fafc;
    box-sizing: border-box;
}

.pm-media-video,
.pm-admin-media-preview {
    position: relative;
}

.pm-media-video-icon,
.pm-admin-media-type {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    background: rgba(15, 23, 42, 0.28);
    color: #fff;
    font-size: 1.8rem;
    font-weight: 700;
    pointer-events: none;
}

.pm-video-fallback {
    width: 160px;
    height: 130px;
    border: 3px solid #111827;
    border-radius: 24px;
    background: #1f2937;
    color: white;
    box-sizing: border-box;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;

    text-align: center;
    overflow: hidden;
}

.pm-video-fallback-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.pm-video-fallback-text {
    font-size: 0.85rem;
    color: #cbd5e1;
    max-width: 130px;
    overflow-wrap: anywhere;
}

.pm-media-audio,
.pm-admin-audio-preview {
    width: 160px;
    height: 130px;
    border: 3px solid #111827;
    border-radius: 24px;
    background: #656566;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    box-sizing: border-box;
    text-align: center;
}

.pm-media-audio-icon {
    font-size: 1.8rem;
    line-height: 1;
    color: #1e3a8a;
}

.pm-media-audio-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.pm-media-audio-hint {
    font-size: 0.78rem;
    color: #475569;
}

.pm-media-audio-player {
    width: 100%;
    max-width: 130px;
}

.pm-media-file,
.pm-admin-file-preview {
    width: 160px;
    height: 130px;
    border: 3px solid #111827;
    border-radius: 24px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    box-sizing: border-box;
    text-align: center;
    text-decoration: none;
}

.pm-media-file-icon,
.pm-admin-file-icon {
    font-size: 2rem;
    line-height: 1;
}

.pm-media-file-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.pm-media-file-ext,
.pm-admin-file-ext {
    font-size: 0.8rem;
    font-weight: 700;
    color: #2563eb;
    letter-spacing: 0.04em;
}

.pm-admin-form {
    margin-top: 18px;
    margin-bottom: 18px;
}

.pm-admin-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.pm-admin-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pm-admin-field--full {
    grid-column: 1 / -1;
}

.pm-admin-help {
    font-size: 0.8rem;
    line-height: 1.4;
    color: #94a3b8;
}

.pm-admin-media-meta {
    margin-top: 8px;
    font-size: 0.92rem;
    line-height: 1.4;
}

.pm-admin-btn,
.pm-admin-delete,
.pm-admin-order-btn {
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 600;
    cursor: pointer;
}

.pm-admin-btn {
    background: #2563eb;
    color: white;
}

.pm-admin-delete {
    background: #dc2626;
    color: white;
    margin-top: 8px;
}

.pm-admin-empty {
    margin-top: 12px;
}

.pm-dropzone {
    border: 2px dashed #475569;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    padding: 18px;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.pm-dropzone.is-dragover {
    border-color: #60a5fa;
    background: rgba(96, 165, 250, 0.08);
    transform: translateY(-1px);
}

.pm-dropzone-inner {
    text-align: center;
}

.pm-dropzone-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
    color: #93c5fd;
}

.pm-dropzone-text {
    font-size: 0.95rem;
    color: #e2e8f0;
    margin-bottom: 8px;
}

.pm-dropzone-note {
    font-size: 0.8rem;
    line-height: 1.45;
    color: #94a3b8;
}

.pm-link-button {
    background: none;
    border: none;
    color: #60a5fa;
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-decoration: underline;
}

.pm-selected-file {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #cbd5e1;
    word-break: break-word;
}

.pm-preview-wrap {
    margin: 18px 0;
}

.pm-preview-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #e2e8f0;
}

.pm-preview-box {
    min-height: 140px;
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 14px;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pm-preview-box img,
.pm-preview-box video {
    max-width: 220px;
    max-height: 180px;
    border-radius: 14px;
    object-fit: cover;
}

.pm-preview-box audio {
    width: 100%;
    max-width: 280px;
}

.pm-preview-file {
    text-align: center;
    color: #e2e8f0;
}

.pm-preview-file-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.pm-upload-progress-wrap {
    margin: 14px 0 18px;
}

.pm-upload-progress-bar {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: #1e293b;
    border: 1px solid #334155;
}

.pm-upload-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    transition: width 0.15s linear;
}

.pm-upload-progress-text {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #cbd5e1;
}

.pm-admin-btn[disabled] {
    opacity: 0.7;
    cursor: not-allowed;
}

.pm-admin-order-form {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pm-admin-order-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1;
}

.pm-admin-order-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #f8fafc;
    font-size: 0.95rem;
}

.pm-admin-order-btn {
    background: #475569;
    color: white;
}

/* Modal / Lightbox */
.pm-modal.hidden {
    display: none;
}

.pm-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.pm-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}

.pm-modal-shell {
    position: absolute;
    inset: 2vh 2vw;
    max-width: 1400px;
    margin: 0 auto;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pm-modal-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid #334155;
    background: #0f172a;
    z-index: 20;
}

.pm-modal-title {
    color: #f8fafc;
    font-size: 1rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.pm-modal-close {
    background: none;
    border: none;
    color: #f8fafc;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
}

.pm-modal-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 70px;
    position: relative;
}

.pm-modal-stage {
    width: 100%;
    height: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.pm-modal-img,
.pm-modal-video {
    max-width: 100%;
    max-height: calc(96vh - 130px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    display: block;
    transition: transform 0.15s ease;
    transform-origin: center center;
}

.pm-modal-img.is-zoomed {
    cursor: zoom-out;
}

.pm-modal-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid #334155;
    color: white;
    font-size: 2.5rem;
    padding: 10px 14px;
    cursor: pointer;
    border-radius: 12px;
    z-index: 15;
    transition: background 0.2s ease;
}

.pm-modal-arrow:hover {
    background: rgba(15, 23, 42, 0.95);
}

.pm-modal-arrow-left {
    left: 18px;
}

.pm-modal-arrow-right {
    right: 18px;
}

.pm-zoom-controls {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 18;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid #334155;
    border-radius: 999px;
    padding: 8px;
}

.pm-zoom-btn {
    border: none;
    border-radius: 999px;
    padding: 7px 12px;
    background: #2563eb;
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.pm-modal-audio-wrap {
    width: min(520px, 100%);
}

.pm-modal-audio {
    width: 100%;
}

.pm-modal-file-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #e2e8f0;
    text-align: center;
    min-height: 220px;
    width: 100%;
}

.pm-modal-file-icon {
    font-size: 2.6rem;
}

.pm-modal-file-text {
    margin: 0;
    color: #cbd5e1;
}

.pm-modal-download-btn {
    display: inline-block;
    text-decoration: none;
    border-radius: 10px;
    padding: 10px 16px;
    background: #2563eb;
    color: white;
    font-weight: 600;
}

.pm-modal-stage.is-pannable {
    cursor: grab;
}

.pm-modal-stage.is-dragging {
    cursor: grabbing;
}

.pm-modal-img.is-zoomed {
    cursor: grab;
    max-width: none;
    max-height: none;
}

.pm-media-video {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
}

.pm-media-video-icon {
    position: absolute;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 6px 8px;
    border-radius: 24px;
    font-size: 14px;
}

.pm-modal-pdf {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
    background: white;
}

.pm-modal-text {
    width: 100%;
    height: 100%;

    overflow: auto;

    background: #0f172a;
    color: #e2e8f0;

    padding: 20px;
    border-radius: 12px;

    font-family: Consolas, monospace;
    font-size: 14px;
    line-height: 1.5;

    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 640px) {
    .pm-media-box,
    .pm-admin-media-card {
        width: 140px;
        flex: 0 0 140px;
    }

    .pm-media-thumb,
    .pm-admin-media-thumb,
    .pm-media-audio,
    .pm-admin-audio-preview,
    .pm-media-file,
    .pm-admin-file-preview {
        width: 140px;
        height: 118px;
    }

    .pm-modal-shell {
        inset: 1.5vh 1.5vw;
    }

    .pm-modal-body {
        padding: 14px 48px;
    }

    .pm-modal-arrow {
        font-size: 2rem;
        padding: 8px 10px;
    }

    .pm-modal-arrow-left {
        left: 8px;
    }

    .pm-modal-arrow-right {
        right: 8px;
    }

    .pm-modal-img,
    .pm-modal-video {
        max-height: calc(96vh - 120px);
    }

    .pm-zoom-controls {
        bottom: 12px;
    }
}

/* Apply to the element you want to hide scrollbars for (e.g., .container or body) */
.hide-scrollbar {
  /* Hides scrollbar for Firefox */
  scrollbar-width: none;

  /* Hides scrollbar for IE and older Edge */
  -ms-overflow-style: none;
}

/* Hides scrollbar for Chrome, Safari, and Opera */
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

.pm-modal-body {
    overflow: hidden;          /* prevents outer scroll */
}

.pm-modal-stage {
    overflow: hidden;          /* prevents inner scrollbars */
}

body.modal-open {
    overflow: hidden;
}