/* presentation-toolkit.css — Presentation player modal and controls */
/* Extracted from styles.css — Phase 6 refactoring (March 2026) */

.presentation-message .presentation-header {
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e5e7eb;
}

.presentation-message .presentation-content {
  font-size: 0.95em;
  line-height: 1.6;
  color: #444;
}

.presentation-message .markdown-content h2,

.presentation-message .markdown-content h3 {
  margin-top: 12px;
  margin-bottom: 6px;
  color: #333;
}

.presentation-message .markdown-content ul,

.presentation-message .markdown-content ol {
  padding-left: 20px;
  margin: 8px 0;
}

.presentation-message .markdown-content code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.presentation-message .presentation-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.presentation-message .presentation-image:hover {
  transform: scale(1.02);
}

.presentation-message .presentation-video {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
}

.presentation-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
}

.presentation-modal-container {
  position: relative;
  background: white;
  border-radius: 12px;
  max-width: 90%;
  max-height: 90%;
  width: 800px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: presentationModalIn 0.2s ease-out;
}

@keyframes presentationModalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.presentation-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #0a2e2e 0%, #134040 100%);
  color: white;
  border-radius: 12px 12px 0 0;
}

.presentation-modal-title {
  font-weight: 600;
  font-size: 1.1em;
}

.presentation-modal-close {
  background: none;
  border: none;
  color: white;
  font-size: calc(24px * var(--type-scale, 1));
  cursor: pointer;
  padding: 0 8px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.presentation-modal-close:hover {
  opacity: 1;
}

.presentation-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  line-height: 1.6;
}

.presentation-modal-body .markdown-content {
  font-size: 0.95em;
}

.presentation-modal-body .presentation-full-image {
  max-width: 100%;
  border-radius: 8px;
}

.presentation-modal-body .presentation-full-video {
  max-width: 100%;
  border-radius: 8px;
}

@media (max-width: 768px) {
  .presentation-modal-container {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .presentation-modal-header {
    border-radius: 0;
  }

  .ai-media-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.presentation-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #2d1b4e 0%, #1e3a5f 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.presentation-panel-title {
  color: white;
  font-weight: 600;
  font-size: 0.95em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: 12px;
}

.presentation-panel-actions {
  display: flex;
  gap: 8px;
}

.presentation-fullscreen-btn,

.presentation-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 6px;
  padding: 6px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.presentation-fullscreen-btn:hover,

.presentation-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.presentation-media-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  min-height: 0;
}

.presentation-media-container .presentation-photo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.presentation-media-container .presentation-photo:hover {
  transform: scale(1.02);
}

.presentation-media-container .presentation-video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  background: black;
}

.presentation-audio-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  max-width: 400px;
  width: 100%;
}

.presentation-audio-icon {
  font-size: calc(64px * var(--type-scale, 1));
  opacity: 0.8;
}

.presentation-audio-title {
  color: white;
  font-size: 1.1em;
  text-align: center;
}

.presentation-audio-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.presentation-audio-play {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.presentation-audio-play:hover {
  transform: scale(1.1);
}

.presentation-audio-progress {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}

.presentation-audio-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  width: 0%;
  transition: width 0.1s linear;
}

.presentation-audio-time {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85em;
  min-width: 80px;
  text-align: right;
}

.presentation-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.presentation-controls.hidden {
  display: none;
}

.presentation-control-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  color: white;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.presentation-control-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.presentation-control-btn.primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.presentation-control-btn.primary:hover {
  filter: brightness(1.1);
}

.presentation-gallery-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.presentation-gallery-nav.hidden {
  display: none;
}

.presentation-fullscreen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 25000;
  display: flex;
  flex-direction: column;
}

.presentation-fullscreen-overlay.hidden {
  display: none;
}

@media (max-width: 768px) {
  /* Stack vertically on mobile */
  .unified-ai-body {
    flex-direction: column;
  }

  .unified-ai-body.split-view .unified-ai-conversation-panel {
    flex: 1;
  }

  .unified-ai-presentation-panel {
    flex: 0 0 auto;
    max-height: 40vh;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .presentation-panel-header {
    padding: 10px 12px;
  }

  .presentation-media-container {
    padding: 12px;
  }

  .gallery-thumbnails {
    gap: 6px;
  }

  .gallery-thumbnail {
    width: 40px;
    height: 40px;
  }

  /* Fullscreen adjustments for mobile */
  .fullscreen-header {
    padding: 12px 16px;
  }

  .fullscreen-title {
    font-size: 1em;
  }

  .fullscreen-media-container {
    padding: 60px 16px 16px;
  }

  .fullscreen-gallery-nav {
    padding: 12px 16px;
  }

  .fullscreen-nav-btn {
    width: 44px;
    height: 44px;
  }

  .fullscreen-thumbnails .gallery-thumbnail {
    width: 48px;
    height: 48px;
  }
}

/* ─── FULLSCREEN MEDIA VIEWER: THE HEADER MUST CLEAR THE DYNAMIC ISLAND ──────
 * Joe, 2026-08-29, trapped on his iPhone: "I got trapped again at the full
 * screen photo that is still stepping on the Magic island at the top of the
 * iPhone."
 *
 * ⛔ MEASURED FROM THE SCREENSHOT, not inferred. The close button rendered with
 * its centre at y≈73px in a 2622px-tall capture — inside the status bar, under
 * the Dynamic Island. The title ("Mary Ferguson with a Tabby") and the counter
 * ("1 of 1") were painted straight through the clock, the signal bars and the
 * battery. The ✕ is the ONLY exit from this overlay, so a member who opens a
 * photo full-screen on a modern iPhone cannot get out. That is a trap, not a
 * cosmetic defect.
 *
 * ROOT CAUSE: `.presentation-fullscreen-overlay` is `position: fixed; top: 0`,
 * and `.fullscreen-header` had NO base rule at all — only a mobile
 * `padding: 12px 16px` override further up this file. Nothing in the chain ever
 * mentioned `env(safe-area-inset-top)`, so the header sat at the physical top of
 * the display rather than at the top of the SAFE area. `.fullscreen-close-btn`
 * had no rule whatsoever, which is also why the three header elements collide.
 *
 * ⚠️ THE INSET GOES ON THE HEADER, NOT THE OVERLAY. The backdrop SHOULD cover
 * the whole screen — a letterboxed black bar under the Island would look broken.
 * It is the interactive row that must live inside the safe area.
 *
 * ⚠️ `max()` NOT a bare inset: on a device with no notch `env()` resolves to 0
 * and the header would have no top padding at all. */
.fullscreen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
  /* The row itself, below whatever inset the device asked for. */
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
}

.fullscreen-title {
  flex: 1 1 auto;
  min-width: 0;
  /* A long media title must not shove the counter off-screen, nor wrap the
     header into two rows and push the image down. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.fullscreen-counter {
  flex: 0 0 auto;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

/* The way out. Sized to Apple's 44px minimum target because it is the only one
   this surface has. */
.fullscreen-close-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.fullscreen-close-btn:hover,
.fullscreen-close-btn:focus-visible {
  background: rgba(255, 255, 255, 0.22);
}

/* ⚠️ The mobile override earlier in this file sets `padding: 12px 16px` on
   `.fullscreen-header`, which would RESET the safe-area top the trap needs.
   Re-asserted here, after it, so the inset survives on the very devices that
   have an Island. */
@media (max-width: 768px) {
  .fullscreen-header {
    padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  }
}
