/**
 * Sequential Template Styles
 * Fullscreen poster gallery with one poster at a time
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #000;
  color: #fff;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* ==========================================================================
   Poster Sections
   ========================================================================== */

.poster-section {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  /* No transition - instant switch between posters */
  z-index: 1;
}

.poster-section.active {
  opacity: 1;
  visibility: visible;
  /* No transition - instant switch between posters */
  z-index: 10;
}

.poster-section.preload {
  visibility: hidden;
  z-index: 0;
}

/* ==========================================================================
   Liveposter Container
   ========================================================================== */

.liveposter-container {
  --aspect-ratio: 9/16;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Contain mode - preserve aspect ratio with black bars */
.liveposter-container.contain {
  aspect-ratio: var(--aspect-ratio);
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: 100%;
}

@media (orientation: portrait) and (max-aspect-ratio: 9/16) {
  .liveposter-container.contain {
    width: 100%;
    height: auto;
  }
}

@media (orientation: landscape) {
  .liveposter-container.contain {
    width: auto;
    height: 100%;
  }
}

/* Fill mode - stretch to fill entire viewport */
.liveposter-container.fill {
  width: 100%;
  height: 100%;
}

.liveposter-container > * {
  width: 100% !important;
  height: 100% !important;
  position: absolute;
  top: 0;
  left: 0;
}

/* ==========================================================================
   Poster Metadata
   ========================================================================== */

.poster-metadata {
  position: absolute;
  bottom: 40px;
  left: 20px;
  right: 20px;
  z-index: 100;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  padding: 20px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}

body.show-ui .poster-section.active .poster-metadata {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.poster-title {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 8px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.poster-description {
  font-size: 1rem;
  opacity: 0.9;
  line-height: 1.4;
  text-shadow: 0 1px 5px rgba(0,0,0,0.5);
}

/* ==========================================================================
   Navigation Controls
   ========================================================================== */

.sequential-controls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(0, 0, 0, 0.7);
  padding: 15px 30px;
  border-radius: 30px;
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

body.show-ui .sequential-controls {
  opacity: 1;
  pointer-events: auto;
}

.control-button {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 10px;
  border-radius: 50%;
  transition: background 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.control-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.control-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.control-button svg {
  width: 24px;
  height: 24px;
}

/* ==========================================================================
   Progress Dots
   ========================================================================== */

.progress-dots {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 10px;
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
  cursor: pointer;
}

.progress-dot.active {
  width: 24px;
  border-radius: 4px;
  background: #fff;
}

.progress-dot:hover:not(.active) {
  background: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   Autoplay Indicator
   ========================================================================== */

.autoplay-indicator {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 15px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

body.show-ui .autoplay-indicator {
  opacity: 1;
  pointer-events: auto;
}

.autoplay-toggle {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.autoplay-toggle svg {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   Loading Indicator
   ========================================================================== */

.loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.poster-section.loading .loading-indicator {
  opacity: 1;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   Poster Menu
   ========================================================================== */

.poster-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s 0.3s;
  overflow-y: auto;
  padding: 80px 20px 40px;
}

.poster-menu-overlay.active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0s;
}

.poster-menu-container {
  max-width: 1600px;
  margin: 0 auto;
}

.poster-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  color: #fff;
}

.poster-menu-title {
  font-size: 2rem;
  font-weight: 600;
}

.poster-menu-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 10px;
  border-radius: 50%;
  transition: background 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.poster-menu-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.poster-menu-close svg {
  width: 32px;
  height: 32px;
}

.poster-menu-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  width: 100%;
}

.poster-menu-item {
  position: relative;
  aspect-ratio: 9/16;
  background: #111;
  border-radius: 0;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.poster-menu-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(255, 255, 255, 0.1);
}

.poster-menu-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.poster-menu-item-ar-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 4px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 10;
}

.poster-menu-item-ar-badge svg {
  width: 14px;
  height: 14px;
}

.poster-menu-item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
  padding: 15px;
  color: #fff;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.poster-menu-item:hover .poster-menu-item-overlay {
  transform: translateY(0);
}

.poster-menu-item-title {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.poster-menu-item-count {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* ==========================================================================
   Menu & Fullscreen Buttons
   ========================================================================== */

.menu-toggle-button {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 12px;
  border-radius: 50%;
  transition: background 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}

body.show-ui .menu-toggle-button,
body.menu-open .menu-toggle-button {
  opacity: 1;
  pointer-events: auto;
}

.menu-toggle-button:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.menu-toggle-button svg {
  width: 28px;
  height: 28px;
}

.fullscreen-toggle-button {
  position: fixed;
  top: 20px;
  left: 80px;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 12px;
  border-radius: 50%;
  transition: background 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}

body.show-ui .fullscreen-toggle-button,
body.menu-open .fullscreen-toggle-button {
  opacity: 1;
  pointer-events: auto;
}

.fullscreen-toggle-button:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.fullscreen-toggle-button svg {
  width: 28px;
  height: 28px;
}

.fullscreen-toggle-button.hidden {
  display: none;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1400px) {
  .poster-menu-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1024px) {
  .poster-menu-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .poster-menu-title {
    font-size: 1.5rem;
  }
}

@media (max-width: 768px) {
  .poster-menu-overlay {
    padding: 60px 15px 30px;
  }

  .poster-menu-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
  }

  .poster-menu-title {
    font-size: 1.3rem;
  }

  .menu-toggle-button {
    top: 15px;
    left: 15px;
    padding: 10px;
  }

  .menu-toggle-button svg {
    width: 24px;
    height: 24px;
  }

  .fullscreen-toggle-button {
    top: 15px;
    left: 65px;
    padding: 10px;
  }

  .fullscreen-toggle-button svg {
    width: 24px;
    height: 24px;
  }
}
