/* assets/css/aisg-media-picker.css */
/* Custom modal styling for AISG Media Picker */

.aisg-media-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
}

    .aisg-media-modal.is-open {
        display: block;
    }

.aisg-media-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 14, 22, 0.55);
    backdrop-filter: saturate(120%) blur(4px);
}

.aisg-media-dialog {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(100vw, 980px);
    height: min(90vh, 760px);
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(28, 32, 44, 0.92), rgba(16, 18, 28, 0.92));
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.aisg-media-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
}

.aisg-media-title {
    font-weight: 700;
}

.aisg-media-close {
    appearance: none;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.85;
}

.aisg-media-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.aisg-media-tabs {
    display: flex;
    gap: 6px;
}

.aisg-tab {
    appearance: none;
    border: 0;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    border-radius: 10px;
    padding: 6px 10px;
    cursor: pointer;
}

    .aisg-tab.is-active {
        background: rgba(255, 255, 255, 0.14);
    }

.aisg-media-actions {
    display: flex;
    gap: 8px;
}

.aisg-search,
.aisg-orderby {
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    padding: 6px 8px;
}

.aisg-search {
    min-width: 220px;
}

.aisg-media-body {
    position: relative;
    flex: 1;
    overflow: auto;
    padding: 12px;
}

.aisg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.aisg-grid-empty {
    color: #cbd5e1;
    text-align: center;
    margin-top: 20px;
}

.aisg-card {
    position: relative;
    appearance: none;
    border: 0;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
}

.aisg-thumb {
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

    .aisg-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

.aisg-check {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border-radius: 999px;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    opacity: 0;
    transition: opacity 0.15s;
}

.aisg-card.is-selected .aisg-check {
    opacity: 1;
}

.aisg-media-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.aisg-confirm,
.aisg-load-more {
    appearance: none;
    border: 0;
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
}

.aisg-load-more {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.aisg-confirm {
    background: #4f46e5;
    color: #fff;
}

.aisg-media-modal.is-loading .aisg-media-body::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.15);
}

body.aisg-modal-open {
    overflow: hidden;
}

@media (max-width: 600px) {
    .aisg-media-dialog {
        width: 96vw;
        height: 92vh;
    }
}

/* Optional: avoid admin bar overlap */
@media (min-width: 783px) {
    .admin-bar .aisg-media-dialog {
        top: calc(50% + 16px);
    }
}
