/* =============================================
   links.css — 相互リンクページ専用スタイル
   ============================================= */

/* Theme background for page */
body {
  background: var(--bg-page, #0b0b0b);
  color: var(--text-main, #e9eef3);
  font-family: "Noto Sans JP", "メイリオ", Meiryo, Arial, sans-serif;
  margin: 0;
  font-size: inherit;
}

/* ── 案内ボックス（ダーク背景） ── */
.notice-box {
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  color: var(--text-info);
  padding: 16px;
  margin-bottom: 16px;
  line-height: 1.75;
}

.notice-box h2,
.notice-box h3 {
  margin: 8px 0;
  color: var(--text-strong);
}

.notice-box p {
  margin: 6px 0;
}

/* ── 登録フォーム（ダーク背景） ── */
.register-form {
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  padding: 16px;
  margin-bottom: 18px;
}

.register-form h2 {
  color: var(--text-strong);
  margin: 0 0 12px;
}

.register-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px 12px;
  align-items: center;
}

.register-grid label {
  font-weight: 700;
  color: var(--text-info);
}

.register-grid input,
.register-grid select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-soft);
  background: var(--bg-input);
  color: var(--text-strong);
  box-sizing: border-box;
}

.register-grid select option {
  background: var(--bg-subtle);
  color: var(--text-strong);
}

.register-actions {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.register-btn {
  background: #ff7a00;
  color: #111;
  border: none;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 3px 0 #c65f00;
}

.register-btn:hover {
  background: #ff8f2a;
}

.form-note {
  font-size: 0.9em;
  color: var(--text-subtle);
}

/* ── アラート ── */
.form-alert {
  margin: 10px 0;
  padding: 10px 12px;
  border-left: 4px solid;
  font-weight: 600;
}

.form-alert.error {
  background: #2d1010;
  border-color: #c62828;
  color: #ff8a80;
}

.form-alert.success {
  background: #0d2b12;
  border-color: #2e7d32;
  color: #69f0ae;
}

/* ── リンクコード ── */
.link-kit {
  margin-top: 24px;
}

.code-box {
  background: var(--bg-subtle);
  color: var(--text-strong);
  padding: 12px;
  padding-right: 96px;
  overflow-x: auto;
  cursor: pointer;
}

.code-row {
  position: relative;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ff7a00;
  color: #1a1a1a;
  border: none;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 3px 0 #c65f00;
}

.copy-btn:hover {
  background: #ff8f2a;
}

.copy-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: var(--bg-subtle);
  color: var(--text-strong);
  padding: 10px 14px;
  border-radius: 6px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 9999;
}

.copy-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ── ロゴグリッド ── */
.logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.logo-item {
  border: 1px solid #eee;
  padding: 12px;
}

.logo-item img {
  display: block;
  margin-bottom: 4px;
  max-width: 100%;
  height: auto;
}

.hint {
  color: var(--text-subtle);
  font-size: 0.9em;
}

/* ── ジャンルタブ ── */
.tab-wrap {
  margin-top: 28px;
  border-top: 1px solid #ececec;
  padding-top: 22px;
}

.tab-buttons {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  margin-bottom: 0;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.tab-btn {
  flex: 1;
  border: none;
  border-right: 1px solid #3a3a3a;
  background: #232323;
  color: #999;
  padding: 11px 6px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 1.2;
}

.tab-btn:last-child {
  border-right: none;
}

/* 各ジャンルのアクセントカラー */
.tab-btn:nth-child(1) { --tab-color: #c2185b; }
.tab-btn:nth-child(2) { --tab-color: #6a1fc2; }
.tab-btn:nth-child(3) { --tab-color: #bf360c; }
.tab-btn:nth-child(4) { --tab-color: #0d66bf; }
.tab-btn:nth-child(5) { --tab-color: #1b6f3a; }
.tab-btn:nth-child(6) { --tab-color: #c66000; }

.tab-btn.active {
  background: var(--tab-color);
  color: #fff;
  border-right-color: rgba(0,0,0,0.15);
}

.tab-btn:hover:not(.active) {
  background: #333;
  color: #ddd;
}

/* ラベルテキスト */
.tab-label-main {
  display: inline;
}

/* デスクトップでは「相互リンク」サフィックスを非表示にして一行に収める */
.tab-label-sub {
  display: none;
}

/* カウントバッジ */
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  background: rgba(255,255,255,0.18);
  color: #fff;
  flex-shrink: 0;
}

.tab-btn:not(.active) .tab-count {
  background: rgba(255,255,255,0.06);
  color: #777;
}

/* ── パネル ── */
.genre-panel {
  display: none;
  border: 1px solid var(--border-main, #444);
  border-top: none;
  background: var(--bg-panel, #1f1f1f);
  padding: 14px;
  margin-bottom: 14px;
}

.genre-panel.active {
  display: block;
}

.mutual-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  justify-content: flex-start;
}

.mutual-item {
  border: 1px solid var(--border-main, #555);
  background: var(--bg-card, #2b2b2b);
  padding: 8px 8px 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 110px;
  min-width: 0;
  box-sizing: border-box;
}

.mutual-item .site-link {
  display: block;
  width: 88px;
  max-width: 88px;
  font-size: 12px;
  color: var(--text-main, #f0f0f0);
  text-decoration: none;
  font-weight: normal;
  line-height: 1.18;
  margin-top: 2px;
  margin-bottom: 0;
  word-break: break-all;
  white-space: normal;
  overflow-wrap: anywhere;
  max-height: 2.4em;
  overflow: hidden;
}

.mutual-item .site-link:hover {
  text-decoration: underline;
}

.mutual-item .banner-link {
  display: block;
  width: 88px;
  margin-bottom: 0;
}

.mutual-item .banner-link img {
  width: 88px;
  height: 31px;
  object-fit: contain;
  border: 1px solid #ddd;
  background: #fff;
  display: block;
  margin: 0 auto;
}

.mutual-item.just-added {
  border: 2px solid #ff2d2d;
  box-shadow: 0 0 0 2px rgba(255, 45, 45, 0.25);
  position: relative;
}

.mutual-item.just-added::before {
  content: 'NEW';
  position: absolute;
  top: -10px;
  right: 8px;
  background: #ff2d2d;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
}

.empty-note {
  color: var(--text-muted, #b0b0b0);
}

/* ── レスポンシブ ── */
@media (max-width: 900px) {
  .mutual-list {
    gap: 10px 8px;
  }
  .mutual-item {
    width: 46vw;
    max-width: 160px;
    min-width: 0;
  }
  .mutual-item .site-link {
    font-size: 11px;
    width: 88px;
    max-width: 88px;
  }
}

@media (max-width: 600px) {
  .mutual-item {
    width: 98vw;
    max-width: 98vw;
    min-width: 0;
  }
  .mutual-item .site-link {
    font-size: 12px;
    width: 88px;
    max-width: 88px;
  }
}

/* ── バナーモード切替 ── */
.banner-mode-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.banner-mode-toggle {
  display: flex;
  gap: 20px;
  margin-bottom: 2px;
}

.banner-radio-label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  color: var(--text-main, #cccccc);
  font-weight: 600;
  font-size: 14px;
  user-select: none;
}

.banner-radio-label input[type="radio"] {
  accent-color: #ff7a00;
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.banner-input-url input[type="url"],
.banner-input-upload input[type="file"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-main, #555);
  background: var(--bg-input, #1e1e1e);
  color: var(--text-main, #f0f0f0);
  box-sizing: border-box;
}

.banner-input-upload input[type="file"] {
  padding: 8px;
  cursor: pointer;
}

.banner-upload-hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted, #888);
  margin-top: 5px;
}

/* Explicit light-mode fixes requested for links page */
body.theme-light .banner-input-url input[type="url"],
body.theme-light #banner_url_input,
body.theme-light .banner-input-upload input[type="file"] {
  background: #ffffff;
  color: #000000;
  border-color: #d7dee8;
}

body.theme-light .genre-panel,
body.theme-light .mutual-item {
  background: #ffffff;
  color: #000000;
  border-color: #d7dee8;
}

body.theme-light .mutual-item .site-link,
body.theme-light .empty-note,
body.theme-light .banner-radio-label,
body.theme-light .banner-upload-hint {
  color: #000000;
}
