/* base.html から切り出したスタイル。
   元は <style> タグ 1 個。中身は変更していない。 */

:root {
  --primary: #b91c1c;
  --primary-hover: #991b1b;
  --primary-light: #ef4444;
}

/* ===== ヘッダー ===== */
nav.top-nav {
  background: linear-gradient(135deg, #1a0000 0%, #4a0e0e 20%, #b91c1c 45%, #e84545 60%, #b91c1c 75%, #4a0e0e 90%, #1a0000 100%);
  background-size: 200% 100%;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(185,28,28,0.35), inset 0 1px 0 rgba(255,255,255,0.12);
  position: relative;
  z-index: 1000;
}
nav.top-nav::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255,180,180,0.5) 30%, rgba(255,255,255,0.6) 50%, rgba(255,180,180,0.5) 70%, transparent 100%);
}
nav.top-nav .brand {
  color: white;
  font-weight: bold;
  font-size: 1.2rem;
  text-decoration: none;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* 右側アイコン群 */
.nav-icons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ベルアイコン（お知らせ） */
.nav-bell {
  position: relative;
  background: none;
  border: none;
  color: rgba(255,255,255,0.88);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 6px;
  transition: background 0.2s;
  line-height: 1;
}
.nav-bell:hover { background: rgba(255,255,255,0.12); }
.nav-bell .bell-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: #fbbf24;
  border-radius: 50%;
  border: 1.5px solid #4a0e0e;
  display: none; /* 未読がある時だけJSで表示 */
}

/* お知らせドロップダウン */
.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  z-index: 2000;
  overflow: hidden;
}
.notif-dropdown.open { display: block; }
.notif-dropdown-header {
  padding: 0.85rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: #1f2937;
  border-bottom: 1px solid #f3f4f6;
}
.notif-dropdown-body {
  max-height: 300px;
  overflow-y: auto;
}
.notif-item {
  display: block;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f9fafb;
  text-decoration: none;
  color: #374151;
  font-size: 0.85rem;
  line-height: 1.45;
  transition: background 0.15s;
}
.notif-item:hover { background: #f9fafb; }
.notif-item:last-child { border-bottom: none; }
.notif-item .notif-meta {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.2rem;
}
.notif-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: #9ca3af;
  font-size: 0.85rem;
}

/* ハンバーガーボタン */
.hamburger-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.88);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 6px;
  transition: background 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  gap: 5px;
}
.hamburger-btn:hover { background: rgba(255,255,255,0.12); }
.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: white;
  border-radius: 1px;
  transition: transform 0.3s, opacity 0.3s;
}
.hamburger-btn.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.active span:nth-child(2) { opacity: 0; }
.hamburger-btn.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* スライドメニュー */
.slide-menu-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.35);
  z-index: 1500;
}
.slide-menu-overlay.open { display: block; }
.slide-menu {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  max-width: 85vw;
  height: 100%;
  background: white;
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  z-index: 2000;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.slide-menu.open { right: 0; }
.slide-menu-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.slide-menu-header .menu-title {
  font-weight: 700;
  font-size: 1rem;
  color: #1f2937;
}
.slide-menu-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #9ca3af;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}
.slide-menu-close:hover { color: #374151; }
.slide-menu-body {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
}
/* ログアウトは状態を変える操作なのでリンクでなくPOSTのボタン。
   見た目はメニューの他項目と揃えるため、同じ指定を button にも当てる。 */
.slide-menu-body a,
.slide-menu-body .logout-form button {
  display: block;
  padding: 0.85rem 1.5rem;
  text-decoration: none;
  color: #374151;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: background 0.15s, color 0.15s;
}
.slide-menu-body .logout-form { margin: 0; }
.slide-menu-body .logout-form button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 0;
  cursor: pointer;
  font-family: inherit;
}
.slide-menu-body a:hover,
.slide-menu-body .logout-form button:hover {
  background: #f9fafb;
  color: var(--primary);
}
.slide-menu-body .menu-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0.35rem 1.5rem;
}
.slide-menu-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #f3f4f6;
  font-size: 0.8rem;
  color: #9ca3af;
  text-align: center;
}

/* ===== 共通 ===== */
.badge {
  display: inline-block;
  padding: 0.2em 0.65em;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-completed { background: #dcfce7; color: #166534; }
.badge-in-progress { background: #dbeafe; color: #1e40af; }
.badge-locked { background: #f3f4f6; color: #6b7280; }
main.container { padding-top: 2rem; padding-bottom: 3rem; }

/* ホームへ戻るボタン（サブページ上部） */
.back-home {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  padding: 0.42rem 0.95rem 0.42rem 0.7rem;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  background: #fff;
  color: #6b7280;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: color .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.back-home:hover {
  color: var(--primary, #7f1d1d);
  border-color: var(--primary, #7f1d1d);
  transform: translateX(-3px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.back-home svg { width: 16px; height: 16px; display: block; }

/* ===== ニュースティッカー ===== */
.news-ticker {
  background: #1f2937;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  z-index: 999;
}
.news-ticker-track {
  display: inline-flex;
  animation: tickerScroll 30s linear infinite;
}
.news-ticker:hover .news-ticker-track { animation-play-state: paused; }
.news-ticker-item, .news-ticker-item:hover { text-decoration: none; }
.news-ticker-item {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.02em;
}
.news-ticker-item::after {
  content: '|';
  margin: 0 2.5rem;
  color: rgba(255,255,255,0.25);
}
.news-ticker-date {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.45);
  margin-right: 0.5rem;
}
.news-ticker-new {
  display: inline-block;
  background: #dc2626;
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1em 0.45em;
  border-radius: 3px;
  margin-right: 0.5rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
@keyframes tickerScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}


/* ============================================================================
   ボタン・リンクが横に並ぶ行の正規化
   ============================================================================
   同じ行に <a> と <button> を並べると崩れる。Pico の既定が3つ効いているため。

     1) `button[type=submit]` に width:100%
        … ボタンが幅を占領し、隣の <a> が押し潰されて文字が折り返す
     2) フォーム要素に margin-bottom(≒17px)
        … flex 行は align-items:stretch なので、その余白ぶんだけ隣が引き伸ばされる
     3) display が a=block / button=inline-block でバラつく

   2026-08-20 の結合テストで「キャンセルが改行される」「編集と削除の高さが違う」
   として報告された。**同じ崩れ方のCSSが5箇所に重複していて、個別に直したら
   取りこぼした**（プロフィール編集だけ直して、学びのメモとメモ編集が残った）。
   二度同じことをしないよう、ここに集約する。

   ボタンが並ぶ行を新しく作るときは、コンテナのクラスをここに足すだけでよい。
   各ページのCSSは色・余白・角丸といった見た目だけを持たせる。

   実測（before → after）:
     学びのメモ      キャンセル 86.3px / 保存 69.3px → 39.9px / 39.9px
     メモ編集        キャンセル 66.6px / 保存 49.6px → 42.6px / 42.6px
     プロフィール編集 86.3px / 69.3px → 39.9px / 39.9px
     メモ詳細        編集 53.5px / 削除 36.5px → 35.1px / 35.1px
   -------------------------------------------------------------------------- */
/* ボタン行は align-items を触らない。既定の stretch のままにしておくと、
   片方だけ枠線があっても（キャンセルは 1px / 保存は border:none）
   行の高さに揃うので**勝手に同じ高さになる**。
   崩れの原因だった「17px の余白を持つ幽霊のような背の高い項目」は
   下の margin:0 で消えるため、stretch は味方になる。
   center にすると伸縮が止まり、枠線ぶんの 2px 差が出てしまう（実測で確認）。 */
.modal-footer a,
.modal-footer button,
.note-pop-foot a,
.note-pop-foot button,
.note-detail-actions a,
.note-detail-actions button,
.form-actions a,
.form-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;      /* (1) Pico の width:100% を戻す */
  margin: 0;        /* (2) Pico の margin-bottom を消す */
  flex: 0 0 auto;   /* 縮んで折り返さないようにする */
  white-space: nowrap;
  box-sizing: border-box;
}
/* 削除ボタンなどが <form> で包まれている場合、その form も縮ませない */
.modal-footer form,
.note-pop-foot form,
.note-detail-actions form,
.form-actions form {
  display: flex;
  flex: 0 0 auto;
  margin: 0;
}

/* カテゴリのチップ（学びのメモの「すべて/セミナー/…」）。
   同じ行にある .notes-tools（教材セレクト＋🔍）の方が背が高く、
   align-items:stretch でチップが引き伸ばされて文字が上に寄っていた
   （実測: チップの自然な高さ ≒32px が 51.3px に伸びていた）。
   ここは行の縦位置を中央に揃えるだけで直る。 */
.notes-filter {
  align-items: center;
}
.notes-filter > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  white-space: nowrap;
}

/* ===== 外部サイトへ出るリンクの印（#165） =====
 *
 * ユーザーテストで「外部リンクへ飛びます、みたいな案内はあった方がいい。
 * 基本飛ばされてばっかりやし」という指摘が出た。押す前に「ここから先は別のサイト」
 * と分かる手がかりが無く、ELAの画面が続くつもりで押して別サイトに着く。
 *
 * ELA内のリンクはすべて "/" で始まる相対パスなので、**href が http で始まる＝外部**
 * で判定できる。テンプレートを1つずつ直さなくても、記事本文やお知らせに入った
 * 外部リンクにも自動で印が付く。
 *
 * 印を出さないものには .ext-none を付ける:
 *   ・カード全体を包むリンク（末尾に矢印が出ても意味を成さない）
 *   ・すでに外部リンクのアイコンを自前で持っているボタン
 */
a[href^="http"]:not(.ext-none)::after {
  content: "↗";
  display: inline-block;
  margin-left: 0.25em;
  font-size: 0.85em;
  line-height: 1;
  vertical-align: baseline;
  opacity: 0.7;
}
