/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* 登录页面 */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
    color: #333;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

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

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

.btn-primary, .btn-secondary {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

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

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: #999;
    font-size: 13px;
}

/* 管理后台 */
.admin-container {
    min-height: 100vh;
    background: #f5f5f5;
}

.admin-header {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    font-size: 20px;
    color: #333;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    color: #666;
    font-size: 14px;
}

.admin-header .btn-secondary {
    width: auto;
    padding: 8px 16px;
}

.admin-main {
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 24px;
    color: #333;
}

.page-header .btn-primary {
    width: auto;
    padding: 10px 20px;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-label {
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 600;
    color: #333;
}

/* 用户列表 */
.users-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h3 {
    font-size: 18px;
    color: #333;
}

.search-box input {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    width: 240px;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e9ecef;
}

.users-table td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
}

.users-table tbody tr:hover {
    background: #f8f9fa;
}

.action-btn {
    padding: 6px 12px;
    margin-right: 6px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn.view {
    background: #e3f2fd;
    color: #1976d2;
}

.action-btn.view:hover {
    background: #bbdefb;
}

.action-btn.edit {
    background: #fff3e0;
    color: #f57c00;
}

.action-btn.edit:hover {
    background: #ffe0b2;
}

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

.action-btn.delete:hover {
    background: #ffcdd2;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 800px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    color: #333;
}

.modal-close {
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-content form {
    padding: 24px;
}

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

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

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.form-group input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: #999;
    font-size: 12px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-footer .btn-primary,
.modal-footer .btn-secondary {
    width: auto;
    padding: 8px 16px;
}

/* 同步记录表格 */
.sync-history-content {
    padding: 24px;
    max-height: 400px;
    overflow-y: auto;
}

.sync-table {
    width: 100%;
    border-collapse: collapse;
}

.sync-table th {
    background: #f8f9fa;
    padding: 10px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e9ecef;
    position: sticky;
    top: 0;
}

.sync-table td {
    padding: 10px;
    border-bottom: 1px solid #e9ecef;
    font-size: 13px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .admin-main {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .users-table {
        font-size: 13px;
    }

    .users-table th,
    .users-table td {
        padding: 8px;
    }

    .search-box input {
        width: 100%;
    }
}

/* 同步详情样式 */
.sync-detail-content {
    padding: 24px;
    max-height: 600px;
    overflow-y: auto;
}

.detail-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e9ecef;
}

.detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.detail-section h4 {
    font-size: 16px;
    color: #333;
    margin-bottom: 16px;
    font-weight: 600;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table tr {
    border-bottom: 1px solid #f0f0f0;
}

.detail-table tr:last-child {
    border-bottom: none;
}

.detail-table td {
    padding: 12px 0;
    vertical-align: top;
}

.detail-table td.label {
    width: 160px;
    color: #666;
    font-weight: 500;
}

.encrypted-preview {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
}

.encrypted-preview pre {
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: #333;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.6;
}

.preview-note {
    color: #f57c00;
    font-size: 13px;
    margin: 0;
    padding: 8px 12px;
    background: #fff3e0;
    border-radius: 4px;
    border-left: 3px solid #f57c00;
}

/* 解密控制区域 */
.decrypt-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.decrypt-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.decrypt-input:focus {
    outline: none;
    border-color: #667eea;
}

.decrypt-btn {
    padding: 10px 24px;
    white-space: nowrap;
}

.decrypted-preview {
    background: #e8f5e9;
    border: 1px solid #4caf50;
    border-radius: 6px;
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.decrypted-preview pre {
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: #1b5e20;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.6;
}
