/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.logo {
    width: 80px;
    height: 80px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.logo svg {
    width: 40px;
    height: 40px;
    fill: white;
}

h1 {
    color: var(--gray-900);
    font-size: 24px;
    margin-bottom: 8px;
    font-weight: 600;
}

.subtitle {
    color: var(--gray-500);
    margin-bottom: 32px;
    font-size: 14px;
}

/* ==================== 表单样式 ==================== */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    color: var(--gray-700);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==================== 提示消息 ==================== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert.show {
    display: block;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 验证成功面板 ==================== */
.verify-success {
    display: none;
    padding: 24px;
    background: var(--gray-50);
    border-radius: 12px;
    margin-top: 20px;
}

.verify-success.show {
    display: block;
    animation: slideIn 0.3s ease;
}

.verify-success .employee-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.verify-success .employee-info {
    color: var(--gray-500);
    font-size: 14px;
    margin-bottom: 16px;
}

.verify-success .signature-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.signature-status.signed {
    background: #d1fae5;
    color: #065f46;
}

.signature-status.unsigned {
    background: #fef3c7;
    color: #92400e;
}

/* ==================== 签名页面 ==================== */
.sign-container {
    max-width: 600px;
    margin: 40px auto;
    padding: 0 20px;
}

.sign-header {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
}

.sign-header h2 {
    color: var(--gray-900);
    font-size: 20px;
    margin-bottom: 4px;
}

.sign-header .welcome {
    color: var(--gray-500);
    font-size: 14px;
}

.signature-box {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 24px;
}

.signature-canvas-wrapper {
    position: relative;
    border: 3px dashed var(--gray-300);
    border-radius: 12px;
    margin-bottom: 20px;
    background: #fafafa;
    overflow: hidden;
}

.signature-canvas {
    display: block;
    width: 100%;
    height: 250px;
    cursor: crosshair;
    touch-action: none;
}

.signature-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--gray-400);
    font-size: 14px;
    pointer-events: none;
}

.signature-actions {
    display: flex;
    gap: 12px;
}

.signature-actions .btn {
    flex: 1;
}

/* ==================== 管理后台 ==================== */
.admin-container {
    min-height: 100vh;
    background: var(--gray-100);
}

.admin-header {
    background: white;
    box-shadow: var(--shadow);
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header .header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    font-size: 20px;
    margin: 0;
    color: var(--gray-900);
}

.admin-nav {
    display: flex;
    gap: 8px;
}

.nav-btn {
    padding: 8px 16px;
    border: none;
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--gray-200);
}

.nav-btn.active {
    background: var(--primary-color);
    color: white;
}

.admin-main {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 24px;
}

.admin-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.admin-card h3 {
    color: var(--gray-900);
    font-size: 18px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--gray-100);
}

/* ==================== 数据表格 ==================== */
.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.data-table th {
    background: var(--gray-50);
    color: var(--gray-700);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table .actions {
    display: flex;
    gap: 8px;
}

.data-table .btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* ==================== 模态框 ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal h3 {
    color: var(--gray-900);
    font-size: 18px;
    margin-bottom: 20px;
}

.modal-close {
    float: right;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--gray-700);
}

/* ==================== 签名预览 ==================== */
.signature-preview {
    background: repeating-conic-gradient(var(--gray-200) 0% 25%, white 0% 50%) 50% / 20px 20px;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.signature-preview img {
    max-width: 100%;
    max-height: 150px;
    background: transparent;
}

/* ==================== 导入区域 ==================== */
.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 16px;
}

.upload-zone:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.02);
}

.upload-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.upload-zone input[type="file"] {
    display: none;
}

.upload-zone .upload-icon {
    font-size: 48px;
    color: var(--gray-400);
    margin-bottom: 12px;
}

.upload-zone .upload-text {
    color: var(--gray-700);
    font-size: 14px;
}

.upload-zone .upload-hint {
    color: var(--gray-500);
    font-size: 12px;
    margin-top: 4px;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-500);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    fill: var(--gray-300);
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 14px;
}

/* ==================== 统计卡片 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-card .stat-label {
    color: var(--gray-500);
    font-size: 14px;
    margin-top: 4px;
}

/* ==================== 工具栏 ==================== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.toolbar-left {
    display: flex;
    gap: 12px;
    align-items: center;
}

.toolbar-right {
    display: flex;
    gap: 12px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .admin-header .header-content {
        flex-direction: column;
        gap: 12px;
    }

    .admin-nav {
        width: 100%;
        justify-content: center;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
    }

    .signature-actions {
        flex-direction: column;
    }
}
