.media-modal {
    display: none;
    z-index: 10003;
}

.media-modal.is-open {
    display: flex;
}

.media-modal__box {
    background:
        radial-gradient(circle at top left, rgba(212, 175, 55, 0.10), transparent 34%),
        linear-gradient(180deg, #f8f6f0, #eef1f5);
    max-width: min(1820px, 96vw);
    padding: clamp(18px, 2vw, 34px);
    width: min(1820px, 96vw);
}

.media-hero {
    align-items: flex-start;
    background:
        linear-gradient(135deg, rgba(32, 36, 44, 0.98), rgba(19, 22, 29, 0.96)),
        var(--admin-primary);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 28px;
    box-shadow: 0 22px 45px rgba(24, 27, 34, 0.18);
    color: #fff;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: clamp(22px, 3vw, 34px);
}

.media-hero .admin-modal-title {
    color: #fff;
    margin-bottom: 8px;
}

.media-hero .admin-modal-subtitle {
    color: rgba(255, 255, 255, 0.68);
    margin: 0;
    max-width: 760px;
}

.media-hero__eyebrow,
.media-action-icon {
    color: var(--admin-secondary);
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.media-stats {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(90px, 1fr));
    min-width: min(440px, 100%);
}

.media-stat {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 18px;
    padding: 14px;
}

.media-stat strong,
.media-stat span {
    display: block;
}

.media-stat strong {
    color: #fff;
    font-size: clamp(1.2rem, 2vw, 1.75rem);
    line-height: 1;
}

.media-stat span {
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.74rem;
    margin-top: 6px;
}

.media-command-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(320px, 1.6fr) minmax(260px, 0.8fr);
    margin-bottom: 18px;
}

.media-upload-card,
.media-boost-card {
    background: #fff;
    border: 1px solid rgba(32, 36, 44, 0.08);
    border-radius: 24px;
    box-shadow: 0 16px 36px rgba(32, 36, 44, 0.08);
    display: grid;
    gap: 14px;
    padding: clamp(18px, 2.3vw, 28px);
}

.media-boost-card {
    background: linear-gradient(135deg, #2c303a, #1a1d24);
    border-color: rgba(212, 175, 55, 0.30);
    color: #fff;
    align-content: center;
}

.media-boost-card h3 {
    color: var(--admin-secondary);
    font-size: clamp(1.2rem, 2vw, 1.65rem);
    margin: 0;
}

.media-boost-card p {
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.92rem;
    line-height: 1.4;
    margin: 0;
}

.media-dropzone {
    align-items: center;
    background:
        radial-gradient(circle at top left, rgba(212, 175, 55, 0.13), transparent 34%),
        #fffaf0;
    border: 2px dashed rgba(212, 175, 55, 0.65);
    border-radius: 20px;
    cursor: pointer;
    display: grid;
    min-height: 170px;
    padding: clamp(18px, 2vw, 26px);
    position: relative;
    text-align: center;
    transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.media-dropzone:hover {
    background: #fff7df;
    border-color: var(--admin-primary);
    transform: translateY(-1px);
}

.media-dropzone strong,
.media-dropzone small,
.media-dropzone em {
    display: block;
}

.media-dropzone strong {
    color: var(--admin-primary);
    font-size: clamp(1.15rem, 2vw, 1.55rem);
}

.media-dropzone small {
    color: #68717d;
    line-height: 1.45;
    margin: 8px auto 14px;
    max-width: 520px;
}

.media-dropzone em {
    background: rgba(32, 36, 44, 0.08);
    border-radius: 999px;
    color: var(--admin-primary);
    font-style: normal;
    font-weight: 800;
    justify-self: center;
    padding: 9px 15px;
}

.media-file-input {
    height: 1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    width: 1px;
}

.media-btn {
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 11px 18px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.media-btn:hover {
    transform: translateY(-1px);
}

.media-btn--success {
    background: var(--admin-success);
    box-shadow: 0 4px 10px rgba(40, 167, 69, 0.3);
    color: #fff;
    justify-self: end;
}

.media-btn--gold {
    background: var(--admin-secondary);
    color: #1a1d24;
}

.media-btn--danger {
    background: var(--admin-danger);
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3);
    color: #fff;
}

.media-btn--ghost {
    background: rgba(32, 36, 44, 0.06);
    color: #4b5563;
}

.media-hidden-form {
    display: none;
}

.media-gallery-toolbar {
    align-items: center;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(32, 36, 44, 0.08);
    border-radius: 22px;
    box-shadow: 0 14px 30px rgba(32, 36, 44, 0.07);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 16px 18px;
    position: sticky;
    top: 10px;
    z-index: 3;
}

.media-gallery-toolbar h3 {
    color: var(--admin-primary);
    font-size: 1.25rem;
    margin: 0;
}

.media-gallery-toolbar p {
    color: #68717d;
    font-size: 0.82rem;
    margin: 3px 0 0;
}

.media-gallery-toolbar__actions {
    align-items: center;
    display: flex;
    gap: 10px;
}

.media-sort-select {
    background: #f9fafb;
    border: 1px solid #ccc;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.9rem;
    outline: none;
    padding: 8px 12px;
}

.media-grid {
    display: grid;
    gap: clamp(12px, 1.2vw, 22px);
    grid-template-columns: repeat(auto-fill, minmax(clamp(160px, 13vw, 250px), 1fr));
}

.media-card {
    background: #fff;
    border: 1px solid rgba(32, 36, 44, 0.08);
    border-radius: 22px;
    box-shadow: 0 12px 30px rgba(32, 36, 44, 0.08);
    overflow: hidden;
    position: relative;
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.media-card:hover {
    border-color: rgba(212, 175, 55, 0.45);
    box-shadow: 0 18px 38px rgba(32, 36, 44, 0.13);
    transform: translateY(-3px);
}

.media-card.is-selected {
    border-color: var(--admin-danger);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.13), 0 18px 38px rgba(32, 36, 44, 0.13);
}

.media-card__check {
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 999px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.13);
    color: #4b5563;
    display: flex;
    gap: 5px;
    justify-content: center;
    left: 10px;
    padding: 6px 9px;
    position: absolute;
    top: 10px;
    z-index: 2;
}

.media-card__check span {
    font-size: 0.68rem;
    font-weight: 800;
}

.media-card__check input {
    accent-color: var(--admin-danger);
    cursor: pointer;
    height: 16px;
    width: 16px;
}

.media-card__preview {
    align-items: center;
    background: #f4f4f4;
    display: flex;
    aspect-ratio: 4 / 3;
    height: auto;
    justify-content: center;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.media-card__preview img {
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
    width: 100%;
}

.media-card:hover .media-card__preview img {
    transform: scale(1.05);
}

.media-card__format {
    background: rgba(32, 36, 44, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    bottom: 10px;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    padding: 5px 8px;
    position: absolute;
    right: 10px;
}

.media-card__body {
    padding: 13px;
}

.media-card__name {
    color: var(--admin-primary);
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-card__meta {
    color: #76808d;
    display: flex;
    flex-wrap: wrap;
    font-size: 0.7rem;
    gap: 6px;
    margin: -3px 0 10px;
}

.media-card__meta span {
    background: #f2f4f7;
    border-radius: 999px;
    padding: 4px 7px;
}

.media-card__actions {
    display: flex;
    gap: 6px;
}

.media-card__btn {
    background: #f4f6f8;
    border: 1px solid #e2e6ea;
    border-radius: 999px;
    color: #555;
    cursor: pointer;
    flex: 1;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 6px;
}

.media-card__btn:hover {
    background: #e9ecef;
    color: var(--admin-primary);
}

.media-card__btn--path {
    background: #fffbf0;
    border-color: #f5e6cc;
    color: var(--admin-secondary);
}

.media-card__btn--path:hover {
    background: #fcf3d9;
}

.media-empty {
    background: rgba(255, 255, 255, 0.86);
    border: 1px dashed rgba(32, 36, 44, 0.18);
    border-radius: 22px;
    color: #68717d;
    grid-column: 1 / -1;
    padding: 34px;
    text-align: center;
}

.media-empty strong,
.media-empty span {
    display: block;
}

.media-empty strong {
    color: var(--admin-primary);
    font-size: 1.2rem;
    margin-bottom: 6px;
}

@media (min-width: 1600px) {
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    }
}

@media (max-width: 980px) {
    .media-hero,
    .media-command-grid {
        grid-template-columns: 1fr;
    }

    .media-hero {
        display: grid;
    }

    .media-stats {
        grid-template-columns: repeat(3, 1fr);
        min-width: 0;
    }
}

@media (max-width: 720px) {
    .media-modal__box {
        border-radius: 18px;
        max-height: calc(100dvh - 22px);
        width: calc(100vw - 14px);
    }

    .media-hero {
        border-radius: 22px;
        padding: 20px;
    }

    .media-stats {
        grid-template-columns: 1fr;
    }

    .media-command-grid {
        gap: 12px;
    }

    .media-gallery-toolbar {
        position: static;
    }

    .media-gallery-toolbar__actions {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .media-sort-select,
    .media-btn {
        width: 100%;
    }

    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    }

    .media-card__actions {
        flex-direction: column;
    }
}
