/* ==========================================================================
   1. リセット & 基本設定 (Reset & Base)
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Hiragino Kaku Gothic ProN", "メイリオ", sans-serif;
}

body {
  background-color: #181818;
  color: #eee;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   2. ヘッダー (Site Header)
   ========================================================================== */
.site-header {
  background-color: #111;
  border-bottom: 2px solid #d00000;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-size: 1.1rem;
  font-weight: bold;
  color: #fff;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 6px;
}

.site-nav a {
  color: #aaa;
  text-decoration: none;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 4px;
  transition: all 0.2s;
}

.site-nav a:hover,
.site-nav a.active {
  background-color: #d00000;
  color: #fff;
}

/* ==========================================================================
   3. 上部検索 ＆ 人物タグフィルター (Top Search & Filter Bar)
   ========================================================================== */
.top-search-section {
  background-color: #222;
  border-bottom: 1px solid #333;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-bar-inner {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  max-width: 500px;
}

.top-search-input {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border: 1px solid #444;
  border-radius: 4px;
  background-color: #2e2e2e;
  color: #fff;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.top-search-input:focus {
  border-color: #d00000;
}

.btn-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #888;
  font-size: 1.1rem;
  cursor: pointer;
}

.btn-clear:hover {
  color: #fff;
}

.filter-badge {
  background-color: #d00000;
  color: #fff;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-badge button {
  background: none;
  border: none;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}

.cast-chip-bar {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.chip-label {
  font-size: 0.75rem;
  color: #888;
  white-space: nowrap;
}

.cast-chip-list {
  display: flex;
  gap: 6px;
}

.cast-chip {
  background-color: #333;
  color: #ccc;
  border: 1px solid #444;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.cast-chip:hover {
  background-color: #444;
  color: #fff;
}

.cast-chip.active {
  background-color: #d00000;
  border-color: #d00000;
  color: #fff;
  font-weight: bold;
}

/* ==========================================================================
   4. メインコンテナ ＆ レイアウト (Main Container)
   ========================================================================== */
.main-container {
  flex: 1;
  display: flex;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  background-color: #222;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.content-area {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* スイッチナビバー */
.switch-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #1a1a1a;
  padding: 8px 12px;
  border: 1px solid #333;
  border-radius: 4px;
}

.btn-nav {
  background-color: #333;
  border: 1px solid #444;
  color: #fff;
  padding: 6px 12px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background-color 0.2s;
}

.btn-nav:hover {
  background-color: #444;
}

.nav-label {
  font-size: 0.85rem;
  color: #aaa;
}

/* 未選択状態 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #777;
  background-color: #1a1a1a;
  border: 1px dashed #444;
  border-radius: 4px;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: #ccc;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.85rem;
}

/* ==========================================================================
   5. 動画作品詳細 (Work Detail Content)
   ========================================================================== */
.work-detail-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-header-title {
  font-size: 1.1rem;
  font-weight: bold;
  color: #fff;
  border-bottom: 2px solid #d00000;
  padding-bottom: 8px;
  line-height: 1.4;
}

.section-label {
  font-size: 0.85rem;
  font-weight: bold;
  color: #aaa;
  margin-bottom: 8px;
}

/* 動画プレイヤー */
.video-section {
  display: flex;
  flex-direction: column;
}

.video-player-box {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #000;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #333;
}

.video-player-box video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* サンプル画像 ＋ スペック表 */
.product-main-section {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.gallery-section {
  flex: 1;
}

.sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.sample-grid-item {
  aspect-ratio: 16 / 9;
  border: 1px solid #444;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  background-color: #111;
}

.sample-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s, transform 0.2s;
}

.sample-grid-item:hover img {
  opacity: 0.8;
  transform: scale(1.05);
}

/* メタ情報（スペック表） */
.product-meta-box {
  width: 280px;
  background-color: #1a1a1a;
  border: 1px solid #333;
  padding: 12px;
  border-radius: 4px;
}

.meta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.meta-table th {
  text-align: left;
  color: #888;
  padding: 6px 0;
  width: 85px;
  font-weight: normal;
  border-bottom: 1px solid #2a2a2a;
}

.meta-table td {
  color: #ddd;
  padding: 6px 0;
  border-bottom: 1px solid #2a2a2a;
}

.cast-name {
  color: #4db2ff;
  text-decoration: underline;
  cursor: pointer;
}

.cast-name:hover {
  color: #80c8ff;
}

/* ==========================================================================
   6. サイドバー (Sidebar Video List)
   ========================================================================== */
.sidebar {
  width: 280px;
  background-color: #1a1a1a;
  border-left: 1px solid #333;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 12px;
  border-bottom: 1px solid #333;
  background-color: #141414;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-title {
  font-weight: bold;
  font-size: 0.85rem;
  color: #eee;
}

.remain-badge {
  font-size: 0.75rem;
  color: #888;
}

.remain-badge strong {
  color: #d00000;
}

.search-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #444;
  border-radius: 3px;
  background-color: #2a2a2a;
  color: #fff;
  font-size: 0.8rem;
  outline: none;
}

.search-input:focus {
  border-color: #d00000;
}

/* リストアイテム */
.item-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item-card {
  background-color: #222;
  border: 1px solid #333;
  border-radius: 3px;
  padding: 6px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: center;
  transition: all 0.2s;
}

.item-card:hover {
  border-color: #666;
  background-color: #2a2a2a;
}

.item-card.active {
  border-color: #d00000;
  background-color: #381515;
}

.item-card.used {
  opacity: 0.4;
}

.item-thumb {
  width: 50px;
  height: 38px;
  object-fit: cover;
  border-radius: 2px;
  background-color: #000;
  flex-shrink: 0;
}

.item-title {
  font-size: 0.75rem;
  line-height: 1.3;
  color: #ccc;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   7. 下部操作バー (Bottom Control Bar)
   ========================================================================== */
.bottom-bar {
  background-color: #111;
  border-top: 1px solid #333;
  padding: 10px;
  display: flex;
  justify-content: center;
  position: sticky;
  bottom: 0;
  z-index: 90;
}

.control-group {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 400px;
}

.btn-action {
  border: none;
  padding: 10px;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background-color 0.2s;
}

.btn-primary {
  background-color: #d00000;
  color: #fff;
  flex: 2;
}

.btn-primary:hover {
  background-color: #b00000;
}

.btn-danger {
  background-color: #444;
  color: #fff;
  flex: 1;
}

.btn-danger:hover {
  background-color: #555;
}

/* ==========================================================================
   8. 画像拡大モーダル (Image Modal)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  position: relative;
  width: 100vw;
  height: 100vh;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.modal-close-btn {
  position: absolute;
  top: 10px;
  right: 16px;
  background: transparent;
  border: none;
  color: #aaa;
  font-size: 2rem;
  cursor: pointer;
  z-index: 20;
}

.modal-close-btn:hover {
  color: #fff;
}

.modal-header-title {
  font-size: 0.9rem;
  color: #ccc;
  padding: 8px 40px 8px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-main-view {
  position: relative;
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
}

.modal-main-view img {
  max-width: 90vw;
  max-height: 70vh;
  object-fit: contain;
  box-shadow: 0 0 20px rgba(0,0,0,0.8);
}

.modal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  font-size: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background-color 0.2s;
}

.modal-arrow:hover {
  background-color: #d00000;
}

.modal-arrow.prev { left: 20px; }
.modal-arrow.next { right: 20px; }

.modal-thumbs-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  justify-content: center;
  padding: 10px 0;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-thumb {
  width: 60px;
  height: 40px;
  object-fit: cover;
  border-radius: 2px;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.5;
  flex-shrink: 0;
  transition: opacity 0.2s, border-color 0.2s;
}

.modal-thumb:hover {
  opacity: 0.9;
}

.modal-thumb.active {
  border-color: #d00000;
  opacity: 1;
}

/* ==========================================================================
   9. レスポンシブ対応 (Responsive)
   ========================================================================== */
@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: 250px;
    border-left: none;
    border-top: 1px solid #333;
  }
  .product-main-section {
    flex-direction: column;
  }
  .product-meta-box {
    width: 100%;
  }
}