/* ============================================================
   人脸识别签到系统 - 全局样式表
   风格：移动端优先 / 粉色调科技风 / 毛玻璃效果
   ============================================================ */

/* ==================== CSS 变量 & 重置 ==================== */
:root {
    --primary:       #ff6b9d;      /* 主色调：粉色 */
    --primary-dark:  #e85a8a;      /* 深粉 */
    --primary-light: #ff8eb5;      /* 浅粉 */
    --secondary:     #c850c0;      /* 辅助色：紫色 */
    --gradient:      linear-gradient(135deg, #ff6b9d, #c850c0);
    --bg-dark:       rgba(20, 10, 30, 0.85);
    --glass-bg:      rgba(255, 255, 255, 0.12);
    --glass-border:  rgba(255, 255, 255, 0.2);
    --glass-shadow:  rgba(0, 0, 0, 0.3);
    --text-primary:  #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --text-muted:    rgba(255, 255, 255, 0.5);
    --success:       #4caf50;      /* 通过/成功 */
    --danger:        #f44336;      /* 拒绝/失败 */
    --warning:       #ff9800;      /* 待审核 */
    --radius:        16px;         /* 圆角 */
    --radius-sm:     10px;         /* 小圆角 */
    --shadow:        0 8px 32px rgba(0, 0, 0, 0.3);
    --transition:    all 0.3s ease;
}

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

html, body {
    width: 100%;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #1a0a2e 0%, #2d1b4e 50%, #1a0a2e 100%);
    color: var(--text-primary);
    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;
}

/* ==================== 页面容器 ==================== */
.page-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ==================== 毛玻璃卡片 ==================== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px 24px;
    width: 100%;
    max-width: 420px;
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 107, 157, 0.3);
}

/* ==================== 标题 & 文字 ==================== */
.page-title {
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--primary-light);
}

/* ==================== 表单样式 ==================== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;  /* 防止iOS自动缩放 */
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input.error {
    border-color: var(--danger);
}

/* ==================== 按钮样式 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.4);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.6);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #4caf50, #66bb6a);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #f44336, #ef5350);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
    width: auto;
    min-width: 80px;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

/* ==================== 摄像头区域 ==================== */
.camera-container {
    position: relative;
    width: 100%;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
    aspect-ratio: 4/3;
    margin-bottom: 16px;
}

.camera-container video,
.camera-container canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-container canvas {
    display: none;  /* 隐藏canvas，仅用作截图 */
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* 人脸框引导线 */
.face-guide {
    width: 70%;
    height: 70%;
    border: 2px dashed rgba(255, 107, 157, 0.5);
    border-radius: 50%;
    animation: pulse-guide 2s ease-in-out infinite;
}

@keyframes pulse-guide {
    0%, 100% { border-color: rgba(255, 107, 157, 0.3); }
    50%      { border-color: rgba(255, 107, 157, 0.8); }
}

/* 摄像头按钮行 */
.camera-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.camera-actions .btn {
    flex: 1;
}

/* 拍照按钮（圆形） */
.capture-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--gradient);
    border: 4px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: var(--transition);
    margin: 0 auto;
    display: block;
    position: relative;
}

.capture-btn:active {
    transform: scale(0.9);
}

.capture-btn::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    border-radius: 50%;
    background: var(--gradient);
}

/* 预览照片 */
.photo-preview {
    display: none;
    width: 100%;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 16px;
}

.photo-preview img {
    width: 100%;
    display: block;
}

/* ==================== 提示消息 ==================== */
.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: 1000;
    transition: transform 0.3s ease;
    max-width: 90%;
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast-success {
    background: rgba(76, 175, 80, 0.9);
    color: white;
}

.toast-error {
    background: rgba(244, 67, 54, 0.9);
    color: white;
}

.toast-info {
    background: rgba(33, 150, 243, 0.9);
    color: white;
}

.toast-warning {
    background: rgba(255, 152, 0, 0.9);
    color: white;
}

/* ==================== 加载动画 ==================== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ==================== 管理员表格 ==================== */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
}

.data-table th {
    font-weight: 600;
    color: var(--primary-light);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-pending {
    background: rgba(255, 152, 0, 0.2);
    color: var(--warning);
}

.status-approved {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success);
}

.status-rejected {
    background: rgba(244, 67, 54, 0.2);
    color: var(--danger);
}

.status-fail {
    background: rgba(244, 67, 54, 0.2);
    color: var(--danger);
}

/* 审核操作按钮组 */
.action-group {
    display: flex;
    gap: 8px;
}

/* ==================== 头像/照片缩略图 ==================== */
.avatar-thumb {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.photo-thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==================== 统计数据卡片 ==================== */
.stats-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    flex: 1;
    padding: 16px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==================== 底部导航/操作栏 ==================== */
.bottom-actions {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ==================== 链接样式 ==================== */
.text-link {
    color: var(--primary-light);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}

.text-link:hover {
    color: var(--primary);
}

.text-center {
    text-align: center;
}

.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-16 { margin-bottom: 16px; }

/* ==================== 成功结果展示 ==================== */
.success-animation {
    text-align: center;
    padding: 20px 0;
}

.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(76, 175, 80, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 16px;
    animation: scale-in 0.5s ease;
}

@keyframes scale-in {
    0%   { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.fail-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(244, 67, 54, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 16px;
}

.result-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.result-class {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.result-score {
    font-size: 18px;
    color: var(--primary-light);
    font-weight: 600;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* ==================== 响应式适配 ==================== */
@media (min-width: 768px) {
    .glass-card {
        padding: 40px 36px;
    }

    .page-title {
        font-size: 32px;
    }

    .camera-container {
        max-width: 500px;
        margin: 0 auto 16px;
    }

    .stats-row {
        gap: 16px;
    }

    .stat-card {
        padding: 20px;
    }
}

/* 横屏提示 */
@media (orientation: landscape) and (max-height: 500px) {
    .page-container {
        padding: 10px;
    }

    .glass-card {
        padding: 16px;
    }

    .camera-container {
        max-height: 50vh;
    }
}

/* ==================== 辅助功能 ==================== */
.hidden {
    display: none !important;
}

/* 加载中的文字动画 */
.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {
    0%   { content: ''; }
    33%  { content: '.'; }
    66%  { content: '..'; }
    100% { content: '...'; }
}
