/* Property Gallery Styles */

.property-gallery {
      background: var(--white);
      max-width: 100%;
      border-radius: var(--radius-2xl);
      overflow: hidden;
      box-shadow: var(--shadow-lg);
      margin-bottom: var(--space-8);
}

/* Main Image */
.main-image {
      position: relative;
      aspect-ratio: 16/10;
      overflow: hidden;
      background: var(--gray-100);
}

.main-image img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      transition: var(--transition-slow);
      cursor: zoom-in;
}

.main-image:hover img {
      transform: scale(1.05);
}

/* Image Counter Badge */
.image-counter {
      position: absolute;
      top: 1rem;
      right: 1rem;
      background: rgba(0, 0, 0, 0.7);
      color: var(--white);
      padding: 0.5rem 1rem;
      border-radius: var(--radius-full);
      font-size: var(--font-size-sm);
      font-weight: 600;
      -webkit-backdrop-filter: blur(10px);
      backdrop-filter: blur(10px);
      z-index: 2;
}

/* Fullscreen Button */
.fullscreen-btn {
      position: absolute;
      bottom: 1rem;
      right: 1rem;
      background: rgba(0, 0, 0, 0.7);
      color: var(--white);
      border: none;
      padding: 0.75rem;
      border-radius: var(--radius-full);
      cursor: pointer;
      transition: var(--transition);
      -webkit-backdrop-filter: blur(10px);
      backdrop-filter: blur(10px);
      z-index: 2;
}

.fullscreen-btn:hover {
      background: rgba(0, 0, 0, 0.9);
      transform: scale(1.1);
}

/* Thumbnails */
.image-thumbnails {
      display: flex;
      gap: 0.75rem;
      padding: 1rem;
      background: var(--gray-50);
      overflow-x: auto;
      scrollbar-width: thin;
      scrollbar-color: var(--primary) var(--gray-200);
}

.image-thumbnails::-webkit-scrollbar {
      height: 6px;
}

.image-thumbnails::-webkit-scrollbar-track {
      background: var(--gray-200);
      border-radius: var(--radius-full);
}

.image-thumbnails::-webkit-scrollbar-thumb {
      background: var(--primary);
      border-radius: var(--radius-full);
}

.thumbnail {
      flex-shrink: 0;
      width: 80px;
      height: 60px;
      border-radius: var(--radius-md);
      overflow: hidden;
      cursor: pointer;
      border: 3px solid transparent;
      transition: var(--transition);
      position: relative;
}

.thumbnail.active {
      border-color: var(--primary);
      box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.3);
}

.thumbnail:hover {
      border-color: var(--primary-light);
      transform: translateY(-2px);
}

.thumbnail img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      transition: var(--transition);
}

.thumbnail:hover img {
      transform: scale(1.1);
}

/* Lightbox Modal */
.lightbox {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      display: none;
      justify-content: center;
      align-items: center;
      z-index: 9999;
      -webkit-backdrop-filter: blur(5px);
      backdrop-filter: blur(5px);
}

.lightbox.active {
      display: flex;
}

.lightbox-content {
      position: relative;
      max-width: 90vw;
      max-height: 90vh;
      background: var(--white);
      border-radius: var(--radius-xl);
      overflow: hidden;
      box-shadow: var(--shadow-2xl);
}

.lightbox img {
      width: 100%;
      height: auto;
      max-height: 85vh;
      object-fit: contain;
      display: block;
}

.lightbox-header {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
      padding: 1rem 1.5rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
      z-index: 3;
}

.lightbox-counter {
      color: var(--white);
      font-weight: 600;
      font-size: var(--font-size-sm);
}

.lightbox-close {
      background: none;
      border: none;
      color: var(--white);
      font-size: 1.5rem;
      cursor: pointer;
      padding: 0.5rem;
      border-radius: var(--radius-full);
      transition: var(--transition);
}

.lightbox-close:hover {
      background: rgba(255, 255, 255, 0.2);
      transform: rotate(90deg);
}

/* Navigation Arrows */
.lightbox-nav {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      background: rgba(0, 0, 0, 0.7);
      color: var(--white);
      border: none;
      padding: 1rem;
      cursor: pointer;
      font-size: 1.25rem;
      transition: var(--transition);
      -webkit-backdrop-filter: blur(10px);
      backdrop-filter: blur(10px);
      z-index: 3;
}

.lightbox-nav:hover {
      background: rgba(0, 0, 0, 0.9);
      transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
      left: 1rem;
      border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.lightbox-next {
      right: 1rem;
      border-radius: var(--radius-full) 0 0 var(--radius-full);
}

/* Lightbox Thumbnails */
.lightbox-thumbnails {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
      padding: 1rem;
      z-index: 3;
}

.lightbox-thumb-container {
      display: flex;
      gap: 0.5rem;
      justify-content: center;
      overflow-x: auto;
      padding: 0.5rem 0;
}

.lightbox-thumb {
      flex-shrink: 0;
      width: 60px;
      height: 45px;
      border-radius: var(--radius-md);
      overflow: hidden;
      cursor: pointer;
      border: 2px solid transparent;
      transition: var(--transition);
      opacity: 0.7;
}

.lightbox-thumb.active {
      border-color: var(--white);
      opacity: 1;
}

.lightbox-thumb:hover {
      opacity: 1;
      transform: scale(1.05);
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
      .image-thumbnails {
            padding: 0.75rem;
            gap: 0.5rem;
      }

      .thumbnail {
            width: 60px;
            height: 45px;
      }

      .lightbox-content {
            max-width: 95vw;
            max-height: 95vh;
            border-radius: var(--radius-lg);
      }

      .lightbox-nav {
            padding: 0.75rem;
            font-size: 1rem;
      }

      .lightbox-thumbnails {
            display: none;
            /* ซ่อนใน mobile */
      }

      .image-counter,
      .fullscreen-btn {
            transform: scale(0.9);
      }
}

/* Loading Animation */
.image-loading {
      position: relative;
      background: var(--gray-100);
}

.image-loading::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 40px;
      height: 40px;
      border: 3px solid var(--gray-300);
      border-top: 3px solid var(--primary);
      border-radius: 50%;
      animation: spin 1s linear infinite;
}

@keyframes spin {
      0% {
            transform: translate(-50%, -50%) rotate(0deg);
      }

      100% {
            transform: translate(-50%, -50%) rotate(360deg);
      }
}

/* Smooth Transitions */
.property-gallery * {
      transition: var(--transition);
}

.lightbox * {
      transition: var(--transition);
}