/* ============================================================
 * 人脸识别签到系统 - 全局样式
 *
 * 设计风格：移动端优先，科技简约，毛玻璃 + 粒子效果
 * 主色调：#1a73e8（科技蓝）
 * 字体：系统原生字体
 *
 * 作者: 人脸识别签到系统
 * ============================================================ */

/* ============================================================
 * 一、CSS 变量 & 重置
 * ============================================================ */

:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #4a90d9;
    --primary-gradient: linear-gradient(135deg, #1a73e8 0%, #6c5ce7 100%);
    --success: #0d904f;
    --danger: #d93025;
    --warning: #f9ab00;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --text-light: #9aa0a6;
    --bg-page: #0a0e27;
    --bg-card: rgba(255, 255, 255, 0.06);
    --bg-glass: rgba(255, 255, 255, 0.08);
    --border-glass: rgba(255, 255, 255, 0.12);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
        'Microsoft YaHei', 'Helvetica Neue', sans-serif;
}

/* ============================================================
 * 二、全局重置
 * ============================================================ */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg-page);
    color: #fff;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
 * 三、粒子背景容器
 * ============================================================ */

#particle-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ============================================================
 * 四、通用组件
 * ============================================================ */

/* 卡片容器 — 毛玻璃效果 */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    transition: var(--transition);
}

.glass-card:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 页面主容器 */
.page-container {
    position: relative;
    z-index: 1;
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* 页面头部 */
.page-header {
    text-align: center;
    padding: 30px 0 20px;
}

.page-header .logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 0 4px 20px rgba(26, 115, 232, 0.4);
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header p {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 4px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 6px;
}

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

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 15px;
    font-family: var(--font);
    transition: var(--transition);
    outline: none;
    -webkit-appearance: none;
}

.form-input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
}

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

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
}

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

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 6px 24px rgba(26, 115, 232, 0.5);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #0d904f 0%, #0db46c 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(13, 144, 79, 0.35);
}

.btn-danger {
    background: linear-gradient(135deg, #d93025 0%, #e37470 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(217, 48, 37, 0.35);
}

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

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

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* 摄像头预览 */
.camera-container {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    max-height: 400px;
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 12px;
}

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

/* 前置摄像头镜像 */
.camera-container video.mirrored,
.camera-container video {
    transform: scaleX(-1);
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

.camera-overlay .icon {
    font-size: 48px;
    opacity: 0.5;
}

.camera-btn-group {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

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

/* 提示信息 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow);
    max-width: 90%;
    text-align: center;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}

.toast-success {
    border-color: rgba(13, 144, 79, 0.5);
    background: rgba(13, 144, 79, 0.2);
}

.toast-error {
    border-color: rgba(217, 48, 37, 0.5);
    background: rgba(217, 48, 37, 0.2);
}

.toast-info {
    border-color: rgba(26, 115, 232, 0.5);
    background: rgba(26, 115, 232, 0.2);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

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

.badge-pending {
    background: rgba(249, 171, 0, 0.2);
    color: var(--warning);
    border: 1px solid rgba(249, 171, 0, 0.3);
}

.badge-pass {
    background: rgba(13, 144, 79, 0.2);
    color: var(--success);
    border: 1px solid rgba(13, 144, 79, 0.3);
}

.badge-reject {
    background: rgba(217, 48, 37, 0.2);
    color: var(--danger);
    border: 1px solid rgba(217, 48, 37, 0.3);
}

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

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

.empty-state p {
    font-size: 14px;
}

/* 列表 */
.list-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
    transition: var(--transition);
}

.list-card:hover {
    background: rgba(255, 255, 255, 0.1);
}

.list-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.list-card .card-title {
    font-size: 16px;
    font-weight: 600;
}

.list-card .card-sub {
    font-size: 13px;
    color: var(--text-light);
}

.list-card .card-body {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.list-card .card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* 图片头像 */
.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.1);
}

/* ============================================================
 * 五、工具类
 * ============================================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-light); }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-12 { margin-bottom: 12px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

/* ============================================================
 * 六、响应式额外适配
 * ============================================================ */

@media (max-width: 380px) {
    .page-container {
        padding: 12px 12px 30px;
    }
    .glass-card {
        padding: 16px;
    }
    .page-header h1 {
        font-size: 18px;
    }
}

/* 安全区域适配（刘海屏） */
@supports (padding-top: env(safe-area-inset-top)) {
    .page-container {
        padding-top: calc(20px + env(safe-area-inset-top));
        padding-bottom: calc(40px + env(safe-area-inset-bottom));
    }
}
