/* =========================
   VAPMA Member Dashboard
   Media Library
   ========================= */

.vapma-md-media-library {
    background: transparent;
    border: none;
    padding: 0;
    flex: 1 1 100%;
}

.vapma-md-media-library h3 {
    margin: 0 0 10px;
    font-size: 18px;
    line-height: 1.2;
    color: #fff;
}

.vapma-md-media-library p {
    margin: 0 0 8px;
    color: #c8c8c8;
    font-size: 13.5px;
    line-height: 1.5;
}

.vapma-md-media-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    flex-wrap: wrap;
}

.vapma-md-media-upload input[type="file"] {
    max-width: 100%;
    color: #bdbdbd;
    font-size: 12px;
}

.vapma-md-media-upload button {
    display: inline-block;
    padding: 8px 12px;
    border: 1px solid #2a2a2a;
    background: #151515;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
}

.vapma-md-media-upload button:hover {
    border-color: #cf2e2e;
    color: #cf2e2e;
}

.vapma-md-media-upload button:disabled {
    opacity: 0.55;
    cursor: default;
}

.vapma-md-media-upload-status {
    font-size: 12px;
    color: #b8b8b8;
}

.vapma-md-media-upload-progress {
    width: 100%;
    max-width: 260px;
    height: 8px;
    background: #111;
    border: 1px solid #242424;
    border-radius: 999px;
    overflow: hidden;
}

.vapma-md-media-upload-progress-bar {
    width: 0%;
    height: 100%;
    background: #cf2e2e;
    transition: width 0.15s ease;
}

.vapma-md-media-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
}

.vapma-md-media-grid > * {
    min-width: 0;
}

.vapma-md-media-grid img,
.vapma-md-media-grid video {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    border-radius: 8px;
    background: #000;
}

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

@media (max-width: 640px) {
    .vapma-md-media-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================
   ========================= */

.vapma-md-media-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 16px;
    padding: 8px 8px 6px;
    background: #0b0b0b;
    border: 1px solid #1f1f1f;
    border-radius: 8px;
    opacity: 0.92;
    position: relative;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.18s ease, opacity 0.18s ease, filter 0.18s ease;
    cursor: grab;
}

.vapma-md-media-item.vapma-md-media-dragging {
    opacity: 1;
    transform: scale(1.02);
    box-shadow: 0 14px 28px rgba(0,0,0,0.45);
    filter: brightness(1.04);
}

.vapma-md-media-item:hover {
    transform: translateY(-2px);
}

.vapma-md-media-item.vapma-md-active {
    border: 1px solid #3a3a3a;
    background: #121212;
    opacity: 10;
}

.vapma-md-media-item.vapma-md-active .vapma-md-media-edit-button {
    display: none;
}

.vapma-md-media-name {
    font-size: 12px;
    color: #9a9a9a;
    line-height: 1.3;
    word-break: break-word;
}

.vapma-md-media-grip {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 14px;
    cursor: grab;
    z-index: 5;

    background:
        repeating-linear-gradient(
            to bottom,
            rgba(255,255,255,0.35) 0px,
            rgba(255,255,255,0.35) 1px,
            transparent 1px,
            transparent 3px
        );

    opacity: 0.75;
    border-radius: 6px 6px 0 0;
}

.vapma-md-media-item:active .vapma-md-media-grip {
    cursor: grabbing;
    opacity: 0.9;
}

.vapma-md-media-actions {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
    margin-top: 6px;
}

.vapma-md-media-actions button {
    flex: 1 1 auto;
    min-width: 0;
    padding: 7px 10px;
    border: 1px solid #2a2a2a;
    background: #151515;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.2;
    margin-top: 0;
    opacity: 0.85;
    transition: all 0.15s ease;
}

.vapma-md-media-edit-button {
    width: 100%;
    justify-content: center;
    background: #111;
    border-color: #303030;
    color: #d8d8d8;
    font-weight: 600;
}

.vapma-md-media-actions button:hover {
    background: #1f1f1f;
    border-color: #3a3a3a;
    opacity: 1;
}

.vapma-md-media-edit-button:hover {
    background: #181818;
    border-color: #4a4a4a;
    color: #ffffff;
}

.vapma-md-media-actions button:disabled {
    opacity: 0.55;
    cursor: default;
}

.vapma-md-media-thumb-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    isolation: isolate;
    margin-top: 14px;
}

.vapma-md-media-drag-handle {
    display: none !important;
}

.vapma-md-media-thumb-wrap .vapma-md-media-stats-strip {
    position: static;
    left: auto;
    bottom: auto;
    transform: none;
    display: block;
    align-items: initial;
    gap: 0;
    z-index: auto;
}

.vapma-md-media-thumb-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 999px;
    background: rgba(0,0,0,0.62);
    color: #f2f2f2;
    font-size: 15px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    z-index: 6;
    transition: all 0.15s ease;
}

.vapma-md-media-thumb-edit {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    color: #cf2e2e;
    border: none;
    font-size: 14px;
    cursor: pointer;
    z-index: 7;
}

.vapma-md-media-thumb-remove:hover {
    border-color: #cf2e2e;
    color: #ffffff;
    background: rgba(120,0,0,0.72);
}

.vapma-md-media-grid a {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.vapma-md-media-grid a::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.0);
    transition: background 0.2s ease;
}

.vapma-md-media-grid a:hover::after {
    background: rgba(0,0,0,0.25);
}

.vapma-md-media-grid > div:first-child {
    position: relative;
}

.vapma-md-media-views-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 10px;
    line-height: 1;
    z-index: 5;
}

.vapma-md-media-category-badge {
    position: absolute;
    left: 6px;
    bottom: 6px;
    background: rgba(0,0,0,0.72);
    color: #f2f2f2;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 999px;
    line-height: 1;
    z-index: 6;
    border: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(4px);
    max-width: calc(100% - 40px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vapma-md-media-stats-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    margin: 6px 0 6px;
}

.vapma-md-media-mini-stat {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;
    gap: 0;
    min-width: 0;
    aspect-ratio: 1 / 1;
    padding: 4px;
    background: #0d0d0d;
    border: 1px solid #262626;
    border-radius: 7px;
    box-sizing: border-box;
    overflow: hidden;
}

.vapma-md-media-mini-stat canvas {
    position: relative;
    z-index: 2;
    opacity: 0.95;
    margin-top: auto;
    max-height: 18px;
}

.vapma-md-media-mini-stat-label {
    position: absolute;
    top: 6px;
    left: 50%;
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    max-width: 22px;
    max-height: 22px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 3;
    opacity: 0.6;
}

.vapma-md-media-mini-stat-value {
    display: block;
    color: #f2f2f2;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
}

/* =========================
   ========================= */

.vapma-md-edit-panel {
    display: none;
    padding: 8px;
    background: #0e0e0e;
    border: 1px solid #1f1f1f;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
    margin-top: 8px;
}

.vapma-md-edit-panel.active {
    display: block;
}

.vapma-md-edit-panel input[type="text"] {
    display: block;
    width: 100%;
    margin: 0 0 10px;
    height: 40px;
    padding: 6px 10px !important;
    background: #121212 !important;
    border: 1px solid #3a3a3a !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    border-radius: 3px;
    box-sizing: border-box;
    font-size: 13px;
    line-height: 1.2 !important;
}

.vapma-md-edit-panel select {
    display: block;
    width: 100%;
    margin: 0 0 10px;
    height: 40px;
    padding: 0 10px;
    background: #121212 !important;
    border: 1px solid #3a3a3a;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    border-radius: 3px;
    box-sizing: border-box;
    font-size: 13px;
    line-height: 40px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 40px;
    background-image: none;
}

.vapma-md-edit-panel textarea {
    display: block;
    width: 100%;
    margin: 0 0 10px;
    min-height: 70px;
    height: auto;
    padding: 6px 10px;
    background: #121212 !important;
    border: 1px solid #3a3a3a;
    color: #ffffff !important;
    border-radius: 3px;
    box-sizing: border-box;
    font-size: 13px;
    line-height: 1.35;
    resize: vertical;
}

.vapma-md-edit-panel input::placeholder {
    color: #8a8a8a;
    opacity: 0.6;
}

.vapma-md-edit-panel textarea::placeholder,
.vapma-md-edit-panel input[type="text"]::placeholder {
    color: #7a7a7a !important;
    opacity: 1;
}

.vapma-member-dashboard .vapma-md-edit-panel input[type="text"]:focus,
.vapma-member-dashboard .vapma-md-edit-panel textarea:focus,
.vapma-member-dashboard .vapma-md-edit-panel select:focus {
    outline: none;
    border-color: #cf2e2e !important;
    color: #ffffff !important;
    background: #111;
}

.vapma-md-edit-panel button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 78px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid #2a2a2a;
    background: #151515;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.2;
}

.vapma-md-edit-panel button:hover {
    border-color: #cf2e2e;
    color: #cf2e2e;
}

.vapma-md-edit-label {
    display: block;
    margin: 6px 0 4px;
    color: #e5e5e5;
    font-size: 12px;
    line-height: 1.4;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.vapma-md-edit-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.vapma-md-edit-actions .vapma-save-edit {
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    color: #ffffff;
}

.vapma-md-edit-actions .vapma-save-edit:hover {
    background: #222222;
    border-color: #cf2e2e;
    color: #ffffff;
}

.vapma-md-edit-actions .vapma-cancel-edit {
    background: #1a1a1a;
    border: 1px solid #444;
    color: #ccc;
}

.vapma-md-edit-actions .vapma-cancel-edit:hover {
    border-color: #888;
    color: #fff;
}

/* =========================
   ========================= */

.vapma-md-access-toggle {
    display: flex;
    border: 1px solid #2a2a2a;
    border-radius: 999px;
    overflow: hidden;
    background: #0e0e0e;
    padding: 2px;
}

.vapma-md-access-toggle span {
    flex: 1;
    text-align: center;
    font-size: 10px;
    padding: 6px 0;
    color: #7f7f7f;
    border-radius: 999px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.vapma-md-access-toggle span.active {
    background: #1a1a1a;
    color: #ffffff;
}

.vapma-md-media-name-editable {
    font-size: 15px;
    margin-top: 2px;
    letter-spacing: normal;
    font-weight: 600;
    color: #ffffff;
    cursor: text;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.vapma-md-media-name-editable::after {
    content: '✎';
    font-size: 10px;
    margin-left: 6px;
    color: #cf2e2e;
    filter: none;
    position: relative;
    top: -1px;
}

.vapma-md-media-name-editable:hover {
    background: rgba(255, 255, 255, 0.04);
}

.vapma-md-media-name-editable:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.vapma-md-media-name-editable:focus::after {
    display: none;
}

.vapma-md-quick-access-pill {
    display: inline-flex;
    width: 100%;
    border: 1px solid #2a2a2a;
    border-radius: 999px;
    background: linear-gradient(180deg, #1c1c1c 0%, #121212 100%);
    padding: 2px;
    box-sizing: border-box;
    margin: 4px 0 2px;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.vapma-md-quick-access-pill:hover {
    border-color: #5a5a5a;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.06),
        0 0 0 1px rgba(255,255,255,0.05),
        0 3px 8px rgba(0,0,0,0.5);
}

.vapma-md-quick-access-option {
    flex: 1 1 50%;
    border: 0;
    background: transparent;
    color: #9f9f9f;
    padding: 5px 8px;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.vapma-md-quick-access-option:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.06);
}

/* Active state keeps outer rounding */
.vapma-md-quick-access-option.is-active[data-scope-value="general"] {
    border-radius: 999px 0 0 999px;
}

.vapma-md-quick-access-option.is-active[data-scope-value="special"] {
    border-radius: 0 999px 999px 0;
}

/* Hover keeps outer rounding */
.vapma-md-quick-access-option:hover[data-scope-value="general"] {
    border-radius: 999px 0 0 999px;
}

.vapma-md-quick-access-option:hover[data-scope-value="special"] {
    border-radius: 0 999px 999px 0;
}

.vapma-md-quick-access-option.is-active {
    background: linear-gradient(180deg, #3a171b 0%, #2a1114 100%);
    color: #ffffff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), inset 0 -2px 4px rgba(0,0,0,0.35);
}

.vapma-md-edit-category-wrap {
    margin-top: 6px;
}

.vapma-md-category-input-wrap {
    position: relative;
}

.vapma-md-category-input-wrap .vapma-edit-category {
    padding-right: 38px !important;
}

.vapma-md-category-input-wrap .vapma-category-clear {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    display: none;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    min-width: 22px;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 999px;
    background: rgba(0,0,0,0.75);
    color: #ffffff;
    font-size: 16px;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    z-index: 30;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
}

.vapma-md-category-input-wrap .vapma-category-clear:hover {
    border-color: #cf2e2e;
    color: #ffffff;
    background: rgba(120,0,0,0.72);
}

.vapma-md-media-ribbon {
    position: absolute;
    top: 8px;
    left: -18px;
    width: 64px;
    text-align: center;
    background: #cf2e2e;
    color: #ffffff;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    padding: 4px 0 3px;
    transform: rotate(-45deg);
    z-index: 7;
    letter-spacing: 0.04em;
    box-sizing: border-box;
}

.vapma-md-media-edit {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 7;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(0,0,0,0.75);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
}

.vapma-md-media-reset-stats-icon {
    position: absolute;
    top: 30px;
    left: 6px;
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 999px;
    background: rgba(0,0,0,0.72);
    color: #ffffff;
    font-size: 12px;
    line-height: 16px;
    text-align: center;
    cursor: pointer;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vapma-md-media-reset-stats-icon:hover {
    border-color: #cf2e2e;
    background: rgba(120,0,0,0.72);
    color: #ffffff;
}

.vapma-md-edit-panel textarea.vapma-edit-description::placeholder,
.vapma-md-edit-panel input.vapma-edit-keywords::placeholder {
    color: #7a7a7a !important;
    opacity: 1 !important;
    -webkit-text-fill-color: #7a7a7a !important;
}

.vapma-md-media-item.vapma-md-active .vapma-md-media-deactivate-button {
    display: none !important;
}

.vapma-md-media-mini-stat-label::before {
    content: '';
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.75;
    filter: grayscale(1) brightness(1.05);
}

.vapma-md-media-mini-stat.views .vapma-md-media-mini-stat-label::before {
    background-image: url('/wp-content/uploads/eye.svg');
}

.vapma-md-media-mini-stat.rox .vapma-md-media-mini-stat-label::before {
    background-image: url('/wp-content/uploads/cropped-rox-icon.png');
}

.vapma-md-media-mini-stat.linked .vapma-md-media-mini-stat-label::before {
    background-image: url('/wp-content/uploads/link.svg');
}

.vapma-md-media-mini-stat.saved .vapma-md-media-mini-stat-label::before {
    background-image: url('/wp-content/uploads/bookmark.svg');
}

@media (max-width: 980px) {
    .vapma-md-media-stats-strip {
        grid-template-columns: repeat(3, 34px);
        justify-content: start;
        gap: 6px;
    }
}

.vapma-md-media-grid a[data-media-type="video"]::before {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: #fff;
    background: rgba(0,0,0,0.6);
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
}

.vapma-md-media-mini-graph {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    width: 100%;
    height: 18px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-sizing: border-box;
}

.vapma-md-media-bar {
    display: block;
    flex: 1 1 0;
    min-height: 2px;
    border-radius: 0;
    background: #cf2e2e;
}