/* ==================== MODAL ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xl);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.modal__content {
  position: relative;
  background: var(--color-background);
  border-radius: var(--radius-2xl);
  padding: var(--spacing-2xl);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-2xl);
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}

.modal.active .modal__content {
  transform: scale(1);
}

.modal__content--large {
  max-width: 900px;
}

.modal__close {
  position: absolute;
  top: var(--spacing-lg);
  right: var(--spacing-lg);
  width: 40px;
  height: 40px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: var(--font-size-lg);
  color: var(--color-text);
  transition: all var(--transition-fast);
}

.modal__close:hover {
  background: var(--color-error);
  color: white;
  border-color: var(--color-error);
  transform: rotate(90deg);
}

.modal__header {
  text-align: center;
  margin-bottom: var(--spacing-2xl);
}

.modal__icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-4xl);
  color: white;
  margin: 0 auto var(--spacing-lg);
}

.modal__title {
  font-size: var(--font-size-3xl);
  margin-bottom: 0;
}

.modal__body {
  margin-bottom: var(--spacing-2xl);
}

.modal__description {
  color: var(--color-text-secondary);
  line-height: 1.8;
  margin-bottom: var(--spacing-xl);
}

.modal__features h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--spacing-md);
}

.modal__features ul {
  list-style: none;
}

.modal__features li {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-sm);
  padding: var(--spacing-sm);
  background: var(--color-surface);
  border-radius: var(--radius-md);
}

.modal__features li i {
  color: var(--color-success);
}

.modal__gallery {
  margin-top: var(--spacing-xl);
}

.modal__gallery h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--spacing-md);
}

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--spacing-md);
}

.gallery__item {
  position: relative;
  padding-top: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.gallery__item:hover {
  transform: scale(1.05);
}

.gallery__item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal__custom-message {
  margin-top: var(--spacing-xl);
}

.modal__custom-message h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--spacing-md);
}

.modal__footer {
  display: flex;
  gap: var(--spacing-md);
  padding-top: var(--spacing-xl);
  border-top: 1px solid var(--color-border);
}

.modal__footer .btn {
  flex: 1;
}

/* Product Detail Modal */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-2xl);
}

.product-detail__image {
  position: relative;
  padding-top: 100%;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--color-surface);
}

.product-detail__image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-detail__info {
  display: flex;
  flex-direction: column;
}

.product-detail__title {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--spacing-md);
}

.product-detail__price {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.price__current {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  color: var(--color-primary);
}

.price__original {
  font-size: var(--font-size-xl);
  color: var(--color-text-secondary);
  text-decoration: line-through;
}

.product-detail__description {
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: var(--spacing-lg);
}

.product-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.meta__item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.meta__item i {
  color: var(--color-primary);
}

.product-detail__features h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--spacing-md);
}

.product-detail__features ul {
  list-style: none;
}

.product-detail__features li {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  color: var(--color-text-secondary);
}

.product-detail__features li::before {
  content: '✓';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--color-success);
  color: white;
  border-radius: 50%;
  font-size: var(--font-size-xs);
  font-weight: 700;
}

.product-detail__actions {
  margin-top: auto;
  padding-top: var(--spacing-lg);
}

/* ==================== RESPONSIVE ==================== */
@media screen and (max-width: 768px) {
  .modal__content {
    padding: var(--spacing-xl);
    max-height: 95vh;
  }

  .product-detail {
    grid-template-columns: 1fr;
  }

  .gallery__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal__footer {
    flex-direction: column;
  }
}

@media screen and (max-width: 576px) {
  .modal {
    padding: var(--spacing-md);
  }

  .modal__content {
    padding: var(--spacing-lg);
  }

  .modal__icon {
    width: 60px;
    height: 60px;
    font-size: var(--font-size-3xl);
  }
}

/* ==================== GALLERY VIDEO SUPPORT ==================== */
.gallery__item--video {
  position: relative;
}

.gallery__item--video video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery__play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  background: rgba(99, 102, 241, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  z-index: 2;
}

.gallery__item--video:hover .gallery__play-icon {
  background: rgba(139, 92, 246, 1);
  transform: translate(-50%, -50%) scale(1.1);
}

/* ==================== MEDIA LIGHTBOX ==================== */
.media-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.media-lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  cursor: pointer;
}

.lightbox__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.lightbox__close:hover {
  background: rgba(239, 68, 68, 0.8);
  border-color: rgba(239, 68, 68, 0.8);
  transform: rotate(90deg);
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.lightbox__nav:hover {
  background: rgba(99, 102, 241, 0.8);
  border-color: rgba(99, 102, 241, 0.8);
}

.lightbox__nav--prev {
  left: 20px;
}

.lightbox__nav--next {
  right: 20px;
}

.lightbox__content {
  position: relative;
  z-index: 5;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__media {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__image {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox__video {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  background: #000;
}

.lightbox__counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 10;
}

/* Lightbox Responsive */
@media screen and (max-width: 768px) {
  .lightbox__close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .lightbox__nav {
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
  }

  .lightbox__nav--prev {
    left: 10px;
  }

  .lightbox__nav--next {
    right: 10px;
  }

  .lightbox__image,
  .lightbox__video {
    max-width: 95vw;
    max-height: 80vh;
  }

  .gallery__play-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}
