/* meguri中医学スクール — コンテンツポータル */
:root {
  --bg: #f5efe4;
  --accent: #8fa984;
  --accent-dark: #6b8e4e;
  --accent-light: #c8d5b9;
  --text: #3a3a3a;
  --text-light: #757575;
  --white: #ffffff;
  --border: #e5dfd1;
  --premium: #faf5eb;
  --danger: #c25656;
  --active-color: #6b8e4e;
  --continuing-color: #7c6b9e;
  --single-color: #9e7c4e;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

#app { max-width: 520px; margin: 0 auto; padding: 0 16px 80px; }

.screen { animation: fadeIn 0.3s ease; }
.hidden { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── ヘッダー ─── */
.site-header {
  background: var(--white);
  border-bottom: 2px solid var(--accent-light);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 100%;
}

.site-header .logo {
  font-size: 15px;
  font-weight: bold;
  color: var(--accent-dark);
}

.site-header .user-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: bold;
}

.badge-active    { background: var(--active-color);     color: white; }
.badge-continuing{ background: var(--continuing-color); color: white; }
.badge-single    { background: var(--single-color);     color: white; }
.badge-admin     { background: #c25656;                  color: white; }

/* ─── カード ─── */
.card {
  background: var(--white);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.card h2 { font-size: 16px; color: var(--accent-dark); margin-bottom: 12px; }

/* ─── ボタン ─── */
.btn-primary, .btn-secondary, .btn-danger {
  display: block; width: 100%;
  padding: 13px; border: none;
  border-radius: 12px;
  font-size: 15px; font-weight: bold;
  cursor: pointer; margin-top: 10px;
  transition: opacity 0.2s, transform 0.1s;
  font-family: inherit;
  text-align: center; text-decoration: none;
}
.btn-primary  { background: var(--accent-dark); color: white; }
.btn-secondary{ background: transparent; color: var(--accent-dark); border: 1.5px solid var(--accent); }
.btn-danger   { background: var(--danger); color: white; }
.btn-small { width: auto; display: inline-block; padding: 6px 14px; font-size: 13px; margin: 4px 4px 4px 0; }

.btn-primary:active, .btn-secondary:active { transform: scale(0.98); opacity: 0.85; }
.btn-primary:disabled { background: var(--text-light); cursor: not-allowed; opacity: 0.5; }

/* ─── フォーム ─── */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--text); margin-bottom: 6px; font-weight: bold; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; font-family: inherit;
  background: var(--bg); color: var(--text);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent); background: var(--white);
}
.field textarea { resize: vertical; min-height: 80px; }

/* ─── タブ ─── */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn {
  padding: 8px 14px; border-radius: 20px;
  border: 1.5px solid var(--accent-light);
  background: var(--white); color: var(--text-light);
  font-size: 13px; font-weight: bold;
  cursor: pointer; font-family: inherit;
  transition: all 0.2s;
}
.tab-btn.active {
  background: var(--accent-dark); color: white; border-color: var(--accent-dark);
}

/* ─── コンテンツカード ─── */
.content-grid { display: flex; flex-direction: column; gap: 12px; }

.content-card {
  background: var(--white);
  border-radius: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.content-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

.content-card .cat-badge {
  font-size: 11px; font-weight: bold;
  padding: 2px 8px; border-radius: 10px;
  display: inline-block; margin-bottom: 6px;
}
.cat-text     { background: #e8f0e3; color: var(--accent-dark); }
.cat-video    { background: #e8eaf6; color: #5c6bc0; }
.cat-notice   { background: #fff3e0; color: #e65100; }
.cat-seminar  { background: #fce4ec; color: #c2185b; }
.cat-intro    { background: #f3e5f5; color: #6a1b9a; }

.content-card h3 { font-size: 15px; margin-bottom: 4px; }
.content-card .meta { font-size: 12px; color: var(--text-light); }

.role-tag {
  font-size: 10px; padding: 1px 6px; border-radius: 8px; margin-left: 6px;
  font-weight: bold; vertical-align: middle;
}
.role-active      { background: #e8f5e9; color: var(--active-color); }
.role-continuing  { background: #ede7f6; color: var(--continuing-color); }
.role-all         { background: #e3f2fd; color: #1565c0; }

/* ─── お知らせ ─── */
.announcement-item {
  padding: 14px 0;
  border-bottom: 1px dashed var(--border);
}
.announcement-item:last-child { border-bottom: none; }
.announcement-item .target-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 8px;
  font-weight: bold; display: inline-block; margin-bottom: 6px;
}
.target-all       { background: #e3f2fd; color: #1565c0; }
.target-active    { background: #e8f5e9; color: var(--active-color); }
.target-continuing{ background: #ede7f6; color: var(--continuing-color); }
.announcement-item h4 { font-size: 15px; margin-bottom: 4px; }
.announcement-item p  { font-size: 13px; color: var(--text-light); }
.announcement-item .ann-date { font-size: 11px; color: var(--text-light); margin-top: 4px; }

/* ─── チャット ─── */
.chat-container { display: flex; flex-direction: column; gap: 10px; max-height: 400px; overflow-y: auto; }
.chat-msg {
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 85%;
  font-size: 14px;
}
.chat-msg.student   { background: var(--bg); border: 1px solid var(--border); align-self: flex-start; }
.chat-msg.instructor{ background: var(--accent-dark); color: white; align-self: flex-end; }
.chat-msg .msg-name { font-size: 11px; opacity: 0.7; margin-bottom: 3px; font-weight: bold; }
.chat-msg .msg-time { font-size: 10px; opacity: 0.6; margin-top: 4px; }
.chat-input-area { display: flex; gap: 8px; margin-top: 12px; }
.chat-input-area textarea {
  flex: 1; padding: 10px; border: 1px solid var(--border);
  border-radius: 10px; font-family: inherit; font-size: 14px;
  background: var(--bg); resize: none;
}
.chat-input-area button {
  padding: 10px 16px; background: var(--accent-dark); color: white;
  border: none; border-radius: 10px; font-size: 14px; cursor: pointer;
  font-family: inherit; font-weight: bold; flex-shrink: 0;
}

/* ─── ローディング ─── */
.loader-wrap { text-align: center; padding: 60px 0; }
.loader {
  display: inline-block; width: 32px; height: 32px;
  border: 3px solid var(--accent-light);
  border-top-color: var(--accent-dark);
  border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── ボトムナビ ─── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 200;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center;
  font-size: 10px; color: var(--text-light);
  cursor: pointer; padding: 4px 12px; border-radius: 8px;
  transition: color 0.2s; background: none; border: none;
  font-family: inherit;
}
.nav-item .nav-icon { font-size: 22px; margin-bottom: 2px; }
.nav-item.active { color: var(--accent-dark); }

/* ─── ログイン画面 ─── */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px;
}
.login-box {
  width: 100%; max-width: 380px;
  background: var(--white); border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  border: 1px solid var(--border);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 20px; color: var(--accent-dark); margin-bottom: 4px; }
.login-logo p  { font-size: 13px; color: var(--text-light); }

.code-input {
  width: 100%; text-align: center; letter-spacing: 0.2em;
  font-size: 22px; font-weight: bold; padding: 16px;
  border: 2px solid var(--border); border-radius: 12px;
  background: var(--bg); color: var(--text);
  font-family: monospace; text-transform: uppercase;
}
.code-input:focus { outline: none; border-color: var(--accent); background: var(--white); }

/* ─── 管理者画面 ─── */
.admin-section { margin-bottom: 24px; }
.admin-section h3 { font-size: 15px; color: var(--accent-dark); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--accent-light); }

.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { background: var(--bg); padding: 8px 10px; text-align: left; color: var(--text-light); }
.admin-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }

.empty-state { text-align: center; padding: 40px; color: var(--text-light); font-size: 14px; }

/* ─── コンテンツ詳細 ─── */
.content-body { font-size: 15px; line-height: 1.8; }
.content-body h2 { font-size: 18px; margin: 16px 0 8px; }
.content-body h3 { font-size: 16px; margin: 12px 0 6px; color: var(--accent-dark); }
.content-body p  { margin-bottom: 12px; }
.content-body ul, .content-body ol { padding-left: 20px; margin-bottom: 12px; }
.content-body li { margin-bottom: 4px; }
.content-body strong { color: var(--accent-dark); }

.video-wrap { position: relative; padding-bottom: 56.25%; height: 0; margin: 16px 0; border-radius: 12px; overflow: hidden; }
.video-wrap iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent-dark); font-size: 14px; font-weight: bold;
  cursor: pointer; margin-bottom: 16px; background: none; border: none;
  font-family: inherit; padding: 0;
}

/* ─── 公開ランディング ─── */
.hero {
  text-align: center; padding: 48px 24px 32px;
}
.hero h1 { font-size: 26px; color: var(--accent-dark); margin-bottom: 8px; }
.hero p  { font-size: 15px; color: var(--text-light); }

.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.feature-card {
  background: var(--white); border-radius: 14px;
  padding: 16px; border: 1px solid var(--border);
  text-align: center;
}
.feature-card .icon { font-size: 28px; margin-bottom: 6px; }
.feature-card h4 { font-size: 13px; color: var(--accent-dark); font-weight: bold; }
.feature-card p  { font-size: 11px; color: var(--text-light); margin-top: 4px; }

.section-title {
  font-size: 18px; font-weight: bold; color: var(--text);
  margin: 24px 0 12px; border-left: 4px solid var(--accent-dark);
  padding-left: 12px;
}

/* ─── プロフ ─── */
.profile-card {
  background: var(--white); border-radius: 16px;
  padding: 24px; border: 1px solid var(--border);
  text-align: center; margin-bottom: 16px;
}
.profile-avatar { font-size: 60px; margin-bottom: 12px; }
.profile-card h2 { font-size: 20px; color: var(--accent-dark); }
.profile-card .title { font-size: 13px; color: var(--text-light); margin-bottom: 12px; }
.profile-card p { font-size: 14px; line-height: 1.7; text-align: left; }
