/**
 * Secure Media Styles
 * ===================
 * Styles pour les médias sécurisés avec URLs présignées
 */

/* =========================
   États de chargement
   ========================= */

.secure-media {
  transition: opacity 0.3s ease;
}

.secure-media-loading {
  opacity: 0.5;
  position: relative;
}

.secure-media-loading::after {
  content: '';
  position: absolute;
  bottom: 20px;
  top: auto;
  left: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 3px solid rgba(255, 62, 181, 0.3);
  border-top-color: var(--rose-fuchsia, #FF3EB5);
  border-radius: 50%;
  animation: secure-media-spin 0.8s linear infinite;
}

@keyframes secure-media-spin {
  to { transform: rotate(360deg); }
}

.secure-media-loaded {
  opacity: 1;
}

.secure-media-error {
  opacity: 0.6;
  filter: grayscale(50%);
}

/* =========================
   Galerie
   ========================= */

.secure-media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  padding: 10px 0;
}

.secure-media-thumbnail {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.secure-media-thumbnail:hover {
  transform: scale(1.03);
  box-shadow: 0 5px 20px rgba(255, 62, 181, 0.3);
}

.secure-media-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =========================
   LIGHTBOX — Media viewer plein écran
   ========================= */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: lb-fade-in 0.2s ease;
}

@keyframes lb-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox-content {
  position: absolute;
  inset: 0;
  padding: 60px 40px 90px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lightbox-media-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  transition: opacity 0.15s ease;
}

.lightbox-media-wrapper.lb-transitioning { opacity: 0; }

.lightbox-media-wrapper img,
.lightbox-media-wrapper img.lightbox-media {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  -webkit-touch-callout: none;
}

.lightbox-media-wrapper video,
.lightbox-media-wrapper video.lightbox-media {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  outline: none;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: fixed;
  background: rgba(11, 11, 11, 0.8);
  border: 2px solid rgba(255, 62, 181, 0.5);
  color: #FF3EB5;
  cursor: pointer;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10010;
  user-select: none;
  backdrop-filter: blur(10px);
  box-sizing: border-box;
  padding: 0;
  line-height: 0;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: #FF3EB5;
  color: #fff;
  border-color: #FF3EB5;
  box-shadow: 0 0 25px rgba(255, 62, 181, 0.8);
}

.lightbox-close {
  top: 20px;
  right: 20px;
}

.lightbox-close:hover { transform: rotate(90deg) scale(1.1); }

.lightbox-prev {
  left: calc(50% - 56px);
  bottom: 20px;
  top: auto;
  transform: none;
}

.lightbox-prev:hover { transform: scale(1.1); }

.lightbox-next {
  right: calc(50% - 56px);
  bottom: 20px;
  top: auto;
  transform: none;
}

.lightbox-next:hover { transform: scale(1.1); }

/* Masquer nav si un seul média */
.lightbox-overlay[data-count="1"] .lightbox-prev,
.lightbox-overlay[data-count="1"] .lightbox-next { display: none; }

@media (max-width: 768px) {
  .secure-media-gallery {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }
  .lightbox-content { padding: 52px 20px 80px; }
  .lightbox-close,
  .lightbox-prev,
  .lightbox-next { width: 40px; height: 40px; font-size: 18px; }
  .lightbox-prev { left: calc(50% - 48px); }
  .lightbox-next { right: calc(50% - 48px); }
  .lightbox-close { top: 10px; right: 10px; }
}

@media (max-width: 480px) {
  .lightbox-content { padding: 44px 20px 76px; }
  .lightbox-prev,
  .lightbox-next { width: 36px; height: 36px; }
}

/* =========================
   Placeholder animé
   ========================= */

.secure-media-placeholder {
  background: linear-gradient(
    90deg,
    rgba(255, 62, 181, 0.1) 0%,
    rgba(255, 62, 181, 0.2) 50%,
    rgba(255, 62, 181, 0.1) 100%
  );
  background-size: 200% 100%;
  animation: secure-media-shimmer 1.5s infinite;
}

@keyframes secure-media-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =========================
   Visibilité badges
   ========================= */

.visibility-badge {
  position: absolute;
  top: 8px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.visibility-badge.public {
  background: rgba(34, 197, 94, 0.9);
  color: white;
}

.visibility-badge.private {
  background: rgba(107, 114, 128, 0.9);
  color: white;
}

.visibility-badge.premium {
  background: linear-gradient(135deg, #FF3EB5, #E30049);
  color: white;
}

.visibility-badge.vip {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

/* =========================
   Overlay locked
   ========================= */

.secure-media-locked {
  position: relative;
}

.secure-media-locked::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  z-index: 1;
}

.secure-media-locked::after {
  content: '\1F512'; /* Lock emoji */
  position: absolute;
  bottom: 20px;
  top: auto;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  z-index: 2;
}

.lock-message {
  position: absolute;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: white;
  font-size: 14px;
  text-align: center;
  padding: 10px 20px;
  background: rgba(255, 62, 181, 0.8);
  border-radius: 20px;
  white-space: nowrap;
}
