/* =============================================
   XCITY Live - Design System
   Based on xcity-tc-nextjs design patterns
   ============================================= */

/* CSS Variables - matching xcity-tc-nextjs design-system.css */
:root {
  /* Colors - XCITY Brand */
  --color-xcity-50: #fef2f2;
  --color-xcity-100: #fee2e2;
  --color-xcity-200: #fecdd3;
  --color-xcity-300: #fda4af;
  --color-xcity-400: #fb7185;
  --color-xcity-500: #ed2939; /* Imperial Red - Primary */
  --color-xcity-600: #d32f2f;
  --color-xcity-700: #b71c1c;
  --color-xcity-800: #8b0000;
  --color-xcity-900: #5d0000;

  /* Neutral Colors */
  --color-neutral-50: #fafafa;
  --color-neutral-100: #f5f5f5;
  --color-neutral-200: #e5e5e5;
  --color-neutral-300: #d4d4d4;
  --color-neutral-400: #a3a3a3;
  --color-neutral-500: #737373;
  --color-neutral-600: #525252;
  --color-neutral-700: #404040;
  --color-neutral-800: #262626;
  --color-neutral-900: #171717;

  /* Semantic Colors */
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-error: #ef4444;

  /* Media Chrome Accent - matching xcity-tc-nextjs player */
  --color-media-accent: #ffc50f;
  --color-media-control-bg: rgba(20, 20, 30, 0.7);
  --color-media-control-hover: rgba(20, 20, 30, 0.9);

  /* Typography - System fonts (no external fonts) */
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 0.75rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-soft: 0 2px 15px -3px rgba(0, 0, 0, 0.07), 0 10px 20px -2px rgba(0, 0, 0, 0.04);
  --shadow-xcity: 0 4px 15px -3px rgba(237, 41, 57, 0.2), 0 2px 6px -1px rgba(237, 41, 57, 0.1);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --header-height: 64px;
  --max-width: 1280px;

  /* Safe Area (iOS) */
  --safe-area-inset-top: env(safe-area-inset-top, 0px);
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--color-neutral-900);
  background-color: var(--color-neutral-50);
  min-height: 100vh;
  min-height: 100dvh;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* =============================================
   Header - xcity-tc-nextjs style
   ============================================= */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: linear-gradient(to bottom, white, rgba(255, 255, 255, 0.95));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-lg);
  border-bottom: 1px solid var(--color-neutral-200);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.logo-link {
  display: flex;
  align-items: center;
  transition: opacity var(--transition-fast);
}

.logo-link:hover {
  opacity: 0.8;
}

.logo-image {
  height: 32px;
  width: auto;
}

.logo-live {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--color-xcity-500), var(--color-xcity-600));
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
  box-shadow: var(--shadow-xcity);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

/* Language Selector */
.language-selector {
  position: relative;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  color: var(--color-neutral-700);
  background: var(--color-neutral-100);
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.lang-btn:hover {
  background: var(--color-neutral-200);
  border-color: var(--color-neutral-300);
}

.lang-btn .icon {
  width: 18px;
  height: 18px;
  color: var(--color-neutral-500);
}

.lang-btn .icon-chevron {
  width: 14px;
  height: 14px;
  color: var(--color-neutral-400);
}

#current-lang {
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 150px;
  background: white;
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: fadeIn 0.15s ease-out;
}

.lang-option {
  display: block;
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  font-size: var(--font-size-sm);
  color: var(--color-neutral-700);
  transition: all var(--transition-fast);
}

.lang-option:hover {
  background: var(--color-xcity-50);
  color: var(--color-xcity-600);
}

.lang-option.active {
  color: var(--color-xcity-500);
  font-weight: 600;
  background: var(--color-xcity-50);
}

/* =============================================
   Main Content
   ============================================= */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Player Section */
.player-section {
  background: var(--color-neutral-900);
}

.player-container {
  max-width: var(--max-width);
  margin: 0 auto;
}

.video-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  background: linear-gradient(135deg, #1a1a1a, #0d0d0d);
}

.video-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Video Overlays - default centered */
.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  text-align: center;
  padding: var(--spacing-xl);
}

.overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.offline-icon,
.error-icon,
.auth-icon,
.paid-icon {
  width: 72px;
  height: 72px;
  color: var(--color-xcity-400);
  opacity: 0.8;
}

.paid-icon {
  color: var(--color-media-accent);
}

.offline-title,
.error-title,
.auth-title,
.paid-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
}

.offline-message,
.error-message,
.auth-message,
.paid-message {
  font-size: var(--font-size-sm);
  color: var(--color-neutral-400);
  max-width: 320px;
}

/* Bottom-aligned Overlays (background-style with images) */
#offline-overlay {
  justify-content: flex-end;
  padding-bottom: var(--spacing-2xl);
  background: url('../images/offline-bg.webp') center/cover no-repeat,
              rgba(0, 0, 0, 0.9);
}

#nostream-overlay {
  justify-content: flex-end;
  padding-bottom: var(--spacing-2xl);
  background: url('../images/nostream-bg.webp') center/cover no-repeat,
              rgba(0, 0, 0, 0.9);
}

/* Loading Spinner */
.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--color-xcity-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  font-size: var(--font-size-sm);
  color: var(--color-neutral-400);
  margin-top: var(--spacing-md);
}

/* Player Controls - Media Chrome Style (matching xcity-tc-nextjs) */
.player-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: linear-gradient(to top, var(--color-media-control-bg), transparent);
}

/* Paused Overlay - shows play button when paused */
.paused-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 6;
  cursor: pointer;
}

.control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: white;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
}

.control-btn .icon {
  width: 24px;
  height: 24px;
}

/* Volume Slider - Media Chrome Style */
.volume-slider {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  cursor: pointer;
}

.volume-slider::-webkit-slider-runnable-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--transition-fast);
  margin-top: -4px;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.volume-slider::-moz-range-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.volume-slider::-moz-range-progress {
  background: white;
  height: 4px;
  border-radius: 2px;
}

.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.spacer {
  flex: 1;
}

/* Live Badge - Media Chrome Style */
.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.375rem 0.875rem;
  background: var(--color-xcity-500);
  color: white;
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: var(--radius-sm);
}

.live-dot {
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

/* Start Playback Overlay - Media Chrome Style */
.start-playback-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  /* 配信中背景画像 + 明滅アニメーション */
  background: url('../images/live-bg.webp') center/cover no-repeat,
              linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
  animation: livePulse 3s ease-in-out infinite;
  z-index: 10;
}

@keyframes livePulse {
  0%, 100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.15);
  }
}

/* Overlay LIVE indicator - 右下に大きく表示 */
.overlay-live-indicator {
  position: absolute;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #ff1a1a;
  font-size: 2.5rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 4px;
  text-shadow:
    0 0 10px rgba(255, 26, 26, 0.8),
    0 0 20px rgba(255, 26, 26, 0.6),
    0 2px 4px rgba(0, 0, 0, 0.8);
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.3);
}

.overlay-live-dot {
  width: 18px;
  height: 18px;
  background: #ff1a1a;
  border-radius: 50%;
  animation: overlayDotPulse 0.8s ease-in-out infinite;
  box-shadow:
    0 0 15px rgba(255, 26, 26, 1),
    0 0 30px rgba(255, 26, 26, 0.8);
}

@keyframes overlayDotPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow:
      0 0 15px rgba(255, 26, 26, 1),
      0 0 30px rgba(255, 26, 26, 0.8);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.85);
    box-shadow:
      0 0 25px rgba(255, 26, 26, 1),
      0 0 50px rgba(255, 26, 26, 0.9);
  }
}

.start-message {
  color: var(--color-neutral-300);
  font-size: var(--font-size-sm);
}

.start-playback-button {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: solid 3px var(--color-media-accent);
  background: var(--color-media-control-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(1);
  transition: all 0.3s ease;
  cursor: pointer;
}

.start-playback-button:hover {
  background: var(--color-media-control-hover);
  transform: scale(1.1);
}

.start-playback-button .play-triangle {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 15px 0 15px 26px;
  border-color: transparent transparent transparent var(--color-media-accent);
  margin-left: 5px;
}

/* Info Section */
.info-section {
  padding: var(--spacing-xl) var(--spacing-md);
  background: white;
  border-top: 1px solid var(--color-neutral-200);
}

.info-container {
  max-width: var(--max-width);
  margin: 0 auto;
}

.event-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-neutral-900);
  margin-bottom: var(--spacing-xs);
}

.event-date {
  display: inline-block;
  font-size: var(--font-size-sm);
  color: var(--color-xcity-500);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  padding: 0.25rem 0.75rem;
  background: var(--color-xcity-50);
  border-radius: var(--radius-sm);
}

.event-description {
  font-size: var(--font-size-base);
  color: var(--color-neutral-600);
  line-height: 1.8;
}

/* =============================================
   Button Styles - xcity-tc-nextjs style
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: var(--font-size-sm);
  font-weight: 600;
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-xcity-500), var(--color-xcity-600));
  color: white;
  box-shadow: var(--shadow-xcity);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-xcity-600), var(--color-xcity-700));
  transform: translateY(-1px);
  box-shadow: 0 6px 20px -3px rgba(237, 41, 57, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

/* =============================================
   Footer - xcity-tc-nextjs style
   ============================================= */
.footer {
  background: var(--color-neutral-900);
  color: var(--color-neutral-400);
  padding: var(--spacing-2xl) var(--spacing-md);
  padding-bottom: calc(var(--spacing-2xl) + var(--safe-area-inset-bottom));
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-lg);
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-md) var(--spacing-xl);
}

.footer-links a {
  font-size: var(--font-size-sm);
  color: var(--color-neutral-400);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: white;
}

.copyright {
  font-size: var(--font-size-xs);
  color: var(--color-neutral-500);
}

/* =============================================
   Animations
   ============================================= */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

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

/* Tablet and up */
@media (min-width: 768px) {
  .footer-content {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }

  .footer-links {
    order: 0;
  }

  .event-title {
    font-size: var(--font-size-3xl);
  }

  .volume-slider {
    width: 100px;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .info-section {
    padding: var(--spacing-2xl) var(--spacing-lg);
  }

  .logo-image {
    height: 36px;
  }
}

/* Small phones */
@media (max-width: 375px) {
  .logo-image {
    height: 28px;
  }

  #current-lang {
    display: none;
  }

  .volume-slider {
    width: 60px;
  }

  .live-badge span:not(.live-dot) {
    font-size: 10px;
  }
}

/* Fullscreen mode */
:fullscreen .player-container,
:-webkit-full-screen .player-container {
  max-width: none;
  padding: 0;
}

:fullscreen .video-wrapper,
:-webkit-full-screen .video-wrapper {
  padding-top: 0;
  height: calc(100vh - 56px);
  border-radius: 0;
  box-shadow: none;
}

:fullscreen .video-wrapper video,
:-webkit-full-screen .video-wrapper video {
  position: static;
  width: 100%;
  height: 100%;
}

:fullscreen .player-controls,
:-webkit-full-screen .player-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for accessibility */
*:focus-visible {
  outline: 2px solid var(--color-xcity-500);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background-color: var(--color-xcity-100);
  color: var(--color-xcity-900);
}
