/* GM5 cabinet UI */
.pb-gm5-window main {
    width: min(1100px, 100%);
    margin: 0 auto;
}

.pb-gm5-toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin: 14px 0 16px;
}

.pb-gm5-toolbar .input-field {
    margin-bottom: 0;
}

.pb-gm5-status {
    display: none;
    margin: 10px 0 16px;
}

.pb-gm5-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.pb-gm5-card {
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pb-gm5-card-title {
    font-size: 22px;
    color: #fff;
    margin: 0;
    line-height: 1.1;
}

.pb-gm5-card-meta {
    color: rgba(255, 255, 255, 0.72);
    font-size: 16px;
}

.pb-gm5-card-progress {
    color: #ffd54f;
    font-size: 17px;
    margin: 0;
}

.pb-gm5-thumb-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.pb-gm5-thumb {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 10px;
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.pb-gm5-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.pb-gm5-card-actions .btn {
    margin: 0;
    min-width: 0;
}

.pb-gm5-card-delete {
    margin: 0;
    width: 100%;
}

.pb-gm5-file-input {
    display: none;
}

#user_questions_gm5_gallery_overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    background: rgba(0, 0, 0, 0.94);
}

#user_questions_gm5_gallery_overlay.pb-open {
    display: flex;
    flex-direction: column;
}

.pb-gm5-gallery-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: min(800px, calc(100% - 24px));
    margin: 0 auto;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.pb-gm5-gallery-title {
    color: #fff;
    font-size: 28px;
    margin: 0;
}

.pb-gm5-gallery-grid {
    flex: 1;
    min-height: 0;
    overflow: auto;
    width: min(800px, calc(100% - 24px));
    margin: 0 auto;
    padding: 14px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-content: flex-start;
    justify-content: flex-start;
}

.pb-gm5-gallery-item {
    position: relative;
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
    width: clamp(150px, 21vw, 185px);
    height: calc(clamp(150px, 21vw, 185px) * 1.5);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.35);
}

.pb-gm5-gallery-item.pb-selected {
    border-color: #ff8b8b;
    box-shadow: 0 0 0 2px rgba(255, 139, 139, 0.45) inset;
}

.pb-gm5-gallery-item img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pb-gm5-gallery-select {
    position: absolute;
    right: 6px;
    top: 6px;
    margin: 0;
    width: 32px;
    height: 32px;
    min-width: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.pb-gm5-gallery-item.pb-selected .pb-gm5-gallery-select {
    background: rgba(139, 0, 0, 0.85);
    border-color: rgba(255, 160, 160, 0.75);
}

.pb-gm5-gallery-empty {
    color: rgba(255, 255, 255, 0.72);
    text-align: center;
    padding: 24px;
}

@media (max-width: 768px) {
    .pb-gm5-toolbar {
        grid-template-columns: 1fr;
    }

    .pb-gm5-gallery-grid {
        gap: 8px;
        padding: 10px;
        width: min(800px, calc(100% - 20px));
    }

    .pb-gm5-gallery-item {
        width: clamp(128px, 28vw, 160px);
        height: calc(clamp(128px, 28vw, 160px) * 1.5);
    }

    .pb-gm5-gallery-title {
        font-size: 22px;
    }
}
