/* ===========================================
 * Layout - レイアウト構造
 * ヘッダー、サイドバー、メインコンテンツ、フッター
 * =========================================== */

/* ===========================================
 * ヘッダー
 * =========================================== */
.site-header {
  background: linear-gradient(180deg, #f8f8f8 0%, #e8e8e8 100%);
  border-bottom: 1px solid #ccc;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  width: 100%;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ヘッダー内部レイアウト（中央寄せ対応） */
.site-header .header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
}

/* ページタイトルを中央に配置 */
.site-header .page-title {
  text-align: center;
  margin: 0;
  flex: 1;
}

/* ハンバーガーボタンを右端に固定 */
.site-header .hamburger-btn {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

/* ページタイトルのリンクスタイル */
.page-title .title-number-link {
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s, transform 0.2s;
  display: inline-block;
}

.page-title .title-number-link:hover {
  opacity: 0.7;
  transform: scale(1.05);
  text-decoration: none;
}

.page-title .title-number-link:active {
  transform: scale(0.95);
}

/* 番号部分の色 */
.page-title .title-number {
  color: #007bff;
  font-weight: bold;
  font-size: 1.1em;
  cursor: pointer;
}

.page-title .title-number-link .title-number {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.page-title .title-number-link:hover .title-number {
  text-decoration-style: solid;
}

/* 種別部分（週刊ランキング・半年ランキング等）*/
.page-title .title-type {
  color: #28a745;
  font-weight: 600;
  margin: 0 0.5rem;
}

.page-title .title-period {
  color: #333;
  font-weight: normal;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-logo a {
  font-size: 24px;
  font-weight: bold;
  color: #e33;
  text-decoration: none;
}

.site-logo a:hover {
  text-decoration: none;
  opacity: 0.8;
}

.header-nav {
  display: flex;
  gap: 4px;
}

.header-nav a {
  display: inline-block;
  padding: 8px 16px;
  background: #555;
  color: #fff;
  font-size: 13px;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.2s;
}

.header-nav a:hover {
  background: #333;
  text-decoration: none;
}

/* 古いブラウザ向けフォールバック */
@supports not (position: sticky) {
  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
  }
  
  body {
    padding-top: 60px;
  }
}

/* ===========================================
 * メインレイアウト（サイドバー + コンテンツ）
 * =========================================== */
.main-container {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px;
  gap: 16px;
}

/* ---- サイドバー ---- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: 70px;
  align-self: flex-start;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}

.sidebar-section {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-bottom: 12px;
}

.sidebar-title {
  background: #f0f0f0;
  padding: 8px 12px;
  font-weight: bold;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
  margin: 0;
}

.sidebar-reset {
  display: block;
  padding: 8px 12px;
  color: var(--link-color);
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
}

.category-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 400px;
  overflow-y: auto;
}

.category-list li {
  border-bottom: 1px solid #eee;
}

.category-list li:last-child {
  border-bottom: none;
}

.category-list a {
  display: block;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-color);
  transition: background 0.15s;
}

.category-list a:hover {
  background: #f5f5f5;
  text-decoration: none;
}

.category-list a.active {
  background: #4a90d9;
  color: #fff;
}

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

/* ---- メインコンテンツ ---- */
.main-content {
  flex: 1;
  min-width: 0;
}

/* ===========================================
 * フッター
 * =========================================== */
.site-footer {
  background: #f0f0f0;
  border-top: 1px solid #ddd;
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 24px;
}
