/* ============================================================
   RED - 出席管理システム 共通スタイル v2 (Modern Red)
   ============================================================ */

:root {
    --red-dark:  #8b1a1a;
    --red-mid:   #c03333;
    --red-light: #e84040;
    --red-pale:  #fde8e8;
    --text:      #333;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    background-image: url('/Image/TCU_Red.jpg');
    background-repeat: repeat;
    background-size: 400px auto;
    background-attachment: fixed;
    font-family: 'Hiragino Kaku Gothic Pro', 'Noto Sans JP', sans-serif;
    margin: 0;
    padding: 16px;
    color: var(--text);
    min-height: 100vh;
}

/* 画像の上に半透明白オーバーレイ（文字を読みやすくする） */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.72);
    z-index: 0;
    pointer-events: none;
}

/* body の直接の子要素をオーバーレイより前面に */
body > * {
    position: relative;
    z-index: 1;
}

/* 旧 BODY BACKGROUND= 属性（画像URL）を打ち消す。background-image は残す（グラデーション用） */
body[background] { background-image: none !important; }

/* ============================================================
   サイトヘッダーバー
   ============================================================ */
.site-header {
    background: linear-gradient(90deg, var(--red-dark) 0%, var(--red-mid) 55%, var(--red-light) 100%);
    color: #fff;
    position: sticky;
    top: -16px;          /* body の padding-top を相殺してビューポート上端に吸着 */
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,.28);
    margin: -16px -16px 0 -16px;   /* body padding を打ち消して全幅に */
}
.site-header__inner {
    max-width: 980px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 52px;
    gap: 12px;
}
.site-header__logo {
    font-size: 1.5em;
    font-weight: 900;
    font-style: italic;
    color: #fff;
    text-decoration: none;
    letter-spacing: 3px;
    flex-shrink: 0;
}
.site-header__logo:hover { color: #ffd0d0; }
.site-header__tagline {
    font-size: .78em;
    opacity: .82;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.site-header__nav {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}
.site-header__username {
    font-size: .82em;
    opacity: .85;
    white-space: nowrap;
}
.site-header__nav a {
    color: #fff;
    text-decoration: none;
    font-size: .82em;
    padding: 4px 12px;
    border: 1px solid rgba(255,255,255,.45);
    border-radius: 14px;
    transition: background .18s;
    white-space: nowrap;
}
.site-header__nav a:hover { background: rgba(255,255,255,.22); }

/* ============================================================
   テーブル横スクロール
   ============================================================ */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 12px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(150,0,0,.10);
}

/* ---- スタンドアロンテーブル用ラウンドラッパー ---- */
.table-card {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 0 2px rgba(200,150,150,.9), 0 2px 8px rgba(150,0,0,.10);
    margin-bottom: 24px;
}
.table-card table {
    margin-bottom: 0 !important;
    width: 100% !important;
    max-width: none !important;
}

/* ---- グラフ画像のラウンド ---- */
img[alt="graph"] {
    border-radius: 10px;
    display: block;
    box-shadow: 0 2px 8px rgba(150,0,0,.12);
    border: 2px solid rgba(200,150,150,.9);
}

/* ============================================================
   メニューグリッド
   ============================================================ */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 820px;
    margin: 24px auto 16px;
    align-items: stretch;
}
@media (max-width: 480px) {
    .menu-grid { grid-template-columns: 1fr; }
}

.menu-card {
    background: #fef5f5;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(150,0,0,.12);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    color: inherit;
    transition: transform .18s ease, box-shadow .18s ease;
}
.menu-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(150,0,0,.24);
}
.menu-card__head {
    background: linear-gradient(135deg, var(--red-mid) 0%, var(--red-light) 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background .18s;
}
.menu-card:hover .menu-card__head {
    background: linear-gradient(135deg, var(--red-dark) 0%, var(--red-mid) 100%);
}
.menu-card__icon {
    font-size: 1.7em;
    line-height: 1;
    flex-shrink: 0;
}
.menu-card__label {
    font-size: 1.05em;
    font-weight: bold;
    font-style: italic;
}
.menu-card__body {
    background: #fef5f5;
    padding: 12px 14px;
    font-size: .88em;
    line-height: 1.6;
    color: #555;
    flex: 1;
}

/* ============================================================
   ページヘッダー
   ============================================================ */
.page-header {
    max-width: 820px;
    margin: 20px auto 12px;
    text-align: center;
}
.page-header h1 {
    font-size: clamp(1.3em, 5vw, 1.8em);
    color: var(--red-mid);
    margin: 8px 0;
}

/* ============================================================
   フッターリンク
   ============================================================ */
.page-footer {
    max-width: 820px;
    margin: 20px auto 0;
    text-align: right;
    font-size: .9em;
    padding-bottom: 16px;
}
.page-footer a { color: #888; text-decoration: none; margin-left: 12px; }
.page-footer a:hover { color: var(--red-mid); }

/* ============================================================
   出席ボタンバー
   ============================================================ */
.attend-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    max-width: 820px;
    margin: 0 auto;
}
.attend-bar .status-btn {
    display: flex;
    align-items: center;
    gap: 4px;
}
.attend-bar label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    min-height: 44px;
    padding: 6px 14px;
    background: #fde8e8;
    border: 2px solid #f5a0a0;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s, color .15s, border-color .15s;
}
.attend-bar input[type="radio"] { display: none; }
.attend-bar input[type="radio"]:checked + label {
    background: var(--red-mid);
    color: #fff;
    border-color: var(--red-mid);
}
.attend-bar input[type="radio"]:disabled + label {
    opacity: .5;
    cursor: not-allowed;
}
.attend-bar input[type="submit"] {
    min-height: 44px;
    padding: 8px 20px;
    font-size: 1em;
}

/* ============================================================
   テーブル（ストライプ＋ホバー）
   ============================================================ */
table { border-collapse: collapse; }
th, td { vertical-align: middle; }

/* data-table クラスが付いたテーブルにストライプ＋ホバー適用 */
.data-table th {
    background: var(--red-mid);
    color: #fff;
    padding: 8px 10px;
    font-size: .9em;
    white-space: nowrap;
}
.data-table td {
    padding: 7px 10px;
    border: 1px solid #f0c0c0;
}
.data-table tbody tr:nth-child(even) {
    background-color: #fff0f0;
}
.data-table tbody tr:hover {
    background-color: #fddcdc !important;
    transition: background-color .12s;
}

/* ============================================================
   見出し
   ============================================================ */
h1 { color: var(--red-mid); margin: 0 0 16px; font-size: 1.6em; }
h2 { color: var(--red-mid); font-size: 1.1em; margin: 24px 0 8px;
     border-bottom: 2px solid var(--red-mid); padding-bottom: 4px; }

/* ============================================================
   ナビゲーション（戻るリンク）
   ============================================================ */
a.back {
    display: inline-block;
    margin: 12px 0;
    color: #555;
    text-decoration: none;
    font-weight: bold;
    padding: 5px 12px;
    border-radius: 4px;
    background: rgba(192,51,51,.08);
    border: 1px solid rgba(192,51,51,.18);
    transition: background .15s, color .15s;
}
a.back:hover { color: var(--red-mid); background: rgba(192,51,51,.16); }

/* 旧スタイルの管理者ページへリンク */
a > b > font[color="BLACK"],
a > b > font[color="black"] { color: inherit; }

/* ============================================================
   ページ外側テーブル（レイアウト用）を透過
   ============================================================ */
table[width="800"],
table[width="800"][align="CENTER"],
table[width="800"][align="center"] {
    width: 100% !important;
    max-width: 980px !important;
    background: transparent !important;
    border: none !important;
    margin: 0 auto !important;
}

/* ============================================================
   旧 BGCOLOR 属性セレクタ
   ============================================================ */
[bgcolor="#FA7777"], [bgcolor="#fa7777"],
[bgcolor="#FA6666"], [bgcolor="#fa6666"],
[bgcolor="#f06666"], [bgcolor="#F06666"] {
    background-color: #f06666 !important;
    color: white !important;
}
[bgcolor="#FA3333"], [bgcolor="#fa3333"] {
    background-color: var(--red-mid) !important;
    color: white !important;
}
[bgcolor="#FA5555"], [bgcolor="#fa5555"] {
    background-color: #fae6e6;
    color: #333;
}
[bgcolor="#FABBBB"], [bgcolor="#fabbbb"] {
    background-color: #fff5f5;
}
[bgcolor="#FAA0A0"], [bgcolor="#faa0a0"] {
    background-color: #fae6e6;
}
[bgcolor="#FAAAAA"], [bgcolor="#faaaaa"] {
    background-color: #fde8e8;
}
[bgcolor="#FA8888"], [bgcolor="#fa8888"] {
    background-color: #fad0d0;
}
[bgcolor="#CA6666"], [bgcolor="#ca6666"] {
    background-color: #ca6666;
    color: white;
}
table[bgcolor="BLACK"], table[bgcolor="black"] {
    background-color: #e0e0e0 !important;
    padding: 1px !important;
}
table[bgcolor="black"] td,
table[bgcolor="BLACK"] td {
    border: 1px solid rgba(150,0,0,0.18);
}
[bgcolor="BLACK"], [bgcolor="black"] {
    background-color: #e0e0e0 !important;
    padding: 1px !important;
}

/* ============================================================
   入力フォーム
   ============================================================ */
input[type="text"],
input[type="password"],
select,
textarea {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: .95em;
    transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--red-mid);
    box-shadow: 0 0 0 2px rgba(192,51,51,.18);
}

input[type="submit"] {
    padding: 7px 18px;
    background: var(--red-mid);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: .95em;
    font-weight: bold;
    transition: background .18s, transform .1s;
}
input[type="submit"]:hover { background: #a02828; transform: translateY(-1px); }
input[type="submit"]:active { transform: translateY(0); }
input[type="submit"]:disabled { background: #aaa; cursor: not-allowed; transform: none; }

input[type="button"],
button[type="button"] {
    padding: 5px 14px;
    background: #666;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: .9em;
    transition: background .15s;
}
input[type="button"]:hover,
button[type="button"]:hover { background: #444; }

input[type="radio"],
input[type="checkbox"] { cursor: pointer; }
input[type="radio"]:disabled,
input[type="checkbox"]:disabled,
input[type="submit"]:disabled { opacity: .5; }

/* ============================================================
   HR
   ============================================================ */
hr { border: none; border-top: 2px solid var(--red-mid); margin: 12px 0; }

/* ============================================================
   メッセージ
   ============================================================ */
.msg {
    color: #155724; background: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 10px; margin-bottom: 12px; border-radius: 4px;
}
.error {
    color: #721c24; background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px; margin-bottom: 12px; border-radius: 4px;
}

/* ============================================================
   ボタンクラス (manage_users / manage_labo)
   ============================================================ */
.btn { padding: 4px 10px; border: none; border-radius: 4px;
       cursor: pointer; font-size: .9em; font-weight: bold;
       transition: opacity .15s; }
.btn:hover { opacity: .85; }
.btn-reset  { background: #f0a000; color: white; }
.btn-set    { background: var(--red-mid); color: white; }
.btn-rename { background: #f0a000; color: white; }
.btn-delete { background: var(--red-mid); color: white; }
.btn-add    { background: #3366cc; color: white; }
.btn-save   { background: #3a7d44; color: white; }
.btn-cancel { background: #888;    color: white; }
.role-admin  { color: var(--red-mid); font-weight: bold; }
.role-super  { color: #6600cc; font-weight: bold; }
.must-change { color: #f0a000; font-size: .85em; }
.warn        { color: #856404; font-size: .85em; }
.ops { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.add-form { display: flex; gap: 8px; align-items: center; margin-bottom: 20px; max-width: 780px; }
.add-form input[type=text] { padding: 6px; font-size: 1em; flex: 1; border: 1px solid #ccc; border-radius: 4px; }
.rename-input { padding: 4px 6px; font-size: .95em; width: 200px; border: 1px solid #ccc; border-radius: 4px; }
