/* Santa Barbara Gallery - Frontend Styles */

:root {
    --sbg-primary-color: #737b4d;
    --sbg-secondary-color: #7d573d;
    --sbg-accent-color: #b68e69;
    --sbg-surface-color: #e8ddc7;
    --sbg-text-color: #7d573d;
    --sbg-text-light: #f8f3e8;
    --sbg-bg-overlay: rgba(0, 0, 0, 0.92);
    --sbg-border-radius: 12px;
    --sbg-transition-speed: 0.4s;
    --sbg-transition-ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --sbg-nav-size: 55px;
    --sbg-icon-size: 26px;
}

.santa-barbara-gallery {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: var(--sbg-border-radius);
    background: linear-gradient(180deg, #f2ead9 0%, var(--sbg-surface-color) 100%);
    box-shadow: 0 10px 34px rgba(125, 87, 61, 0.2);
    outline: none;
}

.santa-barbara-gallery:focus {
    box-shadow: 0 10px 34px rgba(125, 87, 61, 0.2), 0 0 0 3px var(--sbg-accent-color);
}

.santa-barbara-gallery.has-thumbnails {
    padding-bottom: 80px;
}

/* Wrapper & Track */
.sbg-wrapper {
    overflow: hidden;
    width: 100%;
}

.sbg-track {
    display: flex;
    transition: transform var(--sbg-transition-speed) var(--sbg-transition-ease);
    will-change: transform;
}

/* Slides */
.sbg-slide {
    flex: 0 0 100%;
    min-width: 100%;
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.sbg-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.5s var(--sbg-transition-ease);
    display: block;
}

@media (hover: hover) {
    .sbg-slide img:hover {
        transform: scale(1.05);
    }
}

.sbg-slide img:focus {
    outline: 3px solid var(--sbg-accent-color);
    outline-offset: 2px;
}

/* Navigation Buttons */
.sbg-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: var(--sbg-nav-size);
    height: var(--sbg-nav-size);
    border: none;
    border-radius: 50%;
    background: rgba(232, 221, 199, 0.95);
    color: var(--sbg-secondary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 22px rgba(125, 87, 61, 0.22);
    transition: all 0.3s ease;
    z-index: 10;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(182, 142, 105, 0.45);
}

.sbg-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--sbg-icon-size);
    height: var(--sbg-icon-size);
    line-height: 1;
}

.sbg-icon svg {
    width: var(--sbg-icon-size);
    height: var(--sbg-icon-size);
    display: block;
    pointer-events: none;
}

.sbg-btn:hover {
    background: var(--sbg-primary-color);
    color: var(--sbg-text-light);
    transform: translateY(-50%) scale(1.1);
    border-color: transparent;
}

.sbg-btn:focus {
    outline: 3px solid var(--sbg-accent-color);
    outline-offset: 2px;
}

.sbg-btn:active {
    transform: translateY(-50%) scale(1.02);
}

.sbg-btn-prev {
    left: 20px;
}

.sbg-btn-next {
    right: 20px;
}

.sbg-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Dots */
.sbg-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 1rem 0;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(125, 87, 61, 0.35));
}

.santa-barbara-gallery.has-thumbnails .sbg-dots {
    display: none;
}

.sbg-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(232, 221, 199, 0.9);
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.sbg-dot:hover {
    background: rgba(182, 142, 105, 0.55);
    transform: scale(1.2);
}

.sbg-dot.active {
    background: var(--sbg-primary-color);
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(115, 123, 77, 0.55);
}

.sbg-dot:focus {
    outline: 2px solid var(--sbg-accent-color);
    outline-offset: 2px;
}

/* Thumbnails */
.sbg-thumbnails {
    display: flex;
    gap: 8px;
    padding: 12px;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(125, 87, 61, 0.65));
    overflow-x: auto;
    scrollbar-width: none;
}

.sbg-thumbnails::-webkit-scrollbar {
    display: none;
}

.sbg-thumb {
    flex: 0 0 60px;
    height: 45px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

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

.sbg-thumb:hover {
    opacity: 0.9;
}

.sbg-thumb.active {
    opacity: 1;
    border-color: var(--sbg-surface-color);
    box-shadow: 0 0 8px rgba(232, 221, 199, 0.5);
}

.sbg-thumb:focus {
    outline: 2px solid var(--sbg-accent-color);
    outline-offset: 2px;
}

/* Lightbox */
.sbg-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--sbg-bg-overlay);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(8px);
}

.sbg-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.sbg-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    transform: scale(0.9);
    transition: transform 0.3s var(--sbg-transition-ease);
}

.sbg-lightbox.active .sbg-lightbox-content {
    transform: scale(1);
}

.sbg-lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: block;
}

.sbg-lightbox-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: rgba(232, 221, 199, 0.16);
    color: var(--sbg-surface-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(232, 221, 199, 0.35);
}

.sbg-lightbox-btn .sbg-icon {
    --sbg-icon-size: 28px;
}

.sbg-lightbox-btn:hover {
    background: var(--sbg-primary-color);
    border-color: var(--sbg-primary-color);
    transform: translateY(-50%) scale(1.1);
}

.sbg-lightbox-btn:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

.sbg-lightbox-btn-prev {
    left: -80px;
}

.sbg-lightbox-btn-next {
    right: -80px;
}

.sbg-lightbox-close {
    position: absolute;
    top: -60px;
    right: 0;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: rgba(232, 221, 199, 0.16);
    color: var(--sbg-surface-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(232, 221, 199, 0.35);
}

.sbg-lightbox-close .sbg-icon {
    --sbg-icon-size: 24px;
}

.sbg-lightbox-close:hover {
    background: var(--sbg-primary-color);
    transform: rotate(90deg);
}

.sbg-lightbox-close:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

.sbg-lightbox-counter {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(232, 221, 199, 0.92);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Entry Animations */
.santa-barbara-gallery.sbg-animation-fade {
    animation: sbgFadeIn 0.6s var(--sbg-transition-ease) forwards;
}

.santa-barbara-gallery.sbg-animation-slide-up {
    animation: sbgSlideUp 0.6s var(--sbg-transition-ease) forwards;
}

.santa-barbara-gallery.sbg-animation-scale {
    animation: sbgScale 0.6s var(--sbg-transition-ease) forwards;
}

@keyframes sbgFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes sbgSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes sbgScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Lazy Loading - Placeholder */
.sbg-slide img[data-src] {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.sbg-slide img.loaded {
    opacity: 1;
}

.sbg-slide img.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: sbgShimmer 1.5s infinite;
}

@keyframes sbgShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Empty Message */
.sbg-empty-message {
    text-align: center;
    padding: 2rem;
    color: var(--sbg-secondary-color);
    background: var(--sbg-surface-color);
    border-radius: 8px;
}

/* Responsive */
@media (max-width: 1024px) {
    .sbg-btn {
        width: 50px;
        height: 50px;
    }

    .sbg-btn .sbg-icon {
        --sbg-icon-size: 22px;
    }

    .sbg-btn-prev {
        left: 15px;
    }

    .sbg-btn-next {
        right: 15px;
    }

    .sbg-lightbox-btn-prev {
        left: 10px;
    }

    .sbg-lightbox-btn-next {
        right: 10px;
    }

    .sbg-lightbox-btn {
        width: 50px;
        height: 50px;
    }

    .sbg-lightbox-btn .sbg-icon {
        --sbg-icon-size: 24px;
    }
}

@media (max-width: 768px) {
    .santa-barbara-gallery {
        border-radius: 8px;
    }

    .sbg-slide {
        aspect-ratio: 4 / 3;
    }

    .sbg-btn {
        width: 44px;
        height: 44px;
        opacity: 0.9;
    }

    .sbg-btn .sbg-icon {
        --sbg-icon-size: 22px;
    }

    .sbg-btn-prev {
        left: 10px;
    }

    .sbg-btn-next {
        right: 10px;
    }

    .sbg-thumbnails {
        gap: 6px;
        padding: 10px;
    }

    .sbg-thumb {
        flex: 0 0 50px;
        height: 38px;
    }

    .sbg-lightbox-btn {
        width: 50px;
        height: 50px;
		padding: 10px;
    }

    .sbg-lightbox-btn .sbg-icon,
    .sbg-lightbox-close .sbg-icon {
        --sbg-icon-size: 22px;
    }

    .sbg-lightbox-btn-prev {
        left: 5px;
    }

    .sbg-lightbox-btn-next {
        right: 5px;
    }f

    .sbg-lightbox-close {
        top: -80px;
        width: 50px;
        height: 50px;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .sbg-slide {
        aspect-ratio: 1 / 1;
    }

    .sbg-btn {
        width: 50px;
        height: 50px;
		padding: 10px;
    }

    .sbg-btn-prev {
        left: 8px;
    }

    .sbg-btn-next {
        right: 8px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .sbg-track,
    .sbg-btn,
    .sbg-dot,
    .sbg-lightbox,
    .sbg-lightbox-content,
    .sbg-slide img,
    .santa-barbara-gallery {
        transition: none !important;
        animation: none !important;
    }
}

.santa-barbara-gallery {
    cursor: grab;
}

.santa-barbara-gallery:active {
    cursor: grabbing;
}
