/* LINE風シンプルデザイン - オレンジ系カラーパターン */

:root {
  /* LINE風カラーパレット - オレンジ系 */
  --primary: #ff6b35;
  --primary-light: #ff8a65;
  --primary-dark: #e64a19;
  --secondary: #ff9800;
  --accent: #ff5722;

  /* ベースカラー */
  --bg: #ffffff;
  --bg-light: #fafafa;
  --bg-gray: #f5f5f5;
  --text-primary: #212121;
  --text-secondary: #757575;
  --text-muted: #9e9e9e;

  /* ボーダーとシャドウ */
  --border: #e0e0e0;
  --border-light: #f0f0f0;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.15);

  /* サイズ */
  --radius: 8px;
  --radius-small: 4px;
  --radius-large: 12px;

  /* スペーシング */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
}

/* リセット */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-light);
  color: var(--text-primary);
  line-height: 1.5;
}

/* ヘッダー - LINE風 */
header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: var(--space-md) var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.sub {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ツールバー */
.toolbar {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  margin-top: var(--space-md);
  flex-wrap: wrap;
}

/* ボタン - LINE風 */
.btn {
  padding: var(--space-sm) var(--space-md);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

.btn:hover {
  background: var(--bg-gray);
  border-color: var(--primary);
  color: var(--primary);
}

.btn.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn.primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

/* メインコンテナ */
#app {
  display: flex;
  height: calc(100vh - 120px);
}

/* チャートエリア */
#chart {
  flex: 1;
  background: var(--bg);
  border-right: 1px solid var(--border);
  position: relative;
}

/* サイドバー - オーバーレイ表示 */
#sidebar {
  position: fixed;
  top: 0;
  right: -100%;
  width: max(35%, 380px);
  height: 100vh;
  background: var(--bg);
  overflow: auto;
  border-left: 1px solid var(--border);
  padding: var(--space-md);
  z-index: 1000;
  transition: right 0.3s ease;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
}

#sidebar.show {
  right: 0;
}

/* 閉じるボタン - 右上フロート */
.close-btn {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  width: 40px;
  height: 40px;
  border: none;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  display: none; /* 初期状態では非表示 */
  align-items: center;
  justify-content: center;
  z-index: 1002;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-hover);
}

.close-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.1);
}

.close-btn.show {
  display: flex;
}

/* 詳細オーバーレイ */
.detail-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.detail-overlay.show {
  display: flex;
}

.detail-content {
  background: var(--bg);
  border-radius: var(--radius-large);
  padding: var(--space-xl);
  max-width: 800px;
  max-height: 80vh;
  width: 100%;
  position: relative;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.close-detail-btn {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  width: 50px;
  height: 50px;
  border: none;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2001;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-hover);
}

.close-detail-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.1);
}

.detail-body {
  padding-top: var(--space-lg);
}

/* サイドバーヘッダー */
#sb-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
  background: var(--bg-light);
}

#sb-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

#sb-role {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

#sb-stars {
  font-size: 16px;
  color: var(--secondary);
  font-weight: 600;
}

.unit-header {
  background: var(--bg-gray);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  position: relative;
}

/* ナビゲーション風パンくずリスト */
.breadcrumb {
  margin-bottom: var(--space-sm);
  padding: var(--space-sm);
  position: relative;
}

.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-small);
  transition: all 0.2s ease;
  position: relative;
  background: transparent;
}

.breadcrumb-item:hover {
  color: var(--primary);
  background: rgba(255, 107, 53, 0.1);
  transform: translateY(-1px);
}

.breadcrumb-item.active {
  color: var(--primary);
  background: rgba(255, 107, 53, 0.15);
  font-weight: 600;
}

.breadcrumb-item.active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}

.breadcrumb-separator {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 12px;
  margin: 0 var(--space-xs);
}

.breadcrumb-separator::before {
  content: "›";
  font-weight: 600;
}

/* ホームアイコン */
.breadcrumb-item.home {
  padding: var(--space-xs);
  background: var(--bg-gray);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  justify-content: center;
  font-size: 14px;
}

.breadcrumb-item.home:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.1);
}

/* ナビゲーションのアニメーション */
.breadcrumb-item {
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* モバイル対応 */
@media (max-width: 768px) {
  .breadcrumb {
    margin-bottom: var(--space-md);
    padding: var(--space-sm);
  }

  .breadcrumb-nav {
    gap: 2px;
  }

  .breadcrumb-item {
    font-size: 12px;
    padding: 4px 6px;
  }

  .breadcrumb-separator {
    margin: 0 2px;
  }
}

/* ギャル感想 */
.gal-review {
  padding: 1rem;
  border: 2px solid var(--primary-light);
  border-radius: 16px;
  background-color: rgba(248, 241, 232, 0.4);
}
.gal-review img.circle {
  width: 160px;
  height: 160px;
  object-fit: cover;
  clip-path: circle(50% at 50% 50%);
}
.gal-review .gal {
  display: flex;
  align-items: center;
}
.gal-review img.text {
  height: 60px;
  object-fit: cover;
}
.gal-review ul {
  margin: 0 0 1rem 1.25rem;
  padding: 0;
}
.gal-review ul li {
  margin: 0.5rem 0;
}
.gal-review ul li p {
  font-weight: 600;
}
.gal-review ul li br {
  margin: 0.5rem 0;
}

/* ドラマ表示エリア */
.shows-container {
  padding: var(--space-lg) 0;
}

.show-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  transition: all 0.2s ease;
}

.show-item:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}

.show-item h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.show-item img {
  width: 100%;
  height: 360px;
  object-fit: contain;
  border-radius: var(--radius-small);
  margin-bottom: var(--space-sm);
}

.show-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
  font-size: 12px;
  color: var(--text-secondary);
}

.show-rating {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.rating-stars {
  color: var(--secondary);
}

.show-review {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: var(--space-sm);
  padding: var(--space-sm);
  background: var(--bg-light);
  border-radius: var(--radius-small);
  border-left: 3px solid var(--primary);
}

.show-link {
  display: block;
  text-decoration: none;
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-light);
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

.show-link:hover {
  background: var(--primary);
  color: white;
}

/* ノードカード上のドラマアイコン */
.show-icons {
  position: absolute;
  top: -8px;
  right: -8px;
  display: flex;
  gap: 2px;
  z-index: 10;
}

.show-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s ease;
  object-fit: cover;
}

.show-icon:hover {
  transform: scale(1.2);
  z-index: 15;
}

/* ノードカードの相対位置設定 */
.node {
  position: relative;
  cursor: pointer;
}

/* D3.js ノードスタイル - LINE風 */
.node-rect {
  fill: var(--bg);
  stroke: var(--border);
  stroke-width: 1px;
  rx: var(--radius);
  ry: var(--radius);
  filter: drop-shadow(var(--shadow));
  transition: all 0.2s ease;
}

.node-rect.expandable {
  fill: var(--bg-light);
  stroke: var(--primary);
  stroke-width: 2px;
}

.node-rect:hover {
  stroke: var(--primary);
  stroke-width: 2px;
  filter: drop-shadow(var(--shadow-hover));
}

.node-title {
  font-size: 12px;
  font-weight: 600;
  fill: var(--text-primary);
}

.node-sub {
  font-size: 11px;
  fill: var(--text-secondary);
}

.node-stars {
  font-size: 11px;
  fill: var(--secondary);
  font-weight: 600;
}

.link {
  fill: none;
  stroke: var(--border);
  stroke-width: 1px;
}

.highlight .node-rect {
  stroke: var(--primary);
  stroke-width: 3px;
}

/* アクティブノードのハイライト */
.node-active .node-rect {
  stroke: var(--primary);
  stroke-width: 3px;
  fill: rgba(255, 107, 53, 0.1);
  filter: drop-shadow(0 4px 12px rgba(255, 107, 53, 0.3));
}

.node-active .node-title {
  fill: var(--primary);
  font-weight: 700;
}

.node-active .node-sub {
  fill: var(--primary);
  font-weight: 600;
}

.node-active .node-stars {
  fill: var(--secondary);
  font-weight: 700;
}

/* フッター */
.footer {
  position: fixed;
  right: var(--space-md);
  bottom: var(--space-md);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: var(--space-sm);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* 星評価の色 */
.star-5 {
  color: var(--secondary);
}

.star-6 {
  color: var(--accent);
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
  /* ヘッダーの高さを調整 */
  header {
    padding: var(--space-sm) var(--space-md);
  }

  h1 {
    font-size: 18px;
    margin-bottom: var(--space-xs);
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
  }

  .toolbar .btn {
    padding: var(--space-xs) var(--space-xl);
  }

  #app {
    flex-direction: column;
    height: calc(100vh - 80px);
  }

  #sidebar {
    width: 100%;
    height: 100vh;
    right: -100%;
    padding: var(--space-sm);
  }

  #sidebar.show {
    right: 0;
  }

  .close-btn {
    top: var(--space-sm);
    right: var(--space-sm);
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  /* モバイル版詳細オーバーレイ */
  .detail-overlay {
    padding: 0;
  }

  .detail-content {
    max-width: 100%;
    max-height: 100vh;
    width: 100%;
    height: 100vh;
    border-radius: 0;
    padding: var(--space-md);
  }

  .close-detail-btn {
    top: var(--space-sm);
    right: var(--space-sm);
    width: 52px;
    height: 52px;
    font-size: 26px;
  }

  #chart {
    height: calc(100vh - 330px);
    min-height: 300px;
    overflow: hidden;
  }

  /* サイドバー内のコンテンツ調整 */
  .unit-header {
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
  }

  .unit-header h3 {
    font-size: 16px;
  }

  .breadcrumb {
    margin-bottom: var(--space-sm);
    padding: var(--space-xs);
  }

  .breadcrumb-item {
    font-size: 11px;
    padding: 2px 4px;
  }

  .show-item {
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
  }

  .show-item h4 {
    font-size: 14px;
  }

  .show-item img {
    height: 256px;
  }

  .gal-review {
    padding: var(--space-sm);
  }

  .gal-review img.circle {
    width: 80px;
    height: 80px;
  }

  .gal-review img.text {
    height: 30px;
  }
}

@media (max-width: 480px) {
  header {
    padding: var(--space-xs) var(--space-sm);
  }

  h1 {
    font-size: 16px;
    line-height: 1.2;
  }

  .toolbar {
    gap: 2px;
  }

  .toolbar .btn {
    font-size: 1rem;
    padding: 4px 6px;
  }

  #app {
    height: calc(100vh - 70px);
  }

  #sidebar {
    height: 100vh;
    right: -100%;
    padding: var(--space-xs);
  }

  #sidebar.show {
    right: 0;
  }

  .close-btn {
    top: var(--space-xs);
    right: var(--space-xs);
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  /* モバイル版詳細オーバーレイ */
  .detail-overlay {
    padding: 0;
  }

  .detail-content {
    max-width: 100%;
    max-height: 100vh;
    width: 100%;
    height: 100vh;
    border-radius: 0;
    padding: var(--space-lg);
  }

  .close-detail-btn {
    top: var(--space-xs);
    right: var(--space-xs);
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

  #chart {
    height: calc(100vh - 270px);
    min-height: 250px;
  }

  .unit-header h3 {
    font-size: 14px;
  }

  .breadcrumb-item {
    font-size: 10px;
    padding: 1px 3px;
  }

  .show-item {
    padding: var(--space-xs);
    margin-bottom: var(--space-xs);
  }

  .show-item h4 {
    font-size: 12px;
  }

  .show-item img {
    height: 150px;
  }

  .gal-review {
    padding: var(--space-xs);
  }

  .gal-review img.circle {
    width: 60px;
    height: 60px;
  }

  .gal-review img.text {
    height: 25px;
  }

  .footer {
    font-size: 10px;
    padding: 4px 6px;
    right: var(--space-xs);
    bottom: var(--space-xs);
  }
}

/* アニメーション */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.show-item {
  animation: fadeIn 0.3s ease;
}

/* スクロールバー */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-gray);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
