.awinto-gallery-popup {
    align-items: center;
    background: rgba(17, 24, 39, 0.62);
    inset: 0;
    justify-content: center;
    padding: 22px;
    position: fixed;
    z-index: 99999;
}

.awinto-gallery-popup:not(.hidden) {
    display: flex;
}

.awinto-gallery-popup.hidden {
    display: none;
}

.awinto-gallery-dialog {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.26);
    color: #111827;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 44px);
    max-width: 980px;
    overflow: hidden;
    width: min(100%, 980px);
}

.awinto-gallery-topbar {
    align-items: center;
    border-bottom: 1px solid #edf0f2;
    display: flex;
    justify-content: space-between;
    padding: 14px 18px;
}

.awinto-gallery-title {
    font-size: 16px;
    font-weight: 800;
}

.awinto-gallery-close {
    align-items: center;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    color: #111827;
    cursor: pointer;
    display: inline-flex;
    font-size: 28px;
    height: 38px;
    justify-content: center;
    line-height: 1;
    padding: 0 0 3px;
    width: 38px;
}

.awinto-gallery-tabs {
    background: #f8fafc;
    border-bottom: 1px solid #edf0f2;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 14px;
}

.awinto-gallery-tabs button {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    color: #4b5563;
    cursor: pointer;
    flex: 0 0 auto;
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    min-height: 38px;
    padding: 8px 14px;
}

.awinto-gallery-tabs button.is-active {
    background: #111827;
    border-color: #111827;
    color: #fff;
}

.awinto-gallery-body {
    align-items: center;
    background: #fff;
    display: grid;
    gap: 12px;
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    min-height: 420px;
    padding: 16px;
}

.awinto-gallery-stage {
    align-items: center;
    background: #fafafa;
    border: 1px solid #eef0f2;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    min-height: 390px;
    overflow: hidden;
}

.awinto-gallery-stage img,
.awinto-gallery-stage video {
    background: #fff;
    display: block;
    height: auto;
    max-height: 68vh;
    max-width: 100%;
    object-fit: contain;
    width: auto;
}

.awinto-gallery-stage video {
    width: 100%;
}

.awinto-gallery-stage iframe {
    aspect-ratio: 16 / 9;
    border: 0;
    display: block;
    max-height: 68vh;
    width: 100%;
}

.awinto-gallery-nav {
    align-items: center;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    color: #111827;
    cursor: pointer;
    display: inline-flex;
    font-size: 36px;
    height: 46px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    width: 46px;
}

.awinto-gallery-empty {
    color: #6b7280;
    display: none;
    font-size: 14px;
    padding: 0 18px 18px;
    text-align: center;
}

.awinto-gallery-popup.is-empty .awinto-gallery-empty {
    display: block;
}

.awinto-gallery-popup.is-empty .awinto-gallery-body,
.awinto-gallery-popup.is-empty .awinto-gallery-thumbs {
    display: none;
}

.awinto-gallery-thumbs {
    border-top: 1px solid #edf0f2;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 12px 16px 16px;
}

.awinto-gallery-thumb {
    align-items: center;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 72px;
    height: 72px;
    justify-content: center;
    overflow: hidden;
    padding: 0;
}

.awinto-gallery-thumb.is-active {
    border-color: #111827;
}

.awinto-gallery-thumb img {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.awinto-gallery-thumb span {
    color: #374151;
    font-size: 12px;
    font-weight: 800;
}

@media (max-width: 640px) {
    .awinto-gallery-popup {
        padding: 10px;
    }

    .awinto-gallery-dialog {
        border-radius: 12px;
        max-height: calc(100vh - 20px);
    }

    .awinto-gallery-body {
        gap: 8px;
        grid-template-columns: 38px minmax(0, 1fr) 38px;
        min-height: 330px;
        padding: 10px;
    }

    .awinto-gallery-stage {
        min-height: 310px;
    }

    .awinto-gallery-nav {
        font-size: 30px;
        height: 38px;
        width: 38px;
    }
}
