/* ============================================
   考勤打卡系统 - 主样式
   ============================================ */

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

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --text: #1f2937;
    --text-light: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --bg: #f3f4f6;
    --bg-white: #ffffff;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* 顶部导航 */
.top-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
}
.header-nav {
    display: flex;
    gap: 8px;
}
.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius);
    color: var(--text-light);
    font-weight: 500;
    transition: all 0.2s;
}
.nav-link:hover, .nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-detail { display: flex; flex-direction: column; line-height: 1.3; }
.user-name { font-weight: 600; font-size: 14px; }
.user-dept { font-size: 12px; color: var(--text-muted); }
.btn-logout {
    padding: 6px;
    border-radius: var(--radius);
    color: var(--text-light);
    transition: all 0.2s;
}
.btn-logout:hover { background: var(--danger); color: white; }

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 卡片 */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 16px; font-weight: 600; }

/* 仪表盘布局 */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.clock-card { grid-column: 1; grid-row: 1 / 3; }
.stats-card { grid-column: 2; }
.records-card { grid-column: 1 / -1; }

/* 打卡区域 */
.clock-header {
    text-align: center;
    margin-bottom: 20px;
}
.clock-header h2 { font-size: 20px; margin-bottom: 4px; }
.clock-date { color: var(--text-light); font-size: 14px; }
.clock-time-display {
    text-align: center;
    padding: 30px 0;
    background: linear-gradient(135deg, var(--primary-light), #e0e7ff);
    border-radius: var(--radius);
    margin-bottom: 20px;
}
.clock-time-display .time {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}
.date-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
    color: var(--text-light);
    font-size: 13px;
}
.clock-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}
.btn-clock {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-clock-in { background: var(--success); color: white; }
.btn-clock-in:hover { background: #059669; }
.btn-clock-out { background: var(--info); color: white; }
.btn-clock-out:hover { background: #2563eb; }
.clock-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--bg);
}
.clock-in-done { border-left: 4px solid var(--success); }
.clock-out-done { border-left: 4px solid var(--info); }
.status-label { font-weight: 600; }
.status-time { color: var(--text-light); font-variant-numeric: tabular-nums; }
.work-duration {
    text-align: center;
    padding: 12px;
    background: var(--primary-light);
    border-radius: var(--radius);
    color: var(--primary);
    font-weight: 600;
}
.auth-methods {
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.auth-methods p { color: var(--text-light); margin-bottom: 8px; font-size: 13px; }
.method-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.tag-face { background: #dbeafe; color: #1d4ed8; }
.tag-finger { background: #dcfce7; color: #15803d; }
.tag-password { background: #f3f4f6; color: #4b5563; }

/* 统计 */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.stat-item { text-align: center; padding: 12px; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { color: var(--text-light); font-size: 13px; margin-top: 4px; }
.text-primary { color: var(--primary); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--text-muted); }

/* 表格 */
.table-responsive { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th, .table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
}
.table tr:hover { background: #f9fafb; }
.text-center { text-align: center; }

/* 徽章 */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}
.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-default { background: #f3f4f6; color: #4b5563; }

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-default { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-default:hover { background: #e5e7eb; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-link { background: none; color: var(--primary); padding: 4px 8px; }
.btn-link:hover { background: var(--primary-light); }
.btn-link.text-danger { color: var(--danger); }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text);
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s;
    background: white;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-group input:disabled { background: var(--bg); color: var(--text-light); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { grid-column: 1 / -1; padding-top: 8px; }
.form-check-group { display: flex; flex-direction: column; gap: 12px; }
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}
.checkbox-label input { width: auto; }

/* 提示 */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.active { display: flex; }
.modal-content {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-lg { max-width: 700px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; }
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
}
.modal-body { padding: 20px; }
.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 认证弹窗 */
.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}
.auth-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.auth-tab:hover { border-color: var(--primary); }
.auth-tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.auth-panel { min-height: 200px; }

/* 摄像头 */
.camera-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 12px;
    aspect-ratio: 4/3;
}
.camera-container.small { aspect-ratio: 16/9; max-height: 200px; }
.camera-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.camera-placeholder {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: var(--bg);
    gap: 10px;
}
.face-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 10px;
}
.tip {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 8px;
}

/* 指纹 */
.fingerprint-area {
    text-align: center;
    padding: 30px 0;
}
.fingerprint-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    margin-bottom: 16px;
    transition: all 0.3s;
}
.fingerprint-icon.scanning {
    animation: pulse 1.5s infinite;
    background: #dbeafe;
}
.fingerprint-icon.error {
    background: #fee2e2;
    color: var(--danger);
}
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
}

/* 登录页 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}
.login-container {
    background: white;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}
.login-header { text-align: center; margin-bottom: 30px; }
.login-header .logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--primary);
    color: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-header h1 { font-size: 22px; margin-bottom: 4px; }
.login-header p { color: var(--text-light); font-size: 14px; }
.login-form { margin-bottom: 20px; }
.login-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.8;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* 个人中心 */
.profile-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
}
.profile-card { text-align: center; }
.profile-avatar-large {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
    overflow: hidden;
}
.profile-avatar-large img { width: 100%; height: 100%; object-fit: cover; }
.profile-card h3 { margin-bottom: 4px; }
.profile-meta { color: var(--text-light); font-size: 13px; margin-bottom: 4px; }
.profile-badges { display: flex; gap: 6px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.face-preview { margin-bottom: 12px; }
.face-preview img { width: 100%; border-radius: var(--radius); }

/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar input, .filter-bar select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}
.filter-bar-wrap { flex-wrap: wrap; }

/* 分页 */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 16px;
}
.page-link {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    transition: all 0.2s;
}
.page-link:hover { background: var(--bg); }
.page-link.active { background: var(--primary); color: white; border-color: var(--primary); }

/* 链接 */
.link { color: var(--primary); font-size: 13px; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* 响应式 */
@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .clock-card, .stats-card, .records-card { grid-column: 1; grid-row: auto; }
    .profile-layout { grid-template-columns: 1fr; }
    .form-grid, .form-grid-2 { grid-template-columns: 1fr; }
    .header-nav { display: none; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .clock-time-display .time { font-size: 36px; }
}
