/* =========================================================
   管理画面用 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; }

/* ============ タブ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; }
}
