/**
 * Service Image Gallery Styles
 * Styles สำหรับ image gallery/slider ในหน้า service detail
 */

.service-image-gallery-container {
    position: relative;
    width: 100%;
}

/* Main Image Display */
.gallery-main-image {
    position: relative;
    width: 100%;
    max-width: 536px;
    margin: 0 auto;
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3);
}

.main-image-wrapper {
    position: relative;
    width: 100%;
    height: 402px;
    overflow: hidden;
}

.main-gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.main-gallery-image:hover {
    transform: scale(1.02);
}

/* Gallery Navigation */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #333;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.gallery-nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.gallery-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.gallery-prev {
    left: 20px;
}

.gallery-next {
    right: 20px;
}

.gallery-nav i {
    font-size: 24px;
}

/* Image Counter */
.gallery-counter {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    z-index: 10;
    backdrop-filter: blur(10px);
}

/* Thumbnail Gallery */
.gallery-thumbnails {
    margin-top: 20px;
    overflow: hidden;
}

.thumbnails-wrapper {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.thumbnails-wrapper::-webkit-scrollbar {
    height: 6px;
}

.thumbnails-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.thumbnails-wrapper::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
}

.thumbnail-item {
    position: relative;
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.thumbnail-item:hover img {
    transform: scale(1.1);
}

.thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.thumbnail-item:hover .thumbnail-overlay {
    opacity: 1;
}

.thumbnail-item.active {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.thumbnail-item.active .thumbnail-overlay {
    opacity: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gallery-nav {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .gallery-prev {
        left: 10px;
    }
    
    .gallery-next {
        right: 10px;
    }
    
    .gallery-counter {
        bottom: 10px;
        right: 10px;
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .thumbnail-item {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    .gallery-nav {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .thumbnail-item {
        width: 70px;
        height: 70px;
    }
}

/* Animation Classes */
.gallery-fade-in {
    animation: galleryFadeIn 0.5s ease;
}

@keyframes galleryFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-slide-left {
    animation: gallerySlideLeft 0.5s ease;
}

@keyframes gallerySlideLeft {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.gallery-slide-right {
    animation: gallerySlideRight 0.5s ease;
}

@keyframes gallerySlideRight {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Loading State */
.gallery-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: gallerySpinner 0.8s linear infinite;
    z-index: 20;
}

@keyframes gallerySpinner {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Gallery Navigation Animations */
.main-gallery-image {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.price-card-floating .price-amount,
.price-card-floating .price-note {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.quality-badge {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.quality-badge span {
    transition: all 0.3s ease;
}

/* Thumbnail Hover Effects */
.thumbnail-item {
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.thumbnail-item:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.thumbnail-item.active {
    border: 3px solid #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

/* Gallery Navigation Button Animations */
.gallery-nav {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-nav:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

/* Price Card Animation */
.price-card-floating {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Quality Indicators Animation */
.quality-indicators {
    transition: opacity 0.3s ease;
}

/* Smooth transitions for all interactive elements */
.gallery-main-image * {
    transition: all 0.3s ease;
}

/* Loading state */
.main-gallery-image.loading {
    opacity: 0.5;
    filter: blur(5px);
}

/* Keyboard navigation focus styles */
.gallery-nav:focus {
    outline: 3px solid #667eea;
    outline-offset: 3px;
}

.thumbnail-item:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* Mobile touch feedback */
@media (hover: none) and (pointer: coarse) {
    .gallery-nav:active {
        background: rgba(102, 126, 234, 0.9);
        color: #fff;
    }
    
    .thumbnail-item:active {
        transform: scale(0.95);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gallery-main-image {
        max-width: 100%;
    }
    
    .main-image-wrapper {
        height: auto;
        aspect-ratio: 4 / 3;
    }
    
    .gallery-nav {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .gallery-prev {
        left: 10px;
    }
    
    .gallery-next {
        right: 10px;
    }
    
    .gallery-counter {
        bottom: 10px;
        right: 10px;
        padding: 6px 12px;
        font-size: 12px;
    }
}

@media (max-width: 576px) {
    .main-image-wrapper {
        height: auto;
        aspect-ratio: 4 / 3;
    }
}

/* Price Card Floating Styles */
.price-card-floating {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 10;
    min-width: 180px;
    max-width: 220px;
}

.price-card-content {
    position: relative;
    z-index: 2;
}

.price-label {
    font-size: 11px;
    color: #666;
    font-weight: 500;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.price-amount {
    font-size: 28px;
    font-weight: 700;
    color: #667eea;
    line-height: 1.2;
    margin-bottom: 6px;
}

.price-amount .currency {
    font-size: 16px;
    font-weight: 500;
    color: #888;
}

.price-note {
    font-size: 10px;
    color: #999;
    line-height: 1.3;
}

.price-card-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    border-radius: 16px;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.price-card-floating:hover .price-card-glow {
    opacity: 0.1;
}

/* Quality Indicators Styles */
.quality-indicators {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
}

.quality-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 8px 14px;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 12px;
    font-weight: 600;
    color: #333;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.quality-badge:hover {
    transform: translateX(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.quality-badge i {
    font-size: 14px;
}

.quality-badge.quality-1 {
    color: #f59e0b;
}

.quality-badge.quality-1 i {
    color: #f59e0b;
}

.quality-badge.quality-2 {
    color: #10b981;
}

.quality-badge.quality-2 i {
    color: #10b981;
}

.quality-badge.quality-3 {
    color: #3b82f6;
}

.quality-badge.quality-3 i {
    color: #3b82f6;
}

/* Background Effects */
.image-bg-effects {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 0;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    animation: float 20s ease-in-out infinite;
}

.circle-1 {
    width: 300px;
    height: 300px;
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.circle-2 {
    width: 200px;
    height: 200px;
    bottom: -50px;
    right: -50px;
    animation-delay: 5s;
}

.circle-3 {
    width: 150px;
    height: 150px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(20px, -20px) scale(1.1);
    }
    50% {
        transform: translate(-20px, 20px) scale(0.9);
    }
    75% {
        transform: translate(20px, 20px) scale(1.05);
    }
}

/* Responsive Styles */
@media (max-width: 768px) {
    .price-card-floating {
        bottom: 12px;
        left: 12px;
        padding: 12px 16px;
        min-width: 140px;
        max-width: 180px;
    }
    
    .price-label {
        font-size: 10px;
    }
    
    .price-amount {
        font-size: 22px;
    }
    
    .price-amount .currency {
        font-size: 13px;
    }
    
    .price-note {
        font-size: 9px;
    }
    
    .quality-indicators {
        top: 12px;
        right: 12px;
        gap: 8px;
    }
    
    .quality-badge {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .quality-badge i {
        font-size: 12px;
    }
}

@media (max-width: 576px) {
    .price-card-floating {
        bottom: 10px;
        left: 10px;
        padding: 10px 14px;
        min-width: 120px;
        max-width: 160px;
    }
    
    .price-label {
        font-size: 9px;
        margin-bottom: 3px;
    }
    
    .price-amount {
        font-size: 20px;
        margin-bottom: 4px;
    }
    
    .price-amount .currency {
        font-size: 12px;
    }
    
    .price-note {
        font-size: 8px;
    }
    
    .quality-indicators {
        top: 10px;
        right: 10px;
        gap: 6px;
    }
    
    .quality-badge {
        padding: 5px 8px;
        font-size: 10px;
    }
    
    .quality-badge i {
        font-size: 11px;
    }
    
    .quality-badge span {
        display: none; /* Hide text on very small screens, show only icons */
    }
}

/* Service Image Wrapper (No images fallback) */
.service-image-wrapper {
    position: relative;
    width: 100%;
    max-width: 536px;
    height: 402px;
    margin: 0 auto;
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3);
}

.service-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Ensure consistent sizing across all gallery components */
.service-image-gallery-container {
    max-width: 536px;
    margin: 0 auto;
}

/* Thumbnail Gallery Sizing */
.gallery-thumbnails {
    margin-top: 20px;
    width: 100%;
}

.thumbnails-wrapper {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.thumbnails-wrapper::-webkit-scrollbar {
    height: 6px;
}

.thumbnails-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.thumbnails-wrapper::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 3px;
}

.thumbnails-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.8);
}

.thumbnail-item {
    flex: 0 0 auto;
    width: 100px;
    height: 75px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.thumbnail-item:hover .thumbnail-overlay {
    opacity: 1;
}

.thumbnail-item.active .thumbnail-overlay {
    opacity: 0;
}

/* Responsive thumbnail sizing */
@media (max-width: 768px) {
    .service-image-gallery-container {
        max-width: 100%;
    }
    
    .service-image-wrapper {
        max-width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
    }
    
    .thumbnail-item {
        width: 80px;
        height: 60px;
    }
    
    .thumbnails-wrapper {
        gap: 8px;
    }
}

@media (max-width: 576px) {
    .thumbnail-item {
        width: 70px;
        height: 52px;
    }
}

/* Ensure Price Card and Quality Indicators stay within image bounds */
.main-image-wrapper {
    position: relative;
}

.main-image-wrapper .price-card-floating,
.main-image-wrapper .quality-indicators {
    position: absolute;
}

/* Prevent overflow on small containers */
.gallery-main-image {
    position: relative;
    overflow: visible; /* Allow floating elements to show */
}

/* Adjust positioning for better visual balance on 536x402 canvas */
.price-card-floating {
    /* Position relative to 536x402 container */
    max-width: calc(50% - 40px); /* Don't take more than half width */
}

.quality-indicators {
    /* Position relative to 536x402 container */
    max-width: 150px; /* Limit width to prevent overflow */
}

/* Animation for Price Card entrance */
@keyframes priceCardSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.price-card-floating {
    animation: priceCardSlideIn 0.5s ease-out 0.3s both;
}

/* Animation for Quality Indicators entrance */
@keyframes qualityBadgeSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.quality-badge {
    animation: qualityBadgeSlideIn 0.5s ease-out both;
}

.quality-badge:nth-child(1) {
    animation-delay: 0.4s;
}

.quality-badge:nth-child(2) {
    animation-delay: 0.5s;
}

.quality-badge:nth-child(3) {
    animation-delay: 0.6s;
}

/* Hover effects for better interactivity */
.price-card-floating:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
}

.quality-badge:hover {
    transform: translateX(-5px) scale(1.05);
}

/* Focus states for accessibility */
.price-card-floating:focus-within {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Ensure proper stacking context */
.main-image-wrapper {
    z-index: 1;
}

.price-card-floating {
    z-index: 10;
}

.quality-indicators {
    z-index: 10;
}

.gallery-nav {
    z-index: 15; /* Navigation buttons above everything */
}

.gallery-counter {
    z-index: 15; /* Counter above everything */
}

/* Smooth transitions for dynamic content updates */
.price-card-floating * {
    transition: all 0.3s ease;
}

.quality-badge * {
    transition: all 0.3s ease;
}

/* Print styles - hide floating elements when printing */
@media print {
    .price-card-floating,
    .quality-indicators,
    .gallery-nav,
    .gallery-counter {
        display: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .price-card-floating {
        background: rgba(255, 255, 255, 1);
        border: 2px solid #000;
    }
    
    .quality-badge {
        background: rgba(255, 255, 255, 1);
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .price-card-floating,
    .quality-badge {
        animation: none;
        transition: none;
    }
    
    .price-card-floating:hover,
    .quality-badge:hover {
        transform: none;
    }
}
