/* Custom Slider Styles */
.custom-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.slider-container {
    position: relative;
    width: 100%;
}

.slider-track {
    display: flex;
    transition: transform 0.6s ease-in-out, opacity 0.6s ease-in-out;
    will-change: transform, opacity;
    opacity: 1;
}

.slider-track.is-fading {
    opacity: 0;
}

.slider-slide {
    width: 100%;
    flex-shrink: 0;
    position: relative;
}

.slider-slide img {
    width: 100%;
    display: block;
    cursor: pointer;
    user-select: none;
}

/* Navigation Buttons */
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: background 0.3s ease;
    opacity: 0;
}

.slider-btn[style*="display: none"] {
    display: none !important;
}

.custom-slider:hover .slider-btn {
    opacity: 1;
}

.slider-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

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

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

.slider-btn .material-icons {
    font-size: 24px;
}

/* Dots Indicator */
.slider-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 5;
    padding: 0 40px;
}

.slider-dots[style*="display: none"] {
    display: none !important;
}

.slider-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
    padding: 0;
}

.slider-dot:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.2);
}

.slider-dot.active {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.3);
}

/* Modal Styles (Fancybox-like) */
.slider-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.slider-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #FFFFFF;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    animation: zoomIn 0.3s ease;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.modal-image-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
}

.modal-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
}

.modal-image-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    height: 100%;
}

.modal-image-slide {
    width: 100%;
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.modal-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    display: block;
    width: 100%;
    height: 100%;
    transform-origin: center center;
    transition: transform 0.3s ease, opacity 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: none;
    -webkit-touch-callout: none;
    opacity: 0;
}

.modal-image[src] {
    opacity: 1;
}

.modal-image:not([src]) {
    background: #f0f0f0;
    min-height: 200px;
}

.modal-close {
    position: absolute;
    top: 13px;
    right: 20px;
    border: none;
    width: 30px;
    height: 30px;
    cursor: pointer;
    z-index: 10001;
}

.modal-close:hover {
    background: rgba(24, 24, 27, 0.3);
    transform: scale(1.1);
}

.modal-close .material-icons {
    font-size: 28px;
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(24, 24, 27, 0);
    border: none;
    color: rgba(255, 255, 255, 0.6);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.modal-nav:hover {
    background: rgba(24, 24, 27, 0.3);
    color: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.modal-nav .material-icons {
    font-size: 50px;
    width: 50px;
    height: 50px;
}

.modal-info {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
}

.modal-counter {
    font-weight: 500;
}

/* Thumbnails strip at bottom (Fancybox-like) */
.modal-thumbnails {
    z-index: 10001;
}

.thumbnails-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0;
    box-sizing: border-box;
    pointer-events: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.thumbnails-container::-webkit-scrollbar {
    height: 4px;
}

.thumbnails-container::-webkit-scrollbar-track {
    background: transparent;
}

.thumbnails-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.thumbnails-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.thumbnails-track {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    padding: 0 10px;
}

.thumbnail-item {
    flex-shrink: 0;
    height: 60px;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.3s ease, transform 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumbnail-item:hover {
    border: 2px solid #1570EF;
}

.thumbnail-item.active {
    border: 2px solid #1570EF;
    opacity: 1;
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    margin: 0 auto;
    transition: width 0.3s ease;
}

.thumbnail-item.active img {
    width: 100%;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

.slider-modal.closing .modal-backdrop {
    animation: fadeOut 0.3s ease;
}

.slider-modal.closing .modal-content {
    animation: zoomOut 0.3s ease;
}

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

/* Rotate modal to landscape for carousel/h images */
.slider-modal.rotate-landscape {
    transform: rotate(90deg);
    transform-origin: center center;
    width: 100vh;
    height: 100vw;
    top: 50%;
    left: 50%;
    margin-top: -50vw;
    margin-left: -50vh;
}

.slider-modal.rotate-landscape .modal-content {
    max-width: 100vh;
    max-height: 100vw;
    width: 100vh;
    height: 100vw;
    display: flex;
    flex-direction: row;
}

.slider-modal.rotate-landscape .modal-image-container {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.slider-modal.rotate-landscape .modal-image-wrapper {
    width: 100%;
    height: 100%;
}

.slider-modal.rotate-landscape .modal-image {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.slider-modal.rotate-landscape .modal-thumbnails {
    position: static;
    width: auto;
    max-height: 100%;
    height: 100%;
    flex-direction: column;
    padding: 0;
    margin: 0;
}

.slider-modal.rotate-landscape .thumbnails-container {
    width: auto;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
}

.slider-modal.rotate-landscape .thumbnails-track {
    flex-direction: column;
    gap: 20px;
    padding: 0;
}

.slider-modal.rotate-landscape .thumbnail-item {
    width: 120px;
    height: 90px;
    margin: 0;
}

.slider-modal.rotate-landscape .modal-close {
    transform: rotate(-90deg);
    top: 10px;
    right: 10px;
}

.slider-modal.rotate-landscape .modal-info {
    transform: translateX(-50%) rotate(-90deg);
    bottom: 20px;
}

/* Rotate modal 90deg left for vertical images on landscape screen */
.slider-modal.rotate-left-90 {
    transform: rotate(-90deg) !important;
    transform-origin: center center !important;
    width: 100vh !important;
    height: 100vw !important;
    top: 50% !important;
    left: 50% !important;
    margin-top: -50vw !important;
    margin-left: -50vh !important;
    transition: transform 1s ease 0.5s, width 1s ease 0.5s, height 1s ease 0.5s, top 1s ease 0.5s, left 1s ease 0.5s, margin-top 1s ease 0.5s, margin-left 1s ease 0.5s !important;
}

.slider-modal.rotate-left-90 .modal-content {
    max-width: 100vh;
    max-height: 100vw;
    width: 100vh;
    height: 100vw;
    display: flex;
    flex-direction: column;
}

.slider-modal.rotate-left-90 .modal-image-container {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.slider-modal.rotate-left-90 .modal-image-wrapper {
    width: 100%;
    height: 100%;
}

.slider-modal.rotate-left-90 .modal-image {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.slider-modal.rotate-left-90 .modal-thumbnails {
    position: static;
    width: auto;
    max-height: 100%;
    height: auto;
    flex-direction: row;
    background: #FFFFFF;
}

.slider-modal.rotate-left-90 .thumbnails-container {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 16px 10px;
}

.slider-modal.rotate-left-90 .thumbnails-track {
    flex-direction: row;
    gap: 20px;
    justify-content: center;
    align-items: center;
    padding: 0 10px;
}

.slider-modal.rotate-left-90 .thumbnail-item {
    height: 60px;
}

.slider-modal.rotate-left-90 .modal-close {
    transform: rotate(90deg);
    top: 10px;
    right: 10px;
}

.slider-modal.rotate-left-90 .modal-image-action {
    transform-origin: center center !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 55px !important;
}

.slider-modal.rotate-left-90 .modal-info {
    transform: translateX(-50%) rotate(90deg);
    bottom: 20px;
}

/* Rotate modal 90deg right for horizontal images on portrait screen */
.slider-modal.rotate-right-90 {
    transform: rotate(90deg) !important;
    transform-origin: center center !important;
    width: 100vh !important;
    height: 100vw !important;
    top: 50% !important;
    left: 50% !important;
    margin-top: -50vw !important;
    margin-left: -50vh !important;
    transition: transform 1s ease 0.5s, width 1s ease 0.5s, height 1s ease 0.5s, top 1s ease 0.5s, left 1s ease 0.5s, margin-top 1s ease 0.5s, margin-left 1s ease 0.5s !important;
}

.slider-modal.rotate-right-90 .modal-content {
    max-width: 100vh;
    max-height: 100vw;
    width: 100vh;
    height: 100vw;
    display: flex;
    flex-direction: column;
}

.slider-modal.rotate-right-90 .modal-image-container {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.slider-modal.rotate-right-90 .modal-image-wrapper {
    width: 100%;
    height: 100%;
}

.slider-modal.rotate-right-90 .modal-image {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.slider-modal.rotate-right-90 .modal-thumbnails {
    position: static;
    width: auto;
    max-height: 100%;
    height: auto;
    flex-direction: row;
    background: #FFFFFF;
}

.slider-modal.rotate-right-90 .thumbnails-container {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 16px 10px;
}

.slider-modal.rotate-right-90 .thumbnails-track {
    flex-direction: row;
    gap: 20px;
    justify-content: center;
    align-items: center;
    padding: 0 10px;
}

.slider-modal.rotate-right-90 .thumbnail-item {
    height: 60px;
}

.slider-modal.rotate-right-90 .modal-close {
    transform: rotate(-90deg);
    top: 10px;
    right: 10px;
}

.slider-modal.rotate-right-90 .modal-image-action {
    transform-origin: center center !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 55px !important;
}

.slider-modal.rotate-right-90 .modal-info {
    transform: translateX(-50%) rotate(-90deg);
    bottom: 20px;
}

/* Portrait mode for carousel/v images - vertical fullscreen with thumbnails at bottom */
.slider-modal.portrait-mode .modal-content {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.slider-modal.portrait-mode .modal-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 0;
    flex-direction: column;
}

.slider-modal.portrait-mode .modal-image-wrapper {
    width: 100%;
    height: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-modal.portrait-mode .modal-image {
    width: auto;
    height: auto;
    object-fit: contain;
}

.slider-modal.portrait-mode .modal-thumbnails {
    flex-direction: row;
    background: #FFFFFF;
}

.slider-modal.portrait-mode .thumbnails-container {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 16px 10px;
}

.slider-modal.portrait-mode .thumbnails-track {
    flex-direction: row;
    gap: 20px;
    justify-content: center;
    align-items: center;
    padding: 0 10px;
}

.slider-modal.portrait-mode .thumbnail-item {
    height: 60px;
}

.slider-modal.portrait-mode .modal-close {
    transform: none;
}

.slider-modal.portrait-mode .modal-info {
    transform: translateX(-50%);
    bottom: 100px; /* Above thumbnails */
}

/* Touch support */
.slider-track {
    touch-action: pan-y;
}

.relative {
    position: relative;
}

.modal-image-action {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 55px;
    background: rgba(0, 0, 0, 0.25);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    z-index: 10002;
}

/* Responsive */
@media (max-width: 600px) {
    .slider-btn {
        width: 35px;
        height: 35px;
    }
    
    .slider-btn .material-icons {
        font-size: 20px;
    }
    
    .modal-nav {
        width: 40px;
        height: 40px;
    }
    
    .modal-nav .material-icons {
        font-size: 40px;
        width: 40px;
        height: 40px;
    }
}

