/* ============================================================
   盛和塾湘军九班 - 电子签到系统样式表
   ============================================================ */

:root {
    --primary: #2563eb;
    --primary-light: #dbeafe;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --bg: #f0f4f8;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Microsoft YaHei', '微软雅黑', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== 通用组件 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-outline.active { background: var(--primary); color: #fff; }
.btn-sm { padding: 5px 14px; font-size: 13px; }
.btn-lg { padding: 12px 32px; font-size: 16px; }

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.input, .select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border .2s;
    background: #fff;
}
.input:focus, .select:focus { border-color: var(--primary); }
.label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-gray    { background: #f1f5f9; color: #475569; }

/* ===== 登录页 ===== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}
.login-box {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 360px;
    box-shadow: var(--shadow-lg);
}
.login-box h1 { font-size: 22px; text-align: center; margin-bottom: 8px; }
.login-box .subtitle {
    text-align: center; color: var(--text-light); font-size: 14px;
    margin-bottom: 28px;
}
.login-box .input-group { margin-bottom: 16px; }
.login-box .error-msg {
    color: var(--danger); font-size: 13px; text-align: center;
    margin-bottom: 12px;
}
.login-box .btn { width: 100%; padding: 12px; font-size: 16px; }

/* ===== 管理员面板 ===== */
.admin-header {
    background: #fff;
    box-shadow: var(--shadow);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.admin-header .logo { font-size: 18px; font-weight: 700; color: var(--primary); }
.admin-header .nav { display: flex; gap: 16px; align-items: center; }
.admin-header .nav a { color: var(--text-light); text-decoration: none; font-size: 14px; }
.admin-header .nav a:hover { color: var(--primary); }

.admin-container { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }

.section-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title::before {
    content: '';
    width: 4px;
    height: 18px;
    background: var(--primary);
    border-radius: 4px;
}

/* 场次卡片 */
.session-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
    border-left: 4px solid var(--border);
    transition: border-color .2s;
}
.session-card.active-morning { border-left-color: var(--success); }
.session-card.active-afternoon { border-left-color: var(--warning); }
.session-card.active-evening { border-left-color: var(--info); }

.session-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.session-card-header h3 { font-size: 18px; }

/* 统计卡片 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}
.stat-card .num { font-size: 32px; font-weight: 700; }
.stat-card .label-text { font-size: 13px; color: var(--text-light); margin-top: 4px; }

/* 签到状态表 */
.status-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    font-size: 14px;
}
.status-table th {
    background: #f8fafc;
    padding: 12px 10px;
    text-align: center;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.status-table td {
    padding: 8px 10px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}
.status-table tr:hover { background: #f8fafc; }
.status-table .group-row { background: #f1f5f9; font-weight: 600; }

/* 签到状态颜色 */
.status-ontime   { background: #dcfce7; color: #166534; font-weight: 600; }
.status-late     { background: #fef3c7; color: #92400e; font-weight: 600; }
.status-excused  { background: #dbeafe; color: #1e40af; font-weight: 600; }
.status-absent   { background: #fee2e2; color: #991b1b; font-weight: 600; }

/* 请假管理 */
.excused-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.excused-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
}
.excused-item.selected {
    background: var(--info);
    color: #fff;
    border-color: var(--info);
}
.excused-item:hover { border-color: var(--info); }

/* ===== 签到页 (手机端) ===== */
.checkin-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
}
.checkin-box {
    background: #fff;
    border-radius: 16px;
    padding: 32px 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    margin-top: 20px;
}
.checkin-box h2 {
    text-align: center;
    font-size: 22px;
    margin-bottom: 8px;
}
.checkin-box .session-tag {
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 24px;
}
.checkin-box .form-group { margin-bottom: 18px; }
.checkin-box .btn-submit {
    width: 100%;
    padding: 14px;
    font-size: 17px;
    margin-top: 8px;
}
.checkin-success {
    text-align: center;
    padding: 40px 20px;
}
.checkin-success .icon {
    width: 72px;
    height: 72px;
    background: #dcfce7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 36px;
}
.checkin-success .info-item {
    text-align: left;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}
.checkin-success .info-item .key {
    color: var(--text-light);
    display: inline-block;
    width: 70px;
}
.checkin-error {
    text-align: center;
    padding: 40px 20px;
}
.checkin-error .icon {
    width: 72px;
    height: 72px;
    background: #fee2e2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 36px;
}

/* 位置信息 */
.location-box {
    padding: 12px 14px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 16px;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.location-box .spinner {
    width: 16px; height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== QR 码页面 ===== */
.qr-wrap {
    min-height: 100vh;
    background: #1e293b;
    padding: 30px 20px;
}
.qr-title {
    text-align: center;
    color: #fff;
    font-size: 24px;
    margin-bottom: 8px;
}
.qr-subtitle {
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
    margin-bottom: 30px;
}
.qr-grid {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    max-width: 1400px;
    margin: 0 auto;
}
.qr-card {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.qr-card img {
    width: 300px;
    height: 300px;
    image-rendering: pixelated;
}
.qr-card .session-name {
    font-size: 22px;
    font-weight: 700;
    margin-top: 16px;
    color: var(--text);
}
.qr-card .hint {
    color: var(--text-light);
    font-size: 14px;
    margin-top: 8px;
}
.qr-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 20px;
    margin-top: 100px;
}

/* ===== 公共查看页 ===== */
.view-wrap {
    min-height: 100vh;
    padding: 24px 20px;
}
.view-header {
    text-align: center;
    margin-bottom: 24px;
}
.view-header h1 { font-size: 24px; color: var(--text); }
.view-header .event-name { color: var(--primary); font-weight: 700; }
.view-header .updated { color: var(--text-light); font-size: 13px; margin-top: 4px; }

/* 响应式 */
@media (max-width: 768px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .status-table { font-size: 12px; }
    .status-table th, .status-table td { padding: 6px 4px; }
    .admin-container { padding: 16px 12px; }
    .qr-grid { flex-direction: column; align-items: center; }
    .qr-card img { width: 240px; height: 240px; }
}
