/* =====================================================
   シアルパソコンスクール 受講生管理システム
   スタイルシート
   ===================================================== */

/* ---- リセット & ベース ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background-color: #f5f6fa;
}

a {
    color: #e65100;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

ul {
    list-style: none;
}

/* ---- カラー変数（CSS変数） ---- */
:root {
    --primary:       #f57c00;
    --primary-dark:  #e65100;
    --danger:        #e63946;
    --danger-dark:   #c0303c;
    --secondary:     #6c757d;
    --secondary-dark:#565e64;
    --success:       #28a745;
    --border:        #dee2e6;
    --bg-light:      #f8f9fa;
    --text-muted:    #888;
}

/* =====================================================
   ログイン画面
   ===================================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #e8f0fb;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-box {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 16px rgba(44, 123, 229, 0.12);
    padding: 40px 36px;
}

.login-title {
    font-size: 22px;
    font-weight: bold;
    color: var(--primary);
    text-align: center;
    margin-bottom: 4px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 28px;
    font-size: 13px;
}

/* =====================================================
   ナビゲーションバー
   ===================================================== */
.navbar {
    background-color: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 56px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand a {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    text-decoration: none;
    white-space: nowrap;
}

.navbar-menu {
    display: flex;
    gap: 4px;
    margin-left: 32px;
    flex: 1;
}

.navbar-menu li a {
    color: rgba(255,255,255,0.85);
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.15s;
}

.navbar-menu li a:hover,
.navbar-menu li a.active {
    background-color: rgba(255,255,255,0.2);
    color: #fff;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-name {
    color: rgba(255,255,255,0.9);
    font-size: 13px;
}

/* =====================================================
   メインコンテンツ
   ===================================================== */
.main-content {
    padding: 28px 0;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* =====================================================
   ページヘッダー
   ===================================================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-header h2 {
    font-size: 20px;
    font-weight: bold;
    color: #222;
}

.student-code-badge {
    display: inline-block;
    background: #e8f0fb;
    color: var(--primary);
    border: 1px solid #b3d0f7;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 16px;
}

/* =====================================================
   ダッシュボード 統計カード
   ===================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
    padding: 28px 20px;
    text-align: center;
    border-top: 4px solid var(--primary);
}

.stat-number {
    font-size: 42px;
    font-weight: bold;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 16px;
    color: var(--text-muted);
}

.stat-card-today {
    border-top-color: #28a745;
}
.stat-card-today .stat-number {
    color: #28a745;
}

.card-footer-link {
    margin-top: 16px;
    text-align: right;
    font-size: 13px;
}

/* =====================================================
   カード
   ===================================================== */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-light);
}

.card-header h3 {
    font-size: 16px;
    font-weight: bold;
    color: #444;
}

.card-body {
    padding: 20px;
}

.search-card {
    padding: 16px 20px;
}

/* =====================================================
   テーブル
   ===================================================== */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th {
    background-color: #f0f4fb;
    color: #555;
    font-weight: bold;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

/* ストライプ（偶数行に薄い背景） */
.table tbody tr:nth-child(even) {
    background-color: #fafbfd;
}

.table tbody tr:hover {
    background-color: #eef4fd;
}

.result-count {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.action-buttons {
    white-space: nowrap;
}

/* =====================================================
   ボタン
   ===================================================== */
.btn {
    display: inline-block;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.15s, opacity 0.15s;
    white-space: nowrap;
}

.btn:hover {
    opacity: 0.88;
    text-decoration: none;
}

/* プライマリボタン（青） */
.btn-primary {
    background-color: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

/* セカンダリボタン（グレー） */
.btn-secondary {
    background-color: var(--secondary);
    color: #fff;
}

/* 危険ボタン（赤） */
.btn-danger {
    background-color: var(--danger);
    color: #fff;
}

/* アウトラインボタン */
.btn-outline {
    background-color: transparent;
    color: var(--secondary);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background-color: var(--bg-light);
}

/* ログアウトボタン */
.btn-logout {
    background-color: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
    padding: 5px 14px;
    font-size: 13px;
}

/* 小さいボタン */
.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* ブロック幅ボタン */
.btn-block {
    display: block;
    width: 100%;
}

/* =====================================================
   フォーム
   ===================================================== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
    color: #444;
    font-size: 13px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    background-color: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44,123,229,0.15);
}

/* 横並びフォームグループ（インライン検索など） */
.form-group-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group-inline label {
    white-space: nowrap;
    font-weight: bold;
    color: #444;
    font-size: 13px;
}

.form-group-inline input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
}

.form-group-inline input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44,123,229,0.15);
}

/* 横並び2列レイアウト */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* セクション区切り */
.form-section {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section-title {
    font-size: 15px;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 16px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e8f0fb;
}

/* 検索フォーム行 */
.search-form .search-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* 必須マーク */
.required {
    color: var(--danger);
    margin-left: 2px;
}

/* フォームのアクションボタン行 */
.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

/* =====================================================
   アラート・通知
   ===================================================== */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert ul {
    padding-left: 16px;
    list-style: disc;
}

.alert-error {
    background-color: #fde8e8;
    border: 1px solid #f5c6c6;
    color: #c0303c;
}

.alert-success {
    background-color: #e8f5e9;
    border: 1px solid #c3e6cb;
    color: #1e6c2e;
}

/* =====================================================
   テキスト補助
   ===================================================== */
.text-muted {
    color: var(--text-muted);
    font-size: 13px;
}

/* =====================================================
   CSVインポート画面
   ===================================================== */

/* インポートボックス：パディングありのカード風ボックス */
.import-box {
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.09);
    margin-bottom: 24px;
}

.import-box .card-body {
    padding: 24px;
}

/* 成功テキスト（緑色） */
.result-success {
    color: var(--success);
    font-size: 15px;
}

/* エラーテキスト（赤色） */
.result-error {
    color: var(--danger);
    font-size: 15px;
}

/* エラー一覧テーブル */
.error-list {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.error-list th {
    background-color: #f0f4fb;
    color: #555;
    font-weight: bold;
    padding: 8px 12px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.error-list td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.error-list tbody tr:nth-child(even) {
    background-color: #fafbfd;
}

/* =====================================================
   会員種別バッジ
   ===================================================== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
}

/* スクール会員（青） */
.badge-school {
    background: #e3f2fd;
    color: #1565c0;
}

/* オンラインレッスン会員（緑） */
.badge-online {
    background: #e8f5e9;
    color: #2e7d32;
}

/* 出張レッスン会員（オレンジ） */
.badge-visit {
    background: #fff3e0;
    color: #e65100;
}

/* プログラミングコース（紫） */
.badge-programming {
    background: #f3e5f5;
    color: #6a1b9a;
}

/* 汎用バッジ（DBから動的に種別を取得する場合に使用） */
.badge-default {
    background: #e0e0e0;
    color: #333;
}

/* =====================================================
   フォーム入力制限・IMEモードのビジュアルフィードバック
   ===================================================== */

/* フリガナ欄：フォーカス時に紫色のボーダーと光彩でカタカナ入力を示す */
.input-kana:focus {
    border-color: #7b1fa2;
    box-shadow: 0 0 0 3px rgba(123,31,162,0.15);
}

/* 電話番号・郵便番号欄：フォーカス時にオレンジのボーダーと光彩で半角入力を示す */
.input-tel:focus,
.input-postal:focus {
    border-color: #f57c00;
    box-shadow: 0 0 0 3px rgba(245,124,0,0.15);
}

/* メール欄：フォーカス時に緑色のボーダーと光彩で半角英数字入力を示す */
.input-email:focus {
    border-color: #2e7d32;
    box-shadow: 0 0 0 3px rgba(46,125,50,0.15);
}

/* フィールド種別ヒント：ラベルの横に小さく表示するヒントテキスト */
.input-hint {
    font-size: 0.75em;
    color: #888;
    margin-left: 6px;
}

/* =====================================================
   ステータスバッジ（受講ステータス用）
   ===================================================== */

/* 受講中（緑） */
.badge-active {
    background: #e8f5e9;
    color: #2e7d32;
}

/* 修了（グレー） */
.badge-completed {
    background: #f5f5f5;
    color: #555;
}

/* 解約（赤） */
.badge-cancelled {
    background: #fde8e8;
    color: #c0303c;
}

/* =====================================================
   進捗バー（受講生詳細画面）
   ===================================================== */

/* 進捗バー外枠 */
.progress-bar-wrap {
    width: 100%;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 4px;
}

/* 進捗バー塗り部分 */
.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 5px;
    transition: width 0.3s ease;
}

/* =====================================================
   詳細画面レイアウト（受講生詳細）
   ===================================================== */

/* 2カラムグリッド */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
    margin-top: 12px;
}

/* ラベル部分 */
.detail-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: bold;
    margin-bottom: 2px;
}

/* 値部分 */
.detail-value {
    display: block;
    font-size: 14px;
    color: #333;
}

/* =====================================================
   フッター
   ===================================================== */
.footer {
    background-color: #fff;
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 40px;
}

/* ---- 月謝制バッジ ---- */
.badge-monthly { background: #fff3e0; color: #e65100; font-size: 0.75em; padding: 2px 6px; border-radius: 10px; }

/* ---- 単発バッジ ---- */
.badge-single { background: #e3f2fd; color: #1565c0; font-size: 0.75em; padding: 2px 6px; border-radius: 10px; }

/* =====================================================
   進捗管理
   ===================================================== */
.progress-section { margin-bottom: 32px; }
.progress-section-header {
    border-top: 3px solid #f57c00;
    padding: 12px 0 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.lesson-grid { display: flex; flex-direction: column; gap: 10px; }
.lesson-box {
    border: 1px solid #e0d0c0;
    border-radius: 6px;
    padding: 12px 16px;
    background: #fff;
}
.lesson-box.consumed { background: #fffdf5; }
.lesson-box.cancelled { background: #f5f5f5; color: #aaa; }
.lesson-box.pending { background: #fffbf5; border-style: dashed; }
.lesson-box-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9em;
}
.lesson-number { color: #f57c00; min-width: 30px; }
.badge-warning { background: #fff3e0; color: #e65100; padding: 2px 8px; border-radius: 10px; font-size: 0.78em; font-weight: bold; }
.badge-danger  { background: #fdecea; color: #c62828; padding: 2px 8px; border-radius: 10px; font-size: 0.78em; font-weight: bold; }
.badge-unpaid  { background: #fffde7; color: #f57f17; padding: 2px 8px; border-radius: 10px; font-size: 0.78em; }
.today-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.today-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #ead9c8;
    border-radius: 6px;
}
.today-item:hover { background: #fef6ed; }

/* =====================================================
   レイアウト: 左サイドバー
   ===================================================== */
:root {
    --topbar-height: 50px;
    --topbar-bg: #f57c00;
    --sidebar-width: 200px;
    --sidebar-bg: #fef6ed;
    --sidebar-text: #555;
    --sidebar-active-bg: #fde3c0;
    --sidebar-active-text: #d4580a;
    --sidebar-hover-bg: #fdecd8;
    --sidebar-accent: #f57c00;
}

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

body {
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    background: #f5f6fa;
    color: #333;
}

.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* 上部オレンジバー */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--topbar-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 200;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.top-bar-title {
    font-size: 0.95em;
    font-weight: bold;
    color: #fff;
    letter-spacing: 0.03em;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-bar-admin {
    font-size: 0.85em;
    color: rgba(255,255,255,0.9);
}

.top-bar-logout {
    font-size: 0.82em;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 4px;
    transition: background 0.15s;
}
.top-bar-logout:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* サイドバー（ナビのみ） */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid #ead9c8;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
    z-index: 100;
}

.sidebar-nav {
    list-style: none;
    padding: 10px 0;
}

.sidebar-nav li a {
    display: block;
    padding: 11px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 1em;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-accent);
}

.sidebar-nav li a.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-left-color: var(--sidebar-accent);
    font-weight: 600;
}

/* サイドバー区切り線 */
.sidebar-divider {
    border-top: 1px solid #e8d5c0;
    margin: 24px 16px 8px;
}

/* 下部メニュー（頻度低）：少し控えめなスタイル */
.sidebar-nav-sub li a {
    font-size: 0.85em;
    color: #aaa;
    padding: 8px 20px;
}
.sidebar-nav-sub li a:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-accent);
}
.sidebar-nav-sub li a.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-left-color: var(--sidebar-accent);
    font-weight: 600;
}

/* 受講者検索テーブル */
.search-result-table th,
.search-result-table td {
    vertical-align: middle;
}

.sidebar-logout:hover { text-decoration: underline; }

/* メインコンテンツ */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    flex: 1;
    min-height: calc(100vh - var(--topbar-height));
}

.content-body {
    padding: 24px;
}

.content-header h1 {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
}

.content-body {
    padding: 24px;
    flex: 1;
}

/* 既存のpage-headerはcontent-body内に残るので調整 */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-header h2 {
    font-size: 1.1em;
    font-weight: 600;
}
