/**
 * Property Lightbox Styles
 * 
 * Modern lightbox component styles with smooth animations
 * and theme-consistent design
 * 
 * @package wbl
 */

/* ================================================================
   LIGHTBOX BASE
   ================================================================ */

.property-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-medium), visibility var(--transition-medium);
}

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

.property-lightbox:focus {
  outline: none;
}

/* Prevent body scroll when lightbox is open */
body.property-lightbox-open {
  overflow: hidden;
}

/* ================================================================
   OVERLAY
   ================================================================ */

.property-lightbox__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

/* ================================================================
   CONTAINER
   ================================================================ */

.property-lightbox__container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

/* ================================================================
   HEADER
   ================================================================ */

.property-lightbox__header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) var(--spacing-lg);
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
  z-index: 3;
}

.property-lightbox__counter {
  color: var(--color-white);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-medium);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.property-lightbox__counter .property-lightbox__separator {
  margin: 0 0.25em;
  opacity: 0.6;
}

.property-lightbox__actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

/* ================================================================
   ACTION BUTTONS
   ================================================================ */

.property-lightbox__action,
.property-lightbox__close {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-small);
  color: var(--color-white);
  cursor: pointer;
  transition: all var(--transition-fast);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.property-lightbox__action:hover,
.property-lightbox__close:hover {
  background-color: rgba(0, 0, 0, 0.9);
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.1);
}

.property-lightbox__action:active,
.property-lightbox__close:active {
  transform: scale(0.95);
}

.property-lightbox__action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.property-lightbox__action:disabled:hover {
  transform: none;
  background-color: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.2);
}

.property-lightbox__close {
  width: 52px;
  height: 52px;
  background-color: rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

/* ================================================================
   MAIN CONTENT
   ================================================================ */

.property-lightbox__content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--spacing-xl) + 60px) var(--spacing-lg) calc(var(--spacing-xl) + 120px);
  position: relative;
}

@media (max-width: 768px) {
  .property-lightbox__content {
    padding: calc(var(--spacing-xl) + 60px) var(--spacing-sm) calc(var(--spacing-xl) + 100px);
  }
}

/* ================================================================
   NAVIGATION BUTTONS
   ================================================================ */

.property-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: var(--color-white);
  cursor: pointer;
  transition: all var(--transition-fast);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 2;
}

.property-lightbox__nav--prev {
  left: var(--spacing-lg);
}

.property-lightbox__nav--next {
  right: var(--spacing-lg);
}

@media (max-width: 768px) {
  .property-lightbox__nav--prev {
    left: var(--spacing-sm);
  }
  
  .property-lightbox__nav--next {
    right: var(--spacing-sm);
  }
}

.property-lightbox__nav:hover {
  background-color: rgba(0, 0, 0, 0.8);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-50%) scale(1.1);
}

.property-lightbox__nav:active {
  transform: translateY(-50%) scale(0.95);
}

/* ================================================================
   IMAGE WRAPPER
   ================================================================ */

.property-lightbox__image-wrapper {
  position: relative;
  width: 90%;
  height: 90%;
  max-width: 1200px;
  max-height: 800px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .property-lightbox__image-wrapper {
    width: 95%;
    height: 80%;
  }
}

.property-lightbox__image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: zoom-in;
  transition: transform var(--transition-medium) ease-out;
  transform-origin: center center;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  border-radius: var(--radius-medium);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Smooth image appearance */
.property-lightbox--active .property-lightbox__image {
  animation: lightboxImageIn 0.4s ease-out;
}

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

/* ================================================================
   LOADER
   ================================================================ */

.property-lightbox__loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.property-lightbox__loader--active {
  opacity: 1;
  visibility: visible;
}

.property-lightbox__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--color-white);
  border-radius: 50%;
  animation: lightboxSpin 1s linear infinite;
}

@keyframes lightboxSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ================================================================
   CAPTION
   ================================================================ */

.property-lightbox__caption {
  position: absolute;
  bottom: calc(var(--spacing-xl) + 80px);
  left: var(--spacing-lg);
  right: var(--spacing-lg);
  text-align: center;
  color: var(--color-white);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-regular);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
  padding: var(--spacing-sm);
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-small);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-width: 600px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .property-lightbox__caption {
    bottom: calc(var(--spacing-lg) + 80px);
    font-size: var(--font-size-small);
  }
}

/* ================================================================
   THUMBNAILS
   ================================================================ */

.property-lightbox__thumbnails {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--spacing-md) var(--spacing-lg);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.property-lightbox__thumbnails::-webkit-scrollbar {
  height: 6px;
}

.property-lightbox__thumbnails::-webkit-scrollbar-track {
  background: transparent;
}

.property-lightbox__thumbnails::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

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

.property-lightbox__thumbnails-track {
  display: flex;
  gap: var(--spacing-xs);
  padding-bottom: var(--spacing-xs);
}

.property-lightbox__thumbnail {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border: 2px solid transparent;
  border-radius: var(--radius-small);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-fast);
  opacity: 0.6;
}

@media (min-width: 768px) {
  .property-lightbox__thumbnail {
    width: 80px;
    height: 80px;
  }
}

.property-lightbox__thumbnail:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

.property-lightbox__thumbnail--active {
  border-color: var(--color-white);
  opacity: 1;
}

.property-lightbox__thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ================================================================
   NOTIFICATION
   ================================================================ */

.property-lightbox__notification {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background-color: rgba(0, 0, 0, 0.8);
  color: var(--color-white);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-small);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-medium);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  z-index: 4;
}

.property-lightbox__notification--active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* ================================================================
   MOBILE OPTIMIZATIONS
   ================================================================ */

@media (max-width: 768px) {
  .property-lightbox__header {
    padding: var(--spacing-sm) var(--spacing-sm);
  }
  
  .property-lightbox__close {
    width: 48px;
    height: 48px;
  }
  
  .property-lightbox__nav {
    width: 44px;
    height: 44px;
  }
  
  .property-lightbox__thumbnails {
    padding: var(--spacing-sm);
  }
}

/* ================================================================
   RTL SUPPORT
   ================================================================ */

/* Since the site is RTL-only, apply RTL styles by default */
.property-lightbox__nav--prev {
  left: auto;
  right: var(--spacing-lg);
}

.property-lightbox__nav--next {
  right: auto;
  left: var(--spacing-lg);
}

@media (max-width: 768px) {
  .property-lightbox__nav--prev {
    right: var(--spacing-sm);
  }
  
  .property-lightbox__nav--next {
    left: var(--spacing-sm);
  }
}

/* Fix action buttons order for RTL */
.property-lightbox__actions {
  direction: ltr; /* Keep buttons in same visual order */
}

/* Ensure thumbnails scroll correctly in RTL */
.property-lightbox__thumbnails {
  direction: rtl;
}

.property-lightbox__thumbnails-track {
  direction: rtl;
}

/* ================================================================
   ACCESSIBILITY
   ================================================================ */

.property-lightbox__action:focus,
.property-lightbox__close:focus,
.property-lightbox__nav:focus,
.property-lightbox__thumbnail:focus {
  outline: 2px solid var(--color-white);
  outline-offset: 2px;
}

/* ================================================================
   SINGLE IMAGE MODE (for floorplans)
   ================================================================ */

.property-lightbox--single-image .property-lightbox__nav {
  display: none;
}

.property-lightbox--single-image .property-lightbox__thumbnails {
  display: none;
}

.property-lightbox--single-image .property-lightbox__counter {
  display: none;
}

/* ================================================================
   PRINT STYLES
   ================================================================ */

@media print {
  .property-lightbox {
    display: none !important;
  }
}