.stanloop-gallery,
.stanloop-gallery-manage {
    --stanloop-gallery-accent: var(--bb-primary-color, var(--buddyboss-theme-primary-color, #6d5dfc));
    --stanloop-gallery-border: rgba(15, 23, 42, 0.10);
    --stanloop-gallery-muted: #64748b;
    --stanloop-gallery-surface: #ffffff;
    margin: 22px 0;
}

.stanloop-gallery__header,
.stanloop-gallery-manage {
    background: linear-gradient(135deg, rgba(109, 93, 252, 0.09), rgba(14, 165, 233, 0.07));
    border: 1px solid var(--stanloop-gallery-border);
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
}

.stanloop-gallery__header {
    margin-bottom: 18px;
}

.stanloop-gallery__header h2,
.stanloop-gallery-manage h3 {
    margin: 0 0 8px;
    color: #0f172a;
    font-size: clamp(1.35rem, 2vw, 1.8rem);
    line-height: 1.15;
}

.stanloop-gallery__header p,
.stanloop-gallery-manage__intro,
.stanloop-field-help,
.stanloop-gallery-card__caption,
.stanloop-gallery-manage-row small {
    color: var(--stanloop-gallery-muted);
}

.stanloop-gallery__header p,
.stanloop-gallery-manage__intro {
    margin: 0;
    font-size: 0.98rem;
}

.stanloop-gallery__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.stanloop-gallery-card {
    margin: 0;
    min-width: 0;
}

.stanloop-gallery-card__thumb {
    position: relative;
    display: block;
    aspect-ratio: 4 / 5;
    border-radius: 18px;
    overflow: hidden;
    background: #eef2ff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.10);
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.stanloop-gallery-card__thumb:hover,
.stanloop-gallery-card__thumb:focus-visible {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--stanloop-gallery-accent) 48%, transparent);
    box-shadow: 0 20px 34px rgba(15, 23, 42, 0.14);
}

.stanloop-gallery-card__thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.stanloop-gallery-card__thumb::after {
    content: "↗";
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.stanloop-gallery-card__thumb:hover::after,
.stanloop-gallery-card__thumb:focus-visible::after {
    opacity: 1;
    transform: translateY(0);
}

.stanloop-gallery-card__caption {
    margin: 8px 4px 0;
    font-size: 0.9rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.stanloop-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.stanloop-gallery-lightbox:target {
    display: flex;
}

.stanloop-gallery-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.78);
    backdrop-filter: blur(6px);
}

.stanloop-gallery-lightbox__dialog {
    position: relative;
    z-index: 1;
    max-width: min(96vw, 980px);
    max-height: 92vh;
    background: #0f172a;
    color: #fff;
    border-radius: 24px;
    padding: 14px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

.stanloop-gallery-lightbox__dialog img {
    display: block;
    max-width: 100%;
    max-height: 76vh;
    width: auto;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
    border-radius: 16px;
}

.stanloop-gallery-lightbox__dialog p {
    margin: 12px 6px 4px;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.96rem;
    line-height: 1.5;
}

.stanloop-gallery-lightbox__close {
    position: absolute;
    top: -12px;
    right: -12px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: #fff;
    color: #0f172a;
    text-decoration: none;
    font-size: 24px;
    line-height: 1;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.stanloop-gallery-form {
    margin-top: 16px;
}

.stanloop-gallery-form .stanloop-field {
    margin: 0 0 14px;
}

.stanloop-gallery-form label {
    display: block;
    font-weight: 700;
    color: #0f172a;
}

.stanloop-gallery-form input[type="text"],
.stanloop-gallery-form textarea,
.stanloop-gallery-form input[type="file"] {
    width: 100%;
    max-width: 680px;
    margin-top: 7px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 14px;
    padding: 11px 12px;
    background: #fff;
}

.stanloop-gallery-form textarea {
    resize: vertical;
}

.stanloop-field-help {
    display: block;
    margin-top: 6px;
    font-size: 0.88rem;
    line-height: 1.45;
}

.stanloop-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 0;
    background: var(--stanloop-gallery-accent);
    color: #fff !important;
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
}

.stanloop-button:hover,
.stanloop-button:focus-visible {
    color: #fff !important;
    filter: brightness(0.96);
}


.stanloop-button.is-uploading,
.stanloop-button:disabled {
    cursor: wait;
    opacity: 0.78;
    filter: grayscale(0.08);
}

.stanloop-gallery-upload-status {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    margin-left: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(109, 93, 252, 0.10);
    color: #4338ca;
    font-size: 0.9rem;
    font-weight: 700;
    vertical-align: middle;
}

.stanloop-gallery-upload-status[hidden] {
    display: none;
}

.stanloop-empty {
    margin: 16px 0 0;
    padding: 18px;
    border: 1px dashed rgba(15, 23, 42, 0.18);
    border-radius: 18px;
    color: var(--stanloop-gallery-muted);
    background: #fff;
}

.stanloop-notice {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 14px;
    font-weight: 700;
}

.stanloop-notice--success {
    color: #166534;
    background: #dcfce7;
    border: 1px solid #86efac;
}

.stanloop-notice--warning {
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
}

.stanloop-gallery-manage-list {
    margin-top: 24px;
}

.stanloop-gallery-manage-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid rgba(15, 23, 42, 0.10);
}

.stanloop-gallery-manage-row__image {
    flex: 0 0 58px;
    width: 58px;
    height: 58px;
    border-radius: 14px;
    overflow: hidden;
    background: #eef2ff;
}

.stanloop-gallery-manage-row__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.stanloop-gallery-manage-row__main {
    flex: 1 1 auto;
    min-width: 0;
}

.stanloop-gallery-manage-row__main strong,
.stanloop-gallery-manage-row__main small {
    display: block;
}

.stanloop-gallery-manage-row__main strong {
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stanloop-gallery-manage-row span a {
    color: #dc2626;
    font-weight: 800;
    text-decoration: none;
}

.stanloop-gallery-activity-image {
    display: block;
    margin-top: 10px;
    max-width: 420px;
    border-radius: 18px;
    overflow: hidden;
}

.stanloop-gallery-activity-image img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 18px;
}

@media (max-width: 900px) {
    .stanloop-gallery__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}

@media (max-width: 560px) {
    .stanloop-gallery__header,
    .stanloop-gallery-manage {
        border-radius: 18px;
        padding: 16px;
    }

    .stanloop-gallery__grid {
        gap: 10px;
    }

    .stanloop-gallery-card__thumb {
        border-radius: 14px;
    }

    .stanloop-gallery-lightbox {
        padding: 12px;
    }

    .stanloop-gallery-lightbox__dialog {
        border-radius: 18px;
        padding: 10px;
    }

    .stanloop-gallery-manage-row {
        align-items: flex-start;
    }
}
