/**
 * Custom styles for Shared Google Photos Gallery
 */

.shared-google-photos {
    width: 100%;
    height: 100%;
    background: #fff;
}

.shared-google-photos .swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}

.shared-google-photos .swiper-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    width: auto;
    height: auto;
}

/* Cover mode - fill container, may crop */
.shared-google-photos[data-mediaitems-cover="true"] .swiper-slide img {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* Stretch mode - fill container, may distort */
.shared-google-photos[data-mediaitems-stretch="true"] .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: fill;
}

/* Navigation buttons */
.shared-google-photos .swiper-button-next,
.shared-google-photos .swiper-button-prev {
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.shared-google-photos .swiper-button-next:after,
.shared-google-photos .swiper-button-prev:after {
    font-size: 20px;
}

.shared-google-photos .swiper-button-next:hover,
.shared-google-photos .swiper-button-prev:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* External link button */
.shared-google-photos .swiper-button-external-link {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.shared-google-photos .swiper-button-external-link:hover {
    background: rgba(0, 0, 0, 0.7);
}

.shared-google-photos .swiper-button-external-link:after {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Fullscreen button */
.shared-google-photos .swiper-button-fullscreen {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shared-google-photos .swiper-button-fullscreen:hover {
    background: rgba(0, 0, 0, 0.7);
}

.shared-google-photos .swiper-button-fullscreen:after {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* When in fullscreen, show exit fullscreen icon */
.shared-google-photos:fullscreen .swiper-button-fullscreen:after,
.shared-google-photos:-webkit-full-screen .swiper-button-fullscreen:after,
.shared-google-photos:-moz-full-screen .swiper-button-fullscreen:after,
.shared-google-photos:-ms-fullscreen .swiper-button-fullscreen:after {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/></svg>');
}

/* Fullscreen mode styling */
.shared-google-photos:fullscreen,
.shared-google-photos:-webkit-full-screen,
.shared-google-photos:-moz-full-screen,
.shared-google-photos:-ms-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw;
    max-height: 100vh;
    background: #000;
}

/* Album title */
.shared-google-photos .swiper-album-title {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    z-index: 10;
    max-width: 80%;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Pagination */
.shared-google-photos .swiper-pagination {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    padding: 4px 16px;
    border-radius: 20px;
    display: inline-block;
    left: 10px;
    right: 10px;
    margin: 0 auto;
    max-width: max-content;
    width: auto;
    font-size: 14px;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Loading state */
.shared-google-photos .swiper-lazy-loading {
    opacity: 0.5;
}

/* Progressive image loading */
.shared-google-photos .sgp-progressive-image {
    transition: opacity 0.3s ease-in-out;
}

.shared-google-photos .sgp-progressive-image.sgp-full-loaded {
    opacity: 1;
}

/* Custom background color support */
.shared-google-photos[data-background-color] {
    background-color: var(--gallery-bg-color);
}

/* Carousel mode specific styles */
.shared-google-photos[data-mode="carousel"] .swiper-slide {
    width: auto;
    height: auto;
}

.shared-google-photos[data-mode="carousel"] .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Carousel mode - adjust image sizing */
.shared-google-photos[data-mode="carousel"] .swiper-zoom-container {
    width: 100%;
    height: 100%;
}

/* Disable zoom cursor in carousel mode */
.shared-google-photos[data-mode="carousel"] .swiper-slide {
    cursor: default;
}

/* Full screen navigation - cursor feedback and mobile tap highlight removal (only in fullscreen) */
.shared-google-photos:fullscreen[data-full-screen-navigation="single-click"] .swiper-slide,
.shared-google-photos:fullscreen[data-full-screen-navigation="double-click"] .swiper-slide,
.shared-google-photos:-webkit-full-screen[data-full-screen-navigation="single-click"] .swiper-slide,
.shared-google-photos:-webkit-full-screen[data-full-screen-navigation="double-click"] .swiper-slide,
.shared-google-photos:-moz-full-screen[data-full-screen-navigation="single-click"] .swiper-slide,
.shared-google-photos:-moz-full-screen[data-full-screen-navigation="double-click"] .swiper-slide,
.shared-google-photos:-ms-fullscreen[data-full-screen-navigation="single-click"] .swiper-slide,
.shared-google-photos:-ms-fullscreen[data-full-screen-navigation="double-click"] .swiper-slide {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Left half cursor (previous) - only in fullscreen */
.shared-google-photos:fullscreen[data-full-screen-navigation="single-click"] .swiper-slide:hover,
.shared-google-photos:fullscreen[data-full-screen-navigation="double-click"] .swiper-slide:hover,
.shared-google-photos:-webkit-full-screen[data-full-screen-navigation="single-click"] .swiper-slide:hover,
.shared-google-photos:-webkit-full-screen[data-full-screen-navigation="double-click"] .swiper-slide:hover,
.shared-google-photos:-moz-full-screen[data-full-screen-navigation="single-click"] .swiper-slide:hover,
.shared-google-photos:-moz-full-screen[data-full-screen-navigation="double-click"] .swiper-slide:hover,
.shared-google-photos:-ms-fullscreen[data-full-screen-navigation="single-click"] .swiper-slide:hover,
.shared-google-photos:-ms-fullscreen[data-full-screen-navigation="double-click"] .swiper-slide:hover {
    cursor: w-resize;
}

/* Right half cursor (next) - using pseudo-element trick - only in fullscreen */
.shared-google-photos:fullscreen[data-full-screen-navigation="single-click"] .swiper-slide::after,
.shared-google-photos:fullscreen[data-full-screen-navigation="double-click"] .swiper-slide::after,
.shared-google-photos:-webkit-full-screen[data-full-screen-navigation="single-click"] .swiper-slide::after,
.shared-google-photos:-webkit-full-screen[data-full-screen-navigation="double-click"] .swiper-slide::after,
.shared-google-photos:-moz-full-screen[data-full-screen-navigation="single-click"] .swiper-slide::after,
.shared-google-photos:-moz-full-screen[data-full-screen-navigation="double-click"] .swiper-slide::after,
.shared-google-photos:-ms-fullscreen[data-full-screen-navigation="single-click"] .swiper-slide::after,
.shared-google-photos:-ms-fullscreen[data-full-screen-navigation="double-click"] .swiper-slide::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    cursor: e-resize;
}

/* Gesture hints overlay */
.sgp-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    text-align: center;
    max-width: 90%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.sgp-hint-visible {
    opacity: 1;
}
