/* ============================================
   秋田ノーザンハピネッツ MOVIE GALLERY
   LINE LIFF App Styles
   ============================================ */

:root {
  --primary: #e40274;
  --primary-dark: #b8015c;
  --bg-dark: #0a0a0a;
  --bg-card: #1a1a1a;
  --bg-surface: #141414;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

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

html {
  width: 100%;
  height: 100%;
}

body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* ============================================
   ヘッダー
   ============================================ */

.app-header {
  flex-shrink: 0;
  position: relative;
  z-index: 100;
  background: var(--bg-dark);
  border-bottom: 1px solid #222;
  padding-top: var(--safe-top);
}

.app-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #ff4da6);
}

.header-inner {
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.team-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  display: none;
}

.logo-img {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.logo-text {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--text-primary);
}

/* ============================================
   検索バー
   ============================================ */

.search-bar {
  padding: 6px 16px 8px;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  background: #1e1e1e;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 0 12px;
  height: 40px;
  transition: border-color 0.2s;
}

.search-input-wrapper:focus-within {
  border-color: var(--primary);
}

.search-icon {
  flex-shrink: 0;
  color: var(--text-muted);
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  padding: 0 10px;
  height: 100%;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-clear {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 50%;
}

/* ============================================
   カテゴリフィルター
   ============================================ */

.filter-bar {
  padding: 0 0 8px;
}

.filter-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-scroll::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex-shrink: 0;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.2s;
  white-space: nowrap;
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ============================================
   メインコンテンツ
   ============================================ */

.main-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ============================================
   フルスクリーンコンテナ
   ============================================ */

.fullscreen-container {
  position: relative;
  width: 100%;
  background: #000;
}

/* ============================================
   プレーヤーセクション
   ============================================ */

.player-section {
  position: relative;
  width: 100%;
  background: #000;
}

.player-section.hidden {
  display: none;
}

.player-swiper {
  width: 100%;
  height: 60vh;
}

.player-swiper .swiper-slide {
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-frame-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

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

/* タッチオーバーレイ */
.touch-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  cursor: pointer;
}

.touch-overlay .tap-to-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 56px;
  height: 56px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: transform 0.2s ease;
}

.touch-overlay .tap-to-play.show {
  transform: translate(-50%, -50%) scale(1);
}

.touch-overlay .tap-to-play::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 10px 0 10px 18px;
  border-color: transparent transparent transparent white;
  margin-left: 3px;
}

.touch-overlay .tap-to-play.paused::after {
  border-width: 0;
  width: 16px;
  height: 18px;
  border-left: 5px solid white;
  border-right: 5px solid white;
  margin-left: 0;
}

/* サムネイル */
.video-thumbnail-slide {
  position: relative;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.video-thumbnail-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumbnail-play-icon::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 12px 0 12px 22px;
  border-color: transparent transparent transparent white;
  margin-left: 4px;
}

/* ============================================
   マスコットキャラクター（ビッキー）
   ============================================ */

.mascot-bikky {
  position: absolute;
  bottom: -10px;
  right: 8px;
  width: 72px;
  height: auto;
  z-index: 15;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
  transition: opacity 0.3s;
}

body.fs-active .mascot-bikky {
  display: none;
}

/* ============================================
   プレーヤーバー（ドット + 全画面ボタン）
   ============================================ */

.player-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  background: var(--bg-dark);
  position: relative;
}

.player-bar.hidden {
  display: none;
}

.swipe-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex: 1;
}

.swipe-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.3s ease;
}

.swipe-dot.active {
  background: var(--primary);
  width: 24px;
  border-radius: 4px;
}

.fullscreen-btn {
  position: absolute;
  right: 12px;
  background: rgba(255,255,255,0.1);
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.fullscreen-btn:active {
  background: rgba(255,255,255,0.25);
}

/* ============================================
   フルスクリーン時のオーバーレイ
   ============================================ */

.fs-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  pointer-events: none;
}

/* オーバーレイ本体は常にpointer-events:none。
   ボタンがあるバーだけautoにすることで、
   スワイプがSwiperに届くようにする */

.fs-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  padding-top: calc(12px + var(--safe-top));
  padding-left: calc(16px + var(--safe-left));
  background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, transparent 100%);
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transition: opacity 0.3s;
}

.fs-overlay.visible .fs-top-bar {
  opacity: 1;
  pointer-events: auto;
}

.fs-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
  padding-left: calc(16px + var(--safe-left));
  padding-right: calc(16px + var(--safe-right));
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s;
}

.fs-overlay.visible .fs-bottom-bar {
  opacity: 1;
  pointer-events: auto;
}

.fs-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fs-title {
  font-size: 14px;
  font-weight: 500;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fs-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fs-nav-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-family: inherit;
  padding: 8px 12px;
  border-radius: 20px;
  transition: background 0.2s;
}

.fs-nav-btn:active {
  background: rgba(255,255,255,0.15);
}

.fs-counter {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ============================================
   動画情報
   ============================================ */

.video-info {
  padding: 16px;
  background: var(--bg-dark);
}

.video-info.hidden {
  display: none;
}

.video-info-category {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--primary);
  background: rgba(228, 2, 116, 0.15);
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.video-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.video-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ============================================
   動画一覧グリッド
   ============================================ */

.video-list {
  padding: 0 16px 80px;
  background: var(--bg-dark);
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px;
  border-top: 1px solid #222;
}

.list-heading {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-muted);
}

.list-count {
  font-size: 12px;
  color: var(--text-muted);
}

.video-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.video-card {
  display: flex;
  gap: 12px;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  transition: background 0.2s;
  padding: 4px;
  animation: fadeIn 0.3s ease forwards;
}

.video-card:active {
  background: var(--bg-card);
}

.video-card.active {
  background: var(--bg-card);
  border-left: 3px solid var(--primary);
  padding-left: 1px;
}

.card-thumbnail {
  position: relative;
  flex-shrink: 0;
  width: 72px;
  aspect-ratio: 9 / 16;
  border-radius: 6px;
  overflow: hidden;
  background: #222;
}

.card-thumbnail video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-now-playing {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
}

.card-category-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.75);
  color: #ccc;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 3px;
}

.card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

.card-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

/* 検索結果なし */
.no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  gap: 16px;
  color: var(--text-muted);
  text-align: center;
}

.no-results p { font-size: 14px; }

.reset-filter-btn {
  background: var(--bg-card);
  border: 1px solid #333;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  padding: 10px 24px;
  border-radius: 24px;
  cursor: pointer;
}

/* ============================================
   フルスクリーンモード（CSS class ベース）
   body.fs-active が付くと全画面レイアウト
   ============================================ */

body.fs-active .app-header {
  display: none !important;
}

body.fs-active .main-content {
  overflow: hidden !important;
}

body.fs-active .fullscreen-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 9000;
  background: #000;
}

body.fs-active .player-section {
  width: 100%;
  height: 100%;
}

body.fs-active .player-swiper {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

body.fs-active .player-swiper .swiper-wrapper {
  height: 100% !important;
}

body.fs-active .player-swiper .swiper-slide {
  height: 100% !important;
}

body.fs-active .video-frame-wrapper {
  width: 100%;
  height: 100%;
}

body.fs-active .fs-overlay {
  display: block;
}

body.fs-active .player-bar,
body.fs-active .video-info,
body.fs-active .video-list {
  display: none !important;
}

/* Fullscreen API でフルスクリーンになった場合 */
.fullscreen-container:fullscreen {
  width: 100vw;
  height: 100vh;
  background: #000;
}

.fullscreen-container:fullscreen .player-section {
  width: 100%;
  height: 100%;
}

.fullscreen-container:fullscreen .player-swiper {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

.fullscreen-container:fullscreen .swiper-wrapper {
  height: 100% !important;
}

.fullscreen-container:fullscreen .swiper-slide {
  height: 100% !important;
}

.fullscreen-container:fullscreen .video-frame-wrapper {
  width: 100%;
  height: 100%;
}

.fullscreen-container:fullscreen .fs-overlay {
  display: block;
}

/* webkit prefix */
.fullscreen-container:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  background: #000;
}

.fullscreen-container:-webkit-full-screen .player-section {
  width: 100%;
  height: 100%;
}

.fullscreen-container:-webkit-full-screen .player-swiper {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

.fullscreen-container:-webkit-full-screen .swiper-wrapper {
  height: 100% !important;
}

.fullscreen-container:-webkit-full-screen .swiper-slide {
  height: 100% !important;
}

.fullscreen-container:-webkit-full-screen .video-frame-wrapper {
  width: 100%;
  height: 100%;
}

.fullscreen-container:-webkit-full-screen .fs-overlay {
  display: block;
}

/* ============================================
   アニメーション
   ============================================ */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.video-card:nth-child(1) { animation-delay: 0.05s; }
.video-card:nth-child(2) { animation-delay: 0.1s; }
.video-card:nth-child(3) { animation-delay: 0.15s; }
.video-card:nth-child(4) { animation-delay: 0.2s; }
.video-card:nth-child(5) { animation-delay: 0.25s; }
.video-card:nth-child(6) { animation-delay: 0.3s; }
.video-card:nth-child(7) { animation-delay: 0.35s; }
.video-card:nth-child(8) { animation-delay: 0.4s; }

/* ============================================
   スクロールバー
   ============================================ */

.main-content::-webkit-scrollbar { width: 3px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
