/* ============================================
   MODALS — App Details & High-Res Lightbox
   ============================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(8, 8, 12, 0.86);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s var(--ease-out), visibility 0.22s var(--ease-out);
}

[data-theme="light"] .modal-backdrop {
  background: rgba(245, 246, 250, 0.85);
}

[data-theme="light"] .lightbox-caption {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(10, 15, 30, 0.1);
  padding: 4px 12px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(10, 15, 30, 0.06);
}

[data-theme="light"] .modal-close-btn,
[data-theme="light"] .lightbox-nav-btn {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(10, 15, 30, 0.12);
  color: var(--text-primary);
  box-shadow: 0 4px 14px rgba(10, 15, 30, 0.08);
}

[data-theme="light"] .modal-close-btn:hover,
[data-theme="light"] .lightbox-nav-btn:hover {
  background: #ffffff;
  border-color: rgba(10, 15, 30, 0.2);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-container {
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96) translateY(12px);
  transition: transform 0.25s var(--ease-out);
}

.modal-backdrop.active .modal-container {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-medium);
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  cursor: pointer;
  flex-shrink: 0;
}

.modal-close-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-surface-hover);
  transform: scale(1.05);
}

.modal-close-btn svg {
  width: 16px;
  height: 16px;
}

.modal-body {
  padding: var(--sp-5);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.modal-footer {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* Lightbox Theater — Floating Studio Stage */
.lightbox-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
  padding: var(--sp-6);
}

/* Close Button Anchored to Top-Right Viewport */
#lightboxCloseBtn {
  position: fixed !important;
  top: 24px !important;
  right: 28px !important;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(20, 20, 28, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1200;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] #lightboxCloseBtn {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(10, 15, 30, 0.12);
  color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(10, 15, 30, 0.08);
}

#lightboxCloseBtn:hover {
  transform: scale(1.08);
  border-color: var(--accent);
}

.lightbox-image-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 88vw;
  max-height: 76vh;
}

.lightbox-img {
  max-width: min(340px, 80vw);
  max-height: 74vh;
  border-radius: 28px;
  box-shadow:
    0 30px 80px -15px rgba(0, 0, 0, 0.7),
    0 12px 28px -8px rgba(0, 0, 0, 0.4);
  border: 3px solid rgba(255, 255, 255, 0.16);
  object-fit: contain;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

[data-theme="light"] .lightbox-img {
  border-color: rgba(10, 15, 30, 0.14);
  box-shadow:
    0 30px 70px -15px rgba(10, 15, 35, 0.2),
    0 12px 24px -8px rgba(10, 15, 30, 0.1);
}

/* Lightbox Prev / Next Buttons Anchored Safely Outside Device */
.lightbox-nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(20, 20, 28, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1100;
  transition: all var(--transition-fast);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  font-size: 20px;
  line-height: 1;
}

[data-theme="light"] .lightbox-nav-btn {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(10, 15, 30, 0.12);
  color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(10, 15, 30, 0.08);
}

.lightbox-nav-btn:hover {
  transform: translateY(-50%) scale(1.08);
  border-color: var(--accent);
}

.lightbox-nav-btn.prev {
  left: clamp(16px, 6vw, 60px);
}

.lightbox-nav-btn.next {
  right: clamp(16px, 6vw, 60px);
}

/* High-Contrast Frosted Glass Caption Pill */
.lightbox-caption {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(20, 20, 28, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 18px;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

[data-theme="light"] .lightbox-caption {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(10, 15, 30, 0.1);
  color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(10, 15, 30, 0.08);
}

@media (max-width: 600px) {
  .lightbox-nav-btn {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
  .lightbox-nav-btn.prev { left: 12px; }
  .lightbox-nav-btn.next { right: 12px; }
  #lightboxCloseBtn { top: 16px !important; right: 16px !important; }
}

.toast-notification {
  position: fixed;
  bottom: var(--sp-5);
  right: var(--sp-5);
  background: var(--text-primary);
  color: var(--bg-base);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  z-index: var(--z-toast);
  transform: translateY(10px);
  transition: all var(--transition-normal);
}

.toast-notification.show {
  opacity: 1;
  transform: translateY(0);
}