/* ==========================================================================
   Expanded Theater Video Modal (25px Rounded Player)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 16, 0.60);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

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

.modal-floating-close-btn {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(22, 26, 30, 0.85);
  border: 1px solid var(--border-medium);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1002;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  transition: all var(--transition-fast);
}

.modal-floating-close-btn:hover {
  background: var(--accent-red);
  color: #ffffff;
  border-color: var(--accent-red);
  transform: scale(1.1) rotate(90deg);
}

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

.theater-card {
  width: 100%;
  max-width: min(92vw, calc((84vh - 130px) * 16 / 9));
  max-height: 92vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 
    0 25px 65px -15px rgba(0, 0, 0, 0.98),
    -6px -4px 40px -4px rgba(49, 134, 255, 0.3),
    6px 8px 46px -4px rgba(255, 70, 65, 0.3);
  display: flex;
  flex-direction: column;
  margin: auto;
  transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.theater-header {
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  background: #111417;
  flex-shrink: 0;
}

.theater-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.theater-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff !important;
  background: var(--grad-sentiment, linear-gradient(90deg, #3387ff 0%, #a9a8ff 100%)) !important;
  padding: 0.24rem 0.75rem;
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 10px rgba(51, 135, 255, 0.4) !important;
  border: none !important;
}

.theater-badge[data-category="Teach-back"],
.theater-badge[data-category="TEACH-BACK"],
.theater-badge[data-wave="Teach-back"] {
  background: var(--grad-teachback, linear-gradient(90deg, #0ebc5f 0%, #78c9ff 100%)) !important;
  box-shadow: 0 2px 10px rgba(14, 188, 95, 0.4) !important;
}

.theater-title {
  font-size: 1.15rem;
  font-weight: 500;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theater-actions {
  display: flex;
  gap: 0.6rem;
  flex-shrink: 0;
}

.btn-icon-only {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-surface-inner);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon-only:hover {
  background: var(--bg-surface-secondary);
  color: #ffffff;
  border-color: var(--border-medium);
}

.btn-close:hover {
  background: var(--accent-red);
  color: #ffffff;
  border-color: var(--accent-red);
}

.btn-icon-only svg {
  width: 18px;
  height: 18px;
}

/* Theater Media Container - Viewport-constrained to prevent vertical overflow */
.theater-media-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(84vh - 130px);
  background: #000000;
  overflow: hidden;
}

/* Portrait Theater Mode - Exact 9:16 vertical player that fits screen cleanly */
.theater-card.is-portrait {
  max-width: min(440px, calc((84vh - 130px) * 9 / 16));
}

.theater-card.is-portrait .theater-media-container {
  aspect-ratio: 9 / 16;
  max-height: calc(84vh - 130px);
}

.theater-media-container iframe,
.theater-player,
.theater-iframe-element {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Transparent Interaction Shield for Smooth Custom Cursor Tracking over Video */
.theater-video-shield {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 50px);
  z-index: 5;
  background: transparent;
  pointer-events: none;
}

.theater-footer {
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-subtle);
  background: #111417;
  flex-wrap: wrap;
  gap: 0.75rem;
  flex-shrink: 0;
}

.theater-footer-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  flex-grow: 1;
}

.theater-description {
  display: none !important;
}

.theater-playback-notice {
  font-size: 0.76rem;
  color: #fbbc04;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.theater-playback-notice .notice-link {
  color: #8ab4f8;
  text-decoration: underline;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.theater-playback-notice .notice-link:hover {
  color: #d2e3fc;
}

.theater-nav-controls {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-shrink: 0;
}

.btn-drive-action {
  background: rgba(49, 134, 255, 0.15);
  color: #8ab4f8;
  border-color: rgba(49, 134, 255, 0.35);
  transition: all var(--transition-fast);
}

.btn-drive-action:hover {
  background: rgba(49, 134, 255, 0.3);
  color: #ffffff;
  border-color: rgba(49, 134, 255, 0.6);
}

.btn-secondary {
  background: var(--bg-surface-inner);
  color: #ffffff;
  border: 1px solid var(--border-subtle);
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--bg-surface-secondary);
  border-color: var(--accent-blue);
}

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

/* ==========================================================================
   Mobile Responsive Theater Modal
   ========================================================================== */

@media (max-width: 640px) {
  .modal-backdrop {
    padding: 0.5rem;
  }

  .modal-floating-close-btn {
    display: none;
  }

  .theater-card {
    max-width: 100% !important;
    border-radius: var(--radius-inner);
  }

  .theater-header {
    padding: 0.75rem 0.85rem;
  }

  .theater-title {
    font-size: 0.98rem;
  }

  .theater-actions {
    gap: 0.4rem;
  }

  .btn-icon-only {
    width: 34px;
    height: 34px;
  }

  .theater-footer {
    padding: 0.75rem 0.85rem;
    gap: 0.5rem;
  }

  .theater-footer-left {
    width: 100%;
    margin-bottom: 0.15rem;
  }

  .theater-description {
    font-size: 0.82rem;
  }

  .theater-nav-controls {
    width: 100%;
    justify-content: space-between;
    gap: 0.35rem;
    flex-wrap: wrap;
  }

  .btn-secondary {
    padding: 0.45rem 0.7rem;
    font-size: 0.76rem;
    flex: 1 1 auto;
    justify-content: center;
  }

  .btn-drive-action {
    flex: 1 1 100%;
  }
}

