/**
 * ============================================================
 * 人脸识别签到系统 - 全局样式表
 * ============================================================
 * 移动端优先设计，蓝色渐变主色调，卡片式布局
 * 所有页面共享此样式文件
 * ============================================================
 */

/* ===================== CSS变量定义 ===================== */
:root {
    --primary-color: #1a73e8;           /* 主色调：蓝色 */
    --primary-dark: #0d47a1;            /* 深蓝色 */
    --primary-light: #4fc3f7;           /* 浅蓝色 */
    --gradient-start: #1a73e8;          /* 渐变起始色 */
    --gradient-end: #6c63ff;            /* 渐变结束色（紫蓝色） */
    --success-color: #00c853;           /* 成功颜色 */
    --danger-color: #ff1744;            /* 危险/拒绝颜色 */
    --warning-color: #ff9100;           /* 警告颜色 */
    --text-color: #333333;              /* 文字主色 */
    --text-light: #888888;              /* 辅助文字色 */
    --bg-color: #f0f4ff;               /* 页面背景色 */
    --card-bg: #ffffff;                 /* 卡片背景色 */
    --border-radius: 12px;              /* 卡片圆角 */
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);  /* 卡片阴影 */
    --font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
}

/* ===================== 全局重置 ===================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===================== 基础标签样式 ===================== */
html, body {
    height: 100%;
    font-family: var(--font-family);
    font-size: 16px;
    color: var(--text-color);
    background: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* 所有链接无下划线 */
a {
    text-decoration: none;
    color: var(--primary-color);
}

/* 图片自适应 */
img {
    max-width: 100%;
    height: auto;
}

/* ===================== 粒子背景容器 ===================== */
#particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;  /* 放在最底层，不影响其他内容 */
    pointer-events: none;  /* 鼠标事件穿透，不影响按钮点击 */
}

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

/* ===================== 页面标题 ===================== */
.page-header {
    text-align: center;
    margin: 30px 0 25px;
    width: 100%;
}

.page-header .logo-icon {
    font-size: 48px;
    margin-bottom: 10px;
    display: block;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
}

.page-header p {
    color: var(--text-light);
    font-size: 14px;
    margin-top: 6px;
    -webkit-text-fill-color: var(--text-light);  /* 覆盖标题的渐变 */
}

/* ===================== 卡片容器 ===================== */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 24px 20px;
    width: 100%;
    max-width: 420px;
    margin-bottom: 16px;
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-1px);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #eef2f7;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title .icon {
    font-size: 20px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    margin-bottom: 6px;
}

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

/* 输入框样式 */
.form-control {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    font-size: 15px;
    font-family: var(--font-family);
    color: var(--text-color);
    background: #f8faff;
    border: 2px solid #e0e6ed;
    border-radius: 10px;
    outline: none;
    transition: all 0.3s ease;
}

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

.form-control::placeholder {
    color: #b0b8c4;
}

/* 文本域 */
textarea.form-control {
    height: auto;
    padding: 12px 14px;
    resize: vertical;
}

/* ===================== 按钮样式 ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-family);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    letter-spacing: 0.5px;
    -webkit-tap-highlight-color: transparent;  /* 移动端点击高亮去除 */
}

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

/* 主按钮（蓝色渐变） */
.btn-primary {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.3);
}

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

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

/* 成功按钮（绿色） */
.btn-success {
    background: linear-gradient(135deg, #00c853, #00e676);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 200, 83, 0.3);
}

/* 危险按钮（红色） */
.btn-danger {
    background: linear-gradient(135deg, #ff1744, #ff5252);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(255, 23, 68, 0.3);
}

/* 次要按钮（白色边框） */
.btn-secondary {
    background: #ffffff;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: #f0f7ff;
}

/* 小按钮 */
.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    width: auto;
    display: inline-flex;
}

/* 按钮组（横向排列） */
.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

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

/* ===================== 摄像头区域 ===================== */
.camera-container {
    width: 100%;
    max-width: 380px;
    margin: 0 auto 16px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    position: relative;
}

/* 摄像头视频流 */
#video {
    width: 100%;
    display: block;
    border-radius: 12px;
    background: #1a1a1a;
    min-height: 280px;
    object-fit: cover;
}

/* 拍照后的预览图 */
#capturedImage {
    width: 100%;
    display: none;
    border-radius: 12px;
}

/* 摄像头占位提示 */
.camera-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    color: #999;
    font-size: 14px;
    background: #1a1a1a;
    border-radius: 12px;
}

.camera-placeholder .icon {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* 摄像头底部操作栏 */
.camera-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    justify-content: center;
}

.camera-actions .btn {
    flex: 1;
    max-width: 180px;
}

/* ===================== 消息提示 ===================== */
.message {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 16px;
    display: none;  /* 默认隐藏，通过JS控制显示 */
    text-align: center;
    width: 100%;
    max-width: 420px;
}

.message.success {
    display: block;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.message.error {
    display: block;
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.message.info {
    display: block;
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.message.warning {
    display: block;
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

/* ===================== 加载提示 ===================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    color: var(--text-light);
    font-size: 14px;
}

.loading .spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e0e6ed;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

.badge-pending {
    background: #fff3e0;
    color: #e65100;
}

.badge-approved {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-rejected {
    background: #ffebee;
    color: #c62828;
}

.badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-fail {
    background: #ffebee;
    color: #c62828;
}

/* ===================== 表格样式（管理员用） ===================== */
.table-container {
    width: 100%;
    max-width: 800px;
    overflow-x: auto;  /* 小屏幕时水平滚动 */
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table thead {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: #ffffff;
}

.data-table th {
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: #f8faff;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* 表格中的小头像 */
.photo-thumb {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e6ed;
}

/* 空数据提示 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

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

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

/* ===================== 审核操作按钮 ===================== */
.action-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-family);
}

.action-btn.approve {
    background: #e8f5e9;
    color: #2e7d32;
}

.action-btn.approve:hover {
    background: #2e7d32;
    color: #ffffff;
}

.action-btn.reject {
    background: #ffebee;
    color: #c62828;
}

.action-btn.reject:hover {
    background: #c62828;
    color: #ffffff;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===================== 登录页面特别样式 ===================== */
.login-card {
    margin-top: 40px;
}

.login-card .form-group {
    margin-bottom: 20px;
}

/* ===================== 签到页面特别样式 ===================== */
.checkin-status {
    text-align: center;
    padding: 20px;
}

.checkin-status .status-icon {
    font-size: 64px;
    margin-bottom: 12px;
}

.checkin-status .status-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}

.checkin-status .status-detail {
    font-size: 14px;
    color: var(--text-light);
}

/* 签到结果语音播报区 */
.tts-area {
    margin-top: 12px;
    padding: 10px;
    background: #f0f7ff;
    border-radius: 8px;
    text-align: center;
    font-size: 13px;
    color: var(--primary-color);
    display: none;
}

.tts-area .voice-icon {
    font-size: 20px;
    vertical-align: middle;
    animation: voice-wave 1s ease-in-out infinite;
}

@keyframes voice-wave {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===================== 返回顶部链接 ===================== */
.back-link {
    text-align: center;
    padding: 20px 0;
    font-size: 14px;
}

.back-link a {
    color: var(--primary-color);
}

.back-link a:hover {
    text-decoration: underline;
}

/* ===================== 页脚 ===================== */
.page-footer {
    text-align: center;
    padding: 20px 0 10px;
    font-size: 12px;
    color: var(--text-light);
    width: 100%;
}

/* ===================== 响应式适配 ===================== */
/* 小屏手机（宽度小于 360px） */
@media screen and (max-width: 360px) {
    .page-container {
        padding: 12px 10px 30px;
    }
    .card {
        padding: 16px 14px;
    }
    .page-header h1 {
        font-size: 22px;
    }
    .form-control {
        height: 42px;
        font-size: 14px;
    }
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    .data-table {
        font-size: 12px;
    }
    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }
}

/* 平板及以上（宽度大于 768px） */
@media screen and (min-width: 768px) {
    .card {
        max-width: 480px;
        padding: 32px 28px;
    }
    .page-header {
        margin: 40px 0 30px;
    }
    .page-header h1 {
        font-size: 32px;
    }
    .camera-container {
        max-width: 420px;
    }
    .table-container {
        max-width: 900px;
    }
}
