@import url('https://fonts.googleapis.com/css2?family=BIZ+UDPGothic:wght@400;700&display=swap');
/* =========================================================
   管理画面用 CSS（子ども向け画面とは別系統のシンプルデザイン）
   ========================================================= */

:root {
    --admin-bg:         #F4F6FA;
    --admin-card:       #FFFFFF;
    --admin-sidebar:    #1F2937;
    --admin-sidebar-2:  #374151;
    --admin-accent:     #2563EB;
    --admin-accent-2:   #1D4ED8;
    --admin-text:       #111827;
    --admin-text-muted: #6B7280;
    --admin-border:     #E5E7EB;
    --admin-success:    #10B981;
    --admin-warning:    #F59E0B;
    --admin-danger:     #EF4444;
    --admin-purple:     #8B5CF6;
}

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

body {
    font-family: -apple-system, "Segoe UI", "Yu Gothic UI", "Hiragino Sans", Meiryo, sans-serif;
    background: var(--admin-bg);
    color: var(--admin-text);
    line-height: 1.5;
    font-size: 14px;
}

a { color: var(--admin-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ ログイン画面 ============ */
.admin-login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1F2937 0%, #374151 100%);
}
.admin-login-wrap { width: 100%; max-width: 420px; padding: 24px; }
.admin-login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px 36px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}
.admin-login-head { text-align: center; margin-bottom: 28px; }
.admin-logo { font-size: 48px; margin-bottom: 10px; }
.admin-login-head h1 { font-size: 22px; font-weight: 700; color: var(--admin-text); }
.admin-login-head p  { font-size: 12px; color: var(--admin-text-muted); margin-top: 4px; }

.admin-login-foot {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--admin-border);
    font-size: 12px;
}

/* ============ フォーム ============ */
.admin-form-group { margin-bottom: 16px; }
.admin-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--admin-text);
    margin-bottom: 6px;
}
.admin-form-group input,
.admin-form-group select,
.admin-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.admin-form-group input:focus,
.admin-form-group select:focus,
.admin-form-group textarea:focus {
    outline: none;
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

/* ============ ボタン ============ */
.admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, box-shadow 0.15s;
    background: #fff;
    color: var(--admin-text);
    font-family: inherit;
}
.admin-btn:hover { text-decoration: none; }
.admin-btn-primary   { background: var(--admin-accent); color: #fff; border-color: var(--admin-accent); }
.admin-btn-primary:hover { background: var(--admin-accent-2); border-color: var(--admin-accent-2); }
.admin-btn-secondary { background: #fff; color: var(--admin-text); border-color: var(--admin-border); }
.admin-btn-secondary:hover { background: #F9FAFB; }
.admin-btn-success   { background: var(--admin-success); color: #fff; border-color: var(--admin-success); }
.admin-btn-danger    { background: var(--admin-danger);  color: #fff; border-color: var(--admin-danger); }
.admin-btn-block     { width: 100%; justify-content: center; }
.admin-btn-sm        { padding: 5px 10px; font-size: 12px; }

/* ============ アラート ============ */
.admin-alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    border-left: 3px solid;
}
.admin-alert-error   { background: #FEF2F2; color: #991B1B; border-color: var(--admin-danger);  }
.admin-alert-success { background: #ECFDF5; color: #065F46; border-color: var(--admin-success); }
.admin-alert-info    { background: #EFF6FF; color: #1E3A8A; border-color: var(--admin-accent);  }

/* ============ メインレイアウト（サイドバー＋コンテンツ）============ */
.admin-layout { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--admin-sidebar);
    color: #E5E7EB;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 16px;
    border-bottom: 1px solid var(--admin-sidebar-2);
    margin-bottom: 16px;
}
.admin-brand-icon { font-size: 28px; }
.admin-brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.admin-brand-text strong { font-size: 16px; color: #fff; }
.admin-brand-text small  { font-size: 11px; color: #9CA3AF; }

.admin-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px 16px;
    margin-bottom: 12px;
}
.admin-user-avatar {
    width: 36px; height: 36px;
    background: var(--admin-sidebar-2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.admin-user-info { display: flex; flex-direction: column; line-height: 1.2; }
.admin-user-info strong { font-size: 13px; color: #fff; }
.admin-user-info small  { font-size: 11px; color: #9CA3AF; }

.admin-nav { display: flex; flex-direction: column; flex: 1; }
.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: #D1D5DB;
    font-size: 13px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.admin-nav-item:hover {
    background: var(--admin-sidebar-2);
    color: #fff;
    text-decoration: none;
}
.admin-nav-item.active {
    background: var(--admin-sidebar-2);
    color: #fff;
    border-left-color: var(--admin-accent);
}
.admin-nav-icon  { font-size: 16px; width: 20px; text-align: center; }
.admin-nav-label { flex: 1; }

.admin-nav-spacer { flex: 1; }
.admin-nav-logout { border-top: 1px solid var(--admin-sidebar-2); margin-top: 10px; color: #FCA5A5; }
.admin-nav-logout:hover { color: #FCA5A5; background: #4B1A1A; }

/* ============ コンテンツ領域 ============ */
.admin-content {
    flex: 1;
    padding: 28px 32px;
    overflow-x: auto;
}

.admin-page-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--admin-border);
}
.admin-page-head h1 { font-size: 24px; font-weight: 700; }
.admin-page-head p  { font-size: 13px; color: var(--admin-text-muted); margin-top: 4px; }

/* ============ カード ============ */
.admin-card {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 20px;
}
.admin-card-header {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 12px;
}
.admin-card-title {
    font-size: 14px; font-weight: 700; color: var(--admin-text);
    text-transform: none; letter-spacing: 0;
}

/* ============ 統計グリッド ============ */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.admin-stat {
    background: #fff;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    padding: 18px 20px;
    border-left: 4px solid var(--admin-accent);
}
.admin-stat-label { font-size: 12px; color: var(--admin-text-muted); font-weight: 600; margin-bottom: 6px; }
.admin-stat-value { font-size: 30px; font-weight: 700; color: var(--admin-text); line-height: 1; }
.admin-stat-sub   { font-size: 11px; color: var(--admin-text-muted); margin-top: 6px; }
.admin-stat.green  { border-left-color: var(--admin-success); }
.admin-stat.yellow { border-left-color: var(--admin-warning); }
.admin-stat.purple { border-left-color: var(--admin-purple); }
.admin-stat.red    { border-left-color: var(--admin-danger); }

/* ============ テーブル ============ */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 13px;
}
.admin-table th,
.admin-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--admin-border);
}
.admin-table th {
    background: #F9FAFB;
    font-weight: 600;
    color: var(--admin-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #F9FAFB; }

.admin-table-wrap {
    background: #fff;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    overflow: hidden;
}

/* ============ バッジ ============ */
.admin-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.admin-badge-scratch   { background: #FFEDD5; color: #C2410C; }
.admin-badge-minecraft { background: #DCFCE7; color: #166534; }
.admin-badge-html      { background: #DBEAFE; color: #1E40AF; }
.admin-badge-quiz      { background: #E0F2FE; color: #075985; }
.admin-badge-practice  { background: #F3E8FF; color: #6B21A8; }
.admin-badge-success   { background: #DCFCE7; color: #166534; }
.admin-badge-warning   { background: #FEF3C7; color: #92400E; }

/* ============ タブUI ============ */
.admin-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--admin-border);
    margin: 20px 0 16px;
    overflow-x: auto;
}
.admin-tab-btn {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--admin-text-muted);
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -2px;
    white-space: nowrap;
}
.admin-tab-btn:hover { color: var(--admin-text); }
.admin-tab-btn.active {
    color: var(--admin-accent);
    border-bottom-color: var(--admin-accent);
}

.admin-tab-pane { display: none; }
.admin-tab-pane.active { display: block; }

/* 状態表示 */
.adm-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.adm-status.done   { background: #DCFCE7; color: #166534; }
.adm-status.undone { background: #F3F4F6; color: #6B7280; }

/* ============ レスポンシブ ============ */
@media (max-width: 900px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar {
        width: 100%; height: auto; position: relative;
        padding: 10px 0;
    }
    .admin-nav { flex-direction: row; flex-wrap: wrap; }
    .admin-nav-item { border-left: none; border-bottom: 3px solid transparent; }
    .admin-nav-item.active { border-left: none; border-bottom-color: var(--admin-accent); }
    .admin-nav-spacer { display: none; }
    .admin-content { padding: 20px; }
}

/* ============================================================
   ユニバーサルデザイン補正層（2026-08-28 追加）
   管理画面のレイアウトは変えず、可読性と操作性だけを底上げする。
   目標: WCAG 2.1 AA 相当（コントラスト4.5:1以上 / 本文14px以上 /
         キーボードのフォーカス可視 / 操作対象の十分な大きさ）
   ============================================================ */

:root{
    /* #F9FAFB 上で 4.47:1 と AA にわずかに届かなかったため濃くする（→ 5.9:1） */
    --admin-text-muted: #5A6474;
}

body{
    font-family:'BIZ UDPGothic','Hiragino Kaku Gothic ProN','Meiryo','Yu Gothic',sans-serif;
    font-size:15px;
    line-height:1.7;
}

/* 12〜13px の文字を最低 14px まで引き上げる */
.admin-login-head p,
.admin-btn,
.admin-btn-sm,
.admin-badge,
.admin-stat-label,
.admin-stat-sub,
.admin-table th,
.admin-table td,
.admin-nav-label,
.admin-user-info strong,
.admin-user-info small,
small{ font-size:14px!important; }

/* 危険操作のボタン。#EF4444 は白文字で 3.76:1 と AA に届かないため濃くする（→ 5.0:1） */
.admin-btn-danger{ background:#A5262C!important; border-color:#A5262C!important; color:#fff!important; }
.admin-btn-danger:hover{ filter:brightness(1.15); }

/* キーボード操作時のフォーカスを必ず見せる */
a:focus-visible,button:focus-visible,input:focus-visible,
select:focus-visible,textarea:focus-visible,[tabindex]:focus-visible{
    outline:3px solid #B45309;
    outline-offset:2px;
    border-radius:4px;
}

/* 操作対象を押しやすい大きさに */
.admin-btn{ min-height:40px; display:inline-flex; align-items:center; justify-content:center; gap:6px; }
.admin-btn-sm{ min-height:34px; }
.admin-nav-item{ min-height:44px; display:flex; align-items:center; }

/* フォーム部品の文字はスマホで自動拡大されないよう16px */
.admin-form-group input,
.admin-form-group select,
.admin-form-group textarea{ font-size:16px; min-height:44px; }

/* 現在地はサイドバーの色だけでなく左の線でも示す */
.admin-nav-item.active{ box-shadow:inset 4px 0 0 currentColor; }

/* 動きを減らす設定を尊重 */
@media (prefers-reduced-motion:reduce){
    *,*::before,*::after{ animation-duration:.001ms!important; transition-duration:.001ms!important; }
}
