/* =========================================================
   1. 変数・テーマ（モダンなデザインシステム）
   ========================================================= */
:root {
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-text: #0f172a;
  --color-muted: #64748b;
  --color-primary: #059669;
  --color-primary-dark: #047857;
  --color-primary-light: #10b981;
  --color-primary-bg: #d1fae5;
  --color-danger: #dc2626;
  --color-danger-light: #fee2e2;
  --color-danger-bg: #fef2f2;
  --color-success: #059669;
  --color-success-light: #d1fae5;
  --color-success-bg: #ecfdf5;
  --color-warning: #d97706;
  --color-warning-bg: #fef3c7;
  --color-info: #0284c7;
  --color-info-bg: #e0f2fe;
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 24px rgba(0,0,0,0.12);
  --shadow-xl: 0 20px 40px rgba(0,0,0,0.15);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* タイポグラフィ - 統一されたフォントサイズ */
  --font-size-xs: 0.75rem;    /* 12px - 最小テキスト */
  --font-size-sm: 0.875rem;   /* 14px - 補助テキスト、ラベル */
  --font-size-base: 1rem;     /* 16px - 本文、標準テキスト */
  --font-size-lg: 1.125rem;   /* 18px - 強調テキスト */
  --font-size-xl: 1.25rem;    /* 20px - 小見出し */
  --font-size-2xl: 1.5rem;    /* 24px - 中見出し */
  --font-size-3xl: 1.75rem;   /* 28px - 大見出し、ページタイトル */
  --font-size-4xl: 2rem;      /* 32px - 特大見出し */
  
  /* ボタンサイズ - 統一されたボタン */
  --btn-padding-sm-y: 0.625rem;   /* 10px */
  --btn-padding-sm-x: 1.25rem;    /* 20px */
  --btn-font-size-sm: 0.875rem;   /* 14px */
  --btn-height-sm: 2.25rem;       /* 36px */
  
  --btn-padding-md-y: 0.875rem;   /* 14px */
  --btn-padding-md-x: 1.75rem;    /* 28px */
  --btn-font-size-md: 1rem;       /* 16px */
  --btn-height-md: 2.75rem;       /* 44px */
  
  --btn-padding-lg-y: 1rem;       /* 16px */
  --btn-padding-lg-x: 2rem;       /* 32px */
  --btn-font-size-lg: 1.125rem;   /* 18px */
  --btn-height-lg: 3.25rem;       /* 52px */
  
  /* フォーム要素サイズ */
  --input-padding-y: 0.875rem;
  --input-padding-x: 1rem;
  --input-font-size: 1rem;
  --input-height: 2.75rem;
  
  /* スペーシング */
  --spacing-xs: 0.25rem;   /* 4px */
  --spacing-sm: 0.5rem;    /* 8px */
  --spacing-md: 1rem;      /* 16px */
  --spacing-lg: 1.5rem;    /* 24px */
  --spacing-xl: 2rem;      /* 32px */
  --spacing-2xl: 3rem;     /* 48px */
}

[data-theme="dark"] {
  --color-bg: #121212;
  --color-surface: #1e1e1e;
  --color-text: #eee;
  --color-muted: #9ca3af;
}

/* =========================================================
   2. ベース
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  font-size: var(--font-size-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 統一された見出しスタイル */
h1, .h1 {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 var(--spacing-md) 0;
  color: var(--color-text);
}

h2, .h2 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 var(--spacing-md) 0;
  color: var(--color-text);
}

h3, .h3 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 var(--spacing-sm) 0;
  color: var(--color-text);
}

h4, .h4 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  line-height: 1.5;
  margin: 0 0 var(--spacing-sm) 0;
  color: var(--color-text);
}

p {
  font-size: var(--font-size-base);
  line-height: 1.6;
  margin: 0 0 var(--spacing-md) 0;
}

img {
  max-width:none;
  display: block;
  border-radius: 8px;
}

a {
  color: inherit;
}

/* =========================================================
   3. ヘッダー / トップバー
   ========================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 56px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-btn,
.hamburger {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 28px;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
}

.menu-btn span,
.hamburger span {
  height: 3px;
  background: #222;
  border-radius: 999px;
}

.brand {
  font-weight: 600;
  color: #1f2937;
  text-decoration: none;
  font-size: 15px;
}

/* =========================================================
   4. ドロワー（ハンバーガーメニュー）
   JS は is-open / open をつけるだけでOK
   ========================================================= */
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: #fff;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .25s ease;
  box-shadow: 2px 0 18px rgba(0,0,0,0.08);
  z-index: 1300;
  overflow: hidden;
}

.drawer.is-open,
.drawer.open {
  transform: translateX(0);
}

.drawer__header {
  background: var(--color-primary);
  color: #fff;
  padding: 1rem 1.1rem .8rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.drawer__body,
.drawer-menu {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: .75rem .6rem 1rem;
  margin: 0;
}

.drawer-menu {
  list-style: none;
}

.drawer-menu li {
  margin-bottom: .55rem;
}

.drawer-menu a {
  display: block;
  background: linear-gradient(180deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  font-weight: 600;
  border-radius: 14px;
  padding: .7rem 1rem;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
  transition: transform .12s ease, box-shadow .12s ease;
}

.drawer-menu a:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.logout-area {
  margin-top: auto;
  padding: 1rem .6rem;
}

.logout-btn {
  display: block;
  background: linear-gradient(180deg, #d32f2f, #b71c1c);
  color: #fff;
  text-align: center;
  padding: .8rem;
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}

/* =========================================================
   5. 共通コンテナ・カード
   ========================================================= */
.page-wrapper,
.container,
main {
  max-width:none;
  width: 100%;
  margin: 0;
  padding: 80px 10px 72px;
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--color-border-light);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* ページロード時のアニメーション */
main {
  animation: fadeIn 0.5s ease-out forwards;
}

.card-modern {
  animation: fadeInUp 0.6s ease-out forwards;
  opacity: 0;
}

/* =========================================================
   6. 共通ボタン
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: var(--btn-padding-md-y) var(--btn-padding-md-x);
  min-height: var(--btn-height-md);
  border-radius: var(--radius-full);
  border: none;
  text-decoration: none;
  font-weight: 600;
  font-size: var(--btn-font-size-md);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

/* ボタンサイズバリエーション */
.btn-sm {
  padding: var(--btn-padding-sm-y) var(--btn-padding-sm-x);
  min-height: var(--btn-height-sm);
  font-size: var(--btn-font-size-sm);
}

.btn-lg {
  padding: var(--btn-padding-lg-y) var(--btn-padding-lg-x);
  min-height: var(--btn-height-lg);
  font-size: var(--btn-font-size-lg);
}

/* 全幅ボタン */
.btn-block {
  width: 100%;
  display: flex;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
}

.btn-secondary {
  background: var(--color-primary-bg);
  color: var(--color-primary-dark);
  border: 1px solid var(--color-primary-light);
}

.btn-secondary:hover {
  background: var(--color-primary-light);
  color: #fff;
}

.btn-danger {
  background: linear-gradient(135deg, var(--color-danger), #b91c1c);
  color: #fff;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #ef4444, var(--color-danger));
}

/* =========================================================
   7. 戻る・ホーム（今回統一したやつ想定）
   ========================================================= */
.sub-nav {
  display: flex;
  gap: 10px;
  margin: 14px 0 16px;
}

.sub-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: var(--btn-padding-sm-y) var(--btn-padding-sm-x);
  min-height: var(--btn-height-sm);
  border-radius: var(--radius-full);
  font-weight: 600;
  text-decoration: none;
  font-size: var(--btn-font-size-sm);
  line-height: 1.4;
  transition: var(--transition);
}

.sub-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.05);
}

.sub-btn--primary {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #d1d5db;
}

.sub-btn--home {
  background: #e2f3e7;
  color: #0f172a;
  border: 1px solid rgba(19,92,47,0.15);
}

@media (max-width:none
  .sub-nav {
    flex-direction: column;
    align-items: flex-start;
  }
  .sub-btn {
    min-width: 180px;
  }
}

/* =========================================================
   8. 生徒メニュー・一問一答・模試
   ========================================================= */
.menu-box,
.category-card,
.exam-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  margin: 0;
  max-width:none;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  text-align: center;
  align-items: center;
}

/* 年度・カテゴリの大きいボタン */
.year-btn,
.category-btn,
.exam-btn,
.menu-btn-wide {
  display: block;
  width: 100%;
  max-width:none;
  background: linear-gradient(180deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  padding: 1rem 1.5rem;
  border-radius: 20px;
  font-size: 1.2rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
  transition: transform .15s ease;
  margin: 0;
}

.year-btn:hover,
.category-btn:hover,
.exam-btn:hover,
.menu-btn-wide:hover {
  transform: translateY(-3px);
}

/* 下の戻るボタンを中央によせる */
.bottom-buttons,
.btn-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-md);
  margin: var(--spacing-xl) 0 var(--spacing-2xl);
  flex-wrap: wrap;
  width: 100%;
}

@media (max-width:none
  .bottom-buttons,
  .btn-group {
    flex-direction: column;
    gap: var(--spacing-sm);
  }
  
  .bottom-buttons .btn,
  .btn-group .btn {
    width: 100%;
    max-width:none;
  }
}

/* =========================================================
   9. 認証画面
   ========================================================= */
.auth-wrapper {
  min-height: calc(100vh - 56px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem 1rem;
  background: #f3f5f7;
}

.auth-card {
  background: #fff;
  width: min(420px, 100%);
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.06);
  padding: 2.2rem 2.3rem 2rem;
}

.auth-input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid #d8dde2;
  border-radius: 10px;
}

/* =========================================================
   10. 管理画面
   ========================================================= */
.admin-page {
  max-width:none;
  margin: 0;
  padding: 0 1.5rem 3rem;
}

.admin-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.admin-card {
  background: #fff;
  border-radius: 18px;
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 14px 30px rgba(0,0,0,0.04);
  transition: transform .15s ease, box-shadow .15s ease;
}

.admin-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 36px rgba(0,0,0,0.08);
}
/* ハンバーガーメニュー統一版 */
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: #fff;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);  /* ← これだけで隠す */
  transition: transform .25s ease;
  z-index: 1300;
  overflow: hidden;
}

.drawer.is-open,
.drawer.open {
  transform: translateX(0);      /* ← JSでこのクラスを付ける */
}
/* ハンバーガーで使う最低限 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
}

.menu-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 28px;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
}
.menu-btn span {
  height: 3px;
  background: #222;
  border-radius: 999px;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: #fff;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .25s ease;
  z-index: 1300;
  overflow: hidden;
  box-shadow: 2px 0 18px rgba(0,0,0,0.08);
}
.drawer.is-open {
  transform: translateX(0);
}

.drawer-menu {
  list-style: none;
  margin: 0;
  padding: .75rem .6rem 1rem;
  flex: 1 1 auto;
  overflow-y: auto;
}
.drawer-menu li { margin-bottom: .55rem; }
.drawer-menu a {
  display: block;
  background: linear-gradient(180deg, #2e7d32, #1b5e20);
  color: #fff;
  text-decoration: none;
  padding: .7rem 1rem;
  border-radius: 14px;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.logout-area {
  padding: 1rem .6rem;
}
.logout-btn {
  display: block;
  background: linear-gradient(180deg, #d32f2f, #b71c1c);
  color: #fff;
  text-align: center;
  padding: .8rem;
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
}
/* header.php のサイドメニュー用（.sidebarだったやつ） */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  transform: translateX(-100%);   /* ← ここがポイント。全部隠す */
  transition: transform .25s ease;
  z-index: 1300;
  display: flex;
  flex-direction: column;
}

.sidebar.open {
  transform: translateX(0);       /* JSで .open 付けたら出す */
}
