/**
 * 人脸签到系统 - 样式表
 */

/* ========== 基础样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ========== 认证框样式 ========== */
.auth-box {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-box h1 {
    text-align: center;
    color: #667eea;
    font-size: 28px;
    margin-bottom: 8px;
}

.auth-box h2 {
    text-align: center;
    color: #666;
    font-size: 18px;
    font-weight: normal;
    margin-bottom: 30px;
}

/* ========== 表单样式 ========== */
.auth-form {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* ========== 按钮样式 ========== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(17, 153, 142, 0.4);
}

.btn-block {
    width: 100%;
    padding: 14px;
}

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-link {
    background: transparent;
    color: #667eea;
    text-decoration: underline;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ========== 链接样式 ========== */
.auth-links {
    text-align: center;
    color: #666;
}

.auth-links a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* ========== 提示框样式 ========== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* ========== 人脸录入/签到页面 ========== */
.face-register-box,
.checkin-box {
    background: white;
    border-radius: 16px;
    padding: 30px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.face-register-box h1,
.checkin-box h1 {
    text-align: center;
    color: #667eea;
    font-size: 24px;
    margin-bottom: 8px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
}

/* ========== 摄像头容器 ========== */
.camera-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto 20px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.camera-container video,
.camera-container img {
    width: 100%;
    height: auto;
    display: block;
}

.face-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.face-frame {
    width: 240px;
    height: 240px;
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.7);
}

.face-overlay-text {
    position: absolute;
    bottom: 15%;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    pointer-events: none;
    z-index: 10;
}

.face-overlay-text .hint {
    font-size: 13px;
    font-weight: normal;
    margin-top: 8px;
    color: #ffcc00;
}

.preview-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto 20px;
    border-radius: 12px;
    overflow: hidden;
}

.preview-container img {
    width: 100%;
    height: auto;
    display: block;
}

/* ========== 操作按钮区域 ========== */
.actions {
    text-align: center;
    margin-bottom: 20px;
}

.actions .btn {
    margin: 0 8px;
}

/* ========== 提示信息 ========== */
.tips {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    margin-top: 20px;
}

.tips h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
}

.tips ul {
    list-style: none;
    padding: 0;
}

.tips li {
    padding: 4px 0;
    color: #888;
    font-size: 13px;
}

.tips li:before {
    content: "✓ ";
    color: #38ef7d;
    font-weight: bold;
}

/* ========== 签到结果 ========== */
.result-container {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-radius: 12px;
    margin-bottom: 20px;
}

.result-icon {
    font-size: 64px;
    color: #28a745;
    margin-bottom: 16px;
}

.result-container h2 {
    color: #155724;
    margin-bottom: 20px;
}

.result-details {
    text-align: left;
    background: white;
    padding: 16px;
    border-radius: 8px;
    display: inline-block;
}

.result-details p {
    margin: 8px 0;
    color: #666;
}

.result-details span {
    color: #333;
    font-weight: 500;
}

/* ========== 统计信息 ========== */
.stats {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
    padding: 16px 32px;
    background: #f8f9fa;
    border-radius: 12px;
}

.stat-label {
    display: block;
    color: #666;
    font-size: 14px;
    margin-bottom: 4px;
}

.stat-value {
    display: inline-block;
    color: #667eea;
    font-size: 32px;
    font-weight: bold;
}

.stat-unit {
    color: #999;
    font-size: 14px;
}

/* ========== 头部信息 ========== */
.header {
    width: 100%;
    max-width: 600px;
    margin-bottom: 20px;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.username {
    font-weight: 500;
    color: #333;
}

/* ========== 签到记录页面 ========== */
.logs-box {
    background: white;
    border-radius: 16px;
    padding: 30px;
    width: 100%;
    max-width: 900px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.logs-box h1 {
    text-align: center;
    color: #667eea;
    font-size: 24px;
    margin-bottom: 24px;
}

/* 统计卡片 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 30px;
}

.stat-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.stat-card.success {
    background: #d4edda;
}

.stat-card.failed {
    background: #f8d7da;
}

.stat-card.today {
    background: #fff3cd;
}

.stat-card-value {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.stat-card.success .stat-card-value {
    color: #155724;
}

.stat-card.failed .stat-card-value {
    color: #721c24;
}

.stat-card.today .stat-card-value {
    color: #856404;
}

.stat-card-label {
    font-size: 14px;
    color: #666;
}

/* 表格样式 */
.logs-table-container {
    margin-bottom: 24px;
    overflow-x: auto;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.logs-table th,
.logs-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.logs-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.logs-table tr:hover {
    background: #f8f9fa;
}

.logs-table tr.success {
    background: #f0fff4;
}

.logs-table tr.failed {
    background: #fff5f5;
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.success {
    background: #d4edda;
    color: #155724;
}

.status-badge.failed {
    background: #f8d7da;
    color: #721c24;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.page-info {
    color: #666;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state p {
    color: #666;
    font-size: 16px;
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .auth-box,
    .face-register-box,
    .checkin-box,
    .logs-box {
        padding: 24px;
    }
    
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .face-frame {
        width: 150px;
        height: 190px;
    }
    
    .btn-large {
        padding: 14px 24px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .actions .btn {
        margin: 4px;
    }
}

/* ========== 动画效果 ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-box,
.face-register-box,
.checkin-box,
.logs-box {
    animation: fadeIn 0.5s ease-out;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 验证信息 */
.verify-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
}

.verify-info p {
    margin: 4px 0;
}

.verify-info strong {
    font-size: 16px;
}

.verify-tip {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 8px !important;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.3);
}

