/* ===== 人脸签到系统 - 移动端 H5 样式 ===== */

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

:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --bg: #F3F4F6;
    --card: #FFFFFF;
    --text: #1F2937;
    --text-light: #6B7280;
    --border: #E5E7EB;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

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;
    padding-bottom: env(safe-area-inset-bottom);
}

/* ===== 导航栏 ===== */
.navbar {
    background: var(--primary);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}

.navbar-title {
    font-size: 18px;
    font-weight: 600;
}

.navbar-actions {
    display: flex;
    gap: 12px;
}

.navbar-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.navbar-btn:hover {
    background: rgba(255,255,255,0.35);
}

.navbar-btn.danger {
    background: rgba(239,68,68,0.6);
}

/* ===== 容器 ===== */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
}

/* ===== 卡片 ===== */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

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

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

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.2s;
    background: #FAFAFA;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #4338CA;
}

.btn-primary:disabled {
    background: #A5B4FC;
    cursor: not-allowed;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

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

/* ===== 相机区域 ===== */
.camera-container {
    position: relative;
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    margin-bottom: 12px;
}

.camera-container video {
    width: 100%;
    display: block;
    border-radius: var(--radius);
}

.camera-container canvas {
    display: none;
}

.camera-preview {
    width: 100%;
    border-radius: var(--radius);
    display: none;
}

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

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

/* ===== 状态提示 ===== */
.status-bar {
    padding: 14px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    animation: fadeIn 0.3s;
}

.status-info {
    background: #EFF6FF;
    color: #1D4ED8;
    border: 1px solid #BFDBFE;
}

.status-success {
    background: #ECFDF5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.status-error {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

/* ===== 签到结果 ===== */
.sign-result {
    text-align: center;
    padding: 20px;
}

.sign-result .icon {
    font-size: 64px;
    margin-bottom: 12px;
}

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

.sign-result .detail {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 4px;
}

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

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.loading-text {
    font-size: 15px;
    color: var(--text-light);
}

/* ===== 记录列表 ===== */
.record-list {
    list-style: none;
}

.record-item {
    display: flex;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.record-item:last-child {
    border-bottom: none;
}

.record-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-light);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    margin-right: 12px;
    flex-shrink: 0;
}

.record-info {
    flex: 1;
}

.record-name {
    font-size: 15px;
    font-weight: 600;
}

.record-time {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 2px;
}

.record-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    background: #ECFDF5;
    color: #065F46;
    font-weight: 500;
}

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

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

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    animation: fadeIn 0.3s;
    max-width: 90%;
    text-align: center;
}

.toast-success {
    background: #065F46;
    color: white;
}

.toast-error {
    background: #991B1B;
    color: white;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== 底部导航 ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    border-top: 1px solid var(--border);
    padding: 8px 0 env(safe-area-inset-bottom);
    z-index: 100;
}

.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-light);
    font-size: 12px;
    padding: 4px 0;
}

.bottom-nav a.active {
    color: var(--primary);
}

.bottom-nav .nav-icon {
    font-size: 22px;
    margin-bottom: 2px;
}

/* ===== 图片库管理 ===== */
.face-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.face-card {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.face-card img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
}

.face-card .face-info {
    padding: 10px;
    font-size: 12px;
    color: var(--text-light);
}

.face-card .face-actions {
    padding: 8px 10px;
    display: flex;
    justify-content: flex-end;
}

.face-card .face-actions button {
    padding: 4px 12px;
    border: none;
    border-radius: 6px;
    background: var(--danger);
    color: white;
    font-size: 12px;
    cursor: pointer;
}

/* ===== 响应式 ===== */
@media (min-width: 768px) {
    .container {
        padding: 24px;
    }
    .face-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
