/**
 * watch.css - watchページ専用スタイル
 * Geminiデザインを参考に、ニコランWEBの流儀に合わせて実装
 */

/* === 変数定義 === */
:root {
  --watch-primary: #252525;
  --watch-accent: #007bff;
  --watch-bg: #f4f5f7;
  --watch-card-bg: #ffffff;
  --watch-text: #333;
  --watch-text-sub: #666;
  --watch-border: #ddd;
  --watch-success: #28a745;
  --watch-danger: #dc3545;
  --watch-warning: #ffc107;
  --watch-info: #17a2b8;
  --watch-danime: #ff6600;
}

/* === レイアウト === */
.watch-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.watch-section {
  background: var(--watch-card-bg);
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  padding: 24px;
  margin-bottom: 24px;
}

.watch-section-title {
  font-size: 1.2rem;
  border-left: 5px solid var(--watch-primary);
  padding-left: 10px;
  margin: 0 0 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* === 基本情報セクション === */
.basic-info {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.thumb-area {
  flex: 0 0 320px;
  position: relative;
}

.thumb-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: #000;
  border-radius: 4px;
}

.thumb-noimage {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #555, #333);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  font-size: 1.2rem;
}

.play-time {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 2px 8px;
  font-size: 0.85rem;
  border-radius: 3px;
  font-family: monospace;
}

.info-area {
  flex: 1;
  min-width: 300px;
}

.video-title {
  font-size: 1.4rem;
  font-weight: bold;
  margin: 0 0 12px 0;
  line-height: 1.3;
}

.video-title a {
  color: var(--watch-text);
  text-decoration: none;
}

.video-title a:hover {
  color: var(--watch-accent);
}

/* メタ情報 */
.meta-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.meta-item {
  font-size: 0.9rem;
}

.meta-item label {
  display: block;
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 2px;
}

.meta-item span {
  font-weight: bold;
  color: var(--watch-text);
}

/* 視聴ステータスバッジ */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: bold;
  color: #fff;
}

.status-badge.normal { background-color: var(--watch-success); }
.status-badge.paid { background-color: var(--watch-danger); }
.status-badge.premium { background-color: #6f42c1; }
.status-badge.device { background-color: var(--watch-warning); color: #333; }
.status-badge.deleted { background-color: #6c757d; }
.status-badge.private { background-color: #343a40; }

/* 投稿者情報 */
.owner-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--watch-border);
}

.owner-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ccc;
  object-fit: cover;
}

.owner-detail {
  flex: 1;
}

.owner-label {
  font-size: 0.75rem;
  color: #888;
}

.owner-name {
  font-weight: bold;
  color: var(--watch-text);
}

.owner-name a {
  color: inherit;
  text-decoration: none;
}

.owner-name a:hover {
  color: var(--watch-accent);
}

/* dアニメリンク */
.danime-link {
  display: inline-block;
  background: var(--watch-danime);
  color: #fff !important;
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: bold;
  text-decoration: none;
  margin-left: auto;
}

.danime-link:hover {
  background: #e65c00;
}

/* 再up検索ボタン */
.reup-search-link {
  display: inline-block;
  background: var(--watch-info);
  color: #fff !important;
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: bold;
  text-decoration: none;
}

.reup-search-link:hover {
  background: #138496;
}

/* === リアルタイムデータセクション === */
.ranking-banner {
  background: linear-gradient(90deg, #ffd700, #ffec8b);
  color: #5a4a00;
  padding: 12px;
  text-align: center;
  font-weight: bold;
  border-radius: 4px;
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-box {
  background: #f9f9f9;
  padding: 12px;
  border-radius: 4px;
  text-align: center;
  border: 1px solid #eee;
}

.stat-box.nicoad {
  background: #fff8e1;
  border-color: #ffecb3;
}

.stat-label {
  font-size: 0.75rem;
  color: #666;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--watch-text);
}

/* 折り畳みセクション */
.collapsible-section {
  margin-bottom: 20px;
}

.collapsible-header {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 8px 0;
  user-select: none;
}

.collapsible-header::before {
  content: '▼';
  margin-right: 8px;
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.collapsible-header.collapsed::before {
  transform: rotate(-90deg);
}

.collapsible-content {
  padding: 12px 0;
}

.collapsible-content.hidden {
  display: none;
}

/* タグ */
.tags-area {
  margin-bottom: 20px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-item {
  background: #fff;
  border: 1px solid #ddd;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 0.85rem;
  color: #333;
  text-decoration: none;
  transition: all 0.2s;
}

.tag-item:hover {
  background: #eee;
  color: #333;
}

/* 説明文 */
.description-box {
  background: #fdfdfd;
  padding: 16px;
  border: 1px solid #eee;
  border-radius: 4px;
  font-size: 0.9rem;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* === ツール・外部リンク === */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  color: var(--watch-text);
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.2s;
}

.tool-btn:hover {
  background: #f0f0f0;
  color: var(--watch-text);
}

.tool-btn.highlight {
  border-color: var(--watch-primary);
  font-weight: bold;
}

.tool-btn.danime {
  background: var(--watch-danime);
  border-color: var(--watch-danime);
  color: #fff;
}

.tool-btn.danime:hover {
  background: #e65c00;
}

/* === コメント解析 === */
.comment-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.comment-tab {
  padding: 8px 16px;
  background: #e9ecef;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.comment-tab:hover {
  background: #dee2e6;
}

.comment-tab.active {
  background: var(--watch-primary);
  color: #fff;
}

.comment-table-wrapper {
  overflow-x: auto;
  margin: -24px;
  margin-top: 0;
  padding: 0 24px 24px 24px;
}

/* === 共通テーブルスタイル === */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.data-table th {
  background: #f8f9fa;
  font-weight: bold;
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: #f8f9fa;
}

.data-table td.nowrap {
  white-space: nowrap;
}

.data-table td.number {
  text-align: right;
  font-family: monospace;
}

.data-table td.comment-content {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === ニコラン的プロフィール === */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.profile-box {
  background: #f8f9fa;
  padding: 16px;
  border-radius: 8px;
  text-align: center;
}

.profile-box h3 {
  font-size: 0.9rem;
  color: #666;
  margin: 0 0 8px 0;
}

.profile-count {
  font-size: 2rem;
  font-weight: bold;
  color: var(--watch-text);
}

.profile-sub {
  font-size: 0.85rem;
  color: #888;
  margin-top: 4px;
}

.rank-highlight {
  color: var(--watch-danger);
  font-weight: bold;
}

/* === レスポンシブ === */
@media (max-width: 768px) {
  .watch-container {
    padding: 12px;
  }
  
  .watch-section {
    padding: 16px;
  }
  
  .basic-info {
    flex-direction: column;
  }
  
  .thumb-area {
    flex: none;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
  }
  
  .info-area {
    min-width: auto;
  }
  
  .video-title {
    font-size: 1.2rem;
  }
  
  .meta-list {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .owner-info {
    flex-wrap: wrap;
  }
  
  .danime-link {
    margin-left: 0;
    margin-top: 12px;
    width: 100%;
    text-align: center;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .profile-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .comment-table-wrapper {
    margin: -16px;
    margin-top: 0;
    padding: 0 16px 16px 16px;
  }
}

@media (max-width: 480px) {
  .meta-list {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .tools-grid {
    grid-template-columns: 1fr;
  }
  
  .profile-grid {
    grid-template-columns: 1fr;
  }
}
