/* ============================================
   人脸识别闸机系统 - 全局样式
   移动端优先 | 简约科技风格 | 卡片式布局
   ============================================ */

/* ===== CSS变量（主题色） ===== */
:root {
    --primary: #4F6EF7;        /* 主色调-科技蓝 */
    --primary-light: #7B93FA;  /* 浅主色 */
    --primary-dark: #3A54D4;   /* 深主色 */
    --success: #34D399;        /* 成功-绿色 */
    --warning: #FBBF24;        /* 警告-黄色 */
    --danger: #F87171;         /* 危险-红色 */
    --bg: #0F172A;             /* 背景-深色 */
    --bg-card: #1E293B;        /* 卡片背景 */
    --bg-input: #334155;       /* 输入框背景 */
    --text: #F1F5F9;           /* 主文字色 */
    --text-muted: #94A3B8;     /* 次要文字色 */
    --border: #475569;         /* 边框色 */
    --radius: 16px;            /* 圆角大小 */
    --radius-sm: 10px;         /* 小圆角 */
    --shadow: 0 8px 32px rgba(0,0,0,0.3); /* 卡片阴影 */
}

/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===== 粒子背景画布 ===== */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ===== 主容器 ===== */
.container {
    position: relative;
    z-index: 1;
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 16px;
    min-height: 100vh;
}

/* ===== 页面标题 ===== */
.page-header {
    text-align: center;
    padding: 24px 0 16px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
}

.page-header p {
    font-size: 14px;
    color: var(--text-muted);
}

/* ===== 卡片 ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(79, 110, 247, 0.1);
}

/* ===== 表单样式 ===== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 16px; /* 手机上16px防止自动缩放 */
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.2);
}

.form-group input::placeholder {
    color: #64748B;
}

/* ===== 拍照区域 ===== */
.camera-area {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 320px;
    margin: 0 auto 18px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-input);
    border: 2px dashed var(--border);
}

.camera-area.active {
    border: 2px solid var(--primary);
}

.camera-area video,
.camera-area canvas,
.camera-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.camera-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
}

.camera-placeholder .icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.camera-placeholder p {
    font-size: 14px;
}

/* 人脸框引导 */
.face-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 70%;
    border: 2px solid rgba(79, 110, 247, 0.6);
    border-radius: 50%;
    pointer-events: none;
    animation: faceGuidePulse 2s infinite;
}

@keyframes faceGuidePulse {
    0%, 100% { border-color: rgba(79, 110, 247, 0.6); }
    50% { border-color: rgba(79, 110, 247, 0.2); }
}

/* ===== 按钮 ===== */
.btn {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 16px rgba(79, 110, 247, 0.4);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 110, 247, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #10B981);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #EF4444);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background: rgba(79, 110, 247, 0.1);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
    width: auto;
    display: inline-block;
    border-radius: 8px;
}

.btn-camera {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    margin-bottom: 12px;
}

/* ===== 提示消息（Toast） ===== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 90%;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast-success {
    background: var(--success);
    color: #fff;
}

.toast-error {
    background: var(--danger);
    color: #fff;
}

.toast-info {
    background: var(--primary);
    color: #fff;
}

/* ===== Loading遮罩 ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    flex-direction: column;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-input);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-muted);
}

/* ===== 管理员页面样式 ===== */

/* 审核列表 - 学生卡片 */
.review-card {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.review-card .avatar {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--border);
    flex-shrink: 0;
}

.review-card .info {
    flex: 1;
    min-width: 0;
}

.review-card .info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.review-card .info p {
    font-size: 13px;
    color: var(--text-muted);
}

.review-card .actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* 签到记录表格 */
.log-card {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-card .log-info h3 {
    font-size: 15px;
    font-weight: 600;
}

.log-card .log-info p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.log-card .log-result {
    text-align: right;
}

.log-card .log-result .score {
    font-size: 18px;
    font-weight: 700;
}

.log-card .log-result .score.pass {
    color: var(--success);
}

.log-card .log-result .time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* 状态标签 */
.status-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-pending {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
}

.status-approved {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
}

.status-rejected {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 14px;
}

/* 管理员导航 */
.admin-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.admin-nav a {
    flex: 1;
    padding: 10px;
    text-align: center;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.admin-nav a:hover,
.admin-nav a.active {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(79, 110, 247, 0.1);
}

/* ===== 签到结果动画 ===== */
.checkin-result {
    text-align: center;
    padding: 30px 20px;
}

.checkin-result .result-icon {
    font-size: 64px;
    margin-bottom: 12px;
}

.checkin-result .result-icon.success {
    animation: bounceIn 0.6s;
}

.checkin-result h2 {
    font-size: 22px;
    margin-bottom: 8px;
}

.checkin-result .detail {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.6;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

/* ===== 底部链接 ===== */
.footer-links {
    text-align: center;
    padding: 20px 0;
    font-size: 13px;
    color: var(--text-muted);
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    margin: 0 8px;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* ===== 密码输入框特殊样式 ===== */
.password-input-wrapper {
    position: relative;
}

.password-input-wrapper input {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

/* ===== 响应式微调 ===== */
@media (max-width: 360px) {
    .container {
        padding: 16px 12px;
    }
    .card {
        padding: 18px 14px;
    }
    .page-header h1 {
        font-size: 20px;
    }
}
