/* ============================================================
   style.css - 人脸识别签到系统 全局样式
   风格：科技深色 + 毛玻璃 + 粒子背景，移动端优先
   ============================================================ */

/* ---------- 基础重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #e8eefc;
    background: #0a0e27;
    overflow-x: hidden;
}

/* ---------- 粒子背景画布（固定铺满） ---------- */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ---------- 渐变背景层 ---------- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at top, #1a2350 0%, #0a0e27 50%, #050818 100%);
    z-index: -1;
}

/* ---------- 页面容器（居中卡片） ---------- */
.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    padding: 32px 20px 48px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 管理后台容器稍宽 */
.container.wide {
    max-width: 960px;
}

/* ---------- 毛玻璃卡片 ---------- */
.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 229, 255, 0.18);
    border-radius: 20px;
    padding: 28px 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ---------- 标题区 ---------- */
.page-title {
    text-align: center;
    margin-bottom: 6px;
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(90deg, #00e5ff, #4facfe, #00e5ff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 3s linear infinite;
}

@keyframes shine {
    to { background-position: 200% center; }
}

.page-subtitle {
    text-align: center;
    color: #8aa0c4;
    font-size: 13px;
    margin-bottom: 24px;
    letter-spacing: 1px;
}

/* ---------- 表单元素 ---------- */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 14px;
    color: #a8c0e8;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.form-label .required {
    color: #ff5b6e;
    margin-left: 2px;
}

.form-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    font-size: 15px;
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 12px;
    outline: none;
    transition: all 0.3s;
}

.form-input::placeholder {
    color: #5a6c8a;
}

.form-input:focus {
    border-color: #00e5ff;
    background: rgba(0, 229, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.12);
}

/* ---------- 摄像头区域 ---------- */
.camera-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(0, 229, 255, 0.25);
    margin-bottom: 16px;
}

.camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* 前置摄像头镜像 */
}

/* 摄像头未启动时的占位 */
.camera-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #5a6c8a;
    gap: 12px;
    background: linear-gradient(135deg, #0d1430, #0a0e27);
}

.camera-placeholder .icon {
    width: 56px;
    height: 56px;
    border: 2px solid rgba(0, 229, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* 人脸取景框 */
.face-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 62%;
    aspect-ratio: 3 / 4;
    transform: translate(-50%, -50%);
    border: 2px dashed rgba(0, 229, 255, 0.6);
    border-radius: 50% 50% 46% 46% / 60% 60% 40% 40%;
    pointer-events: none;
    box-shadow: 0 0 24px rgba(0, 229, 255, 0.2);
}

/* 扫描动画线 */
.scan-line {
    position: absolute;
    left: 5%;
    right: 5%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00e5ff, transparent);
    box-shadow: 0 0 10px #00e5ff;
    top: 20%;
    animation: scan 2.4s ease-in-out infinite;
    display: none;
}

.scan-line.active { display: block; }

@keyframes scan {
    0%, 100% { top: 20%; opacity: 0.4; }
    50% { top: 78%; opacity: 1; }
}

/* 拍照预览缩略图 */
.capture-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 16px;
    object-fit: cover;
    border: 1px solid rgba(0, 229, 255, 0.3);
    display: none;
}

/* ---------- 按钮 ---------- */
.btn {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #00b8d4, #00e5ff);
    color: #001b22;
    box-shadow: 0 6px 20px rgba(0, 229, 255, 0.35);
}

.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #a8c0e8;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-success {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: #fff;
}

.btn-row {
    display: flex;
    gap: 12px;
}

.btn-row .btn { flex: 1; }

/* ---------- 提示信息 ---------- */
.message {
    text-align: center;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    margin-top: 16px;
    display: none;
}

.message.show { display: block; animation: fadeIn 0.4s; }

.message-success {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #4ade80;
}

.message-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.message-info {
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.3);
    color: #00e5ff;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- 加载遮罩 ---------- */
.loading-mask {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 24, 0.85);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    flex-direction: column;
    gap: 18px;
}

.loading-mask.show { display: flex; }

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(0, 229, 255, 0.2);
    border-top-color: #00e5ff;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: #00e5ff;
    font-size: 15px;
    letter-spacing: 1px;
}

/* ---------- 签到结果展示 ---------- */
.result-box {
    text-align: center;
    padding: 24px 16px;
    display: none;
}

.result-box.show { display: block; animation: fadeIn 0.5s; }

.result-icon {
    font-size: 56px;
    margin-bottom: 12px;
}

.result-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.result-title.pass { color: #4ade80; }
.result-title.fail { color: #f87171; }

.result-info {
    color: #a8c0e8;
    font-size: 15px;
    line-height: 1.8;
}

.result-info b { color: #00e5ff; }

/* ---------- 管理后台列表 ---------- */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.list-count {
    font-size: 13px;
    color: #8aa0c4;
}

.list-count b { color: #00e5ff; }

.list-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(0, 229, 255, 0.12);
    border-radius: 14px;
    align-items: center;
}

.list-item .avatar {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(0, 229, 255, 0.25);
    background: #0d1430;
    flex-shrink: 0;
}

.list-item .info {
    flex: 1;
    min-width: 0;
}

.list-item .info .name {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.list-item .info .meta {
    font-size: 12px;
    color: #8aa0c4;
    line-height: 1.6;
}

.list-item .info .meta span { margin-right: 10px; }

.list-item .actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.btn-mini {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.btn-mini.success {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #fff;
}

.btn-mini.danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: #fff;
}

/* 状态标签 */
.status-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.status-0 { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.status-1 { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.status-2 { background: rgba(239, 68, 68, 0.15); color: #f87171; }

/* ---------- 表格（签到记录） ---------- */
.log-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(0, 229, 255, 0.12);
}

.log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 640px;
}

.log-table th,
.log-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid rgba(0, 229, 255, 0.1);
    color: #c8d6f0;
    white-space: nowrap;
}

.log-table th {
    color: #00e5ff;
    font-weight: 600;
    background: rgba(0, 229, 255, 0.06);
}

.log-table tr:hover td {
    background: rgba(0, 229, 255, 0.04);
}

/* ---------- 空状态 ---------- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #5a6c8a;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ---------- 底部导航 ---------- */
.nav-bar {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.nav-bar a {
    color: #6b80a8;
    font-size: 13px;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s;
}

.nav-bar a:hover,
.nav-bar a.active {
    color: #00e5ff;
    border-color: rgba(0, 229, 255, 0.4);
    background: rgba(0, 229, 255, 0.06);
}

/* ---------- 图片预览弹层（审核查看大图） ---------- */
.img-preview-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.img-preview-mask.show { display: flex; }

.img-preview-mask img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 12px;
    border: 2px solid rgba(0, 229, 255, 0.4);
}

/* ---------- 顶部导航条（管理后台） ---------- */
.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-topbar .tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-topbar .tabs a {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    text-decoration: none;
    color: #8aa0c4;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.admin-topbar .tabs a.active {
    color: #001b22;
    background: linear-gradient(135deg, #00b8d4, #00e5ff);
    border-color: transparent;
    font-weight: 600;
}

/* ---------- 响应式 ---------- */
@media (max-width: 360px) {
    .container { padding: 20px 14px; }
    .glass-card { padding: 20px 16px; }
    .page-title { font-size: 20px; }
}
