:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    color: var(--text);
    font-size: 13px;
}

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

/* 头部 */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    margin-bottom: 20px;
    color: white;
}

header h1 {
    color: white;
    font-size: 1.5em;
}

.header-link {
    font-size: 0.6em;
    color: white;
    text-decoration: none;
    font-weight: normal;
    margin-left: 15px;
    opacity: 0.9;
    transition: opacity 0.3s;
}

.header-link:hover {
    text-decoration: underline;
    opacity: 1;
}

.header-link-highlight {
    font-size: 0.7em;
    background: var(--accent);
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
    opacity: 1;
}

.header-link-highlight:hover {
    background: #d97706;
}

.auth-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

#user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 按钮 */
.btn {
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    background: var(--border);
    color: var(--text);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* 标签导航 */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    color: var(--text);
}

.tab-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

/* 内容区域 */
.tab-content {
    display: none;
    background: var(--card);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.tab-content.active {
    display: block;
}

/* 地区选择器 */
.region-selector {
    background: var(--bg);
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.region-selector span {
    font-weight: bold;
    color: var(--text);
}

.region-selector label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.region-selector input[type="radio"] {
    cursor: pointer;
}

/* 翻译面板 */
.panel-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.translation-panel {
    background: var(--bg);
    padding: 25px;
    border-radius: 10px;
}

.translation-panel h2 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.1em;
}

.translation-panel textarea {
    width: 100%;
    height: 100px;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    resize: vertical;
    margin-bottom: 10px;
    transition: border-color 0.3s;
    font-family: 'Consolas', 'Monaco', monospace;
}

.translation-panel textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.translation-panel .btn {
    width: 100%;
    margin-bottom: 15px;
}

.result-box {
    background: var(--card);
    padding: 15px;
    border-radius: 8px;
    border: 2px solid var(--border);
}

.result-item {
    margin-bottom: 10px;
    padding: 10px;
    background: var(--bg);
    border-radius: 6px;
}

.result-item:last-child {
    margin-bottom: 0;
}

.result-item label {
    font-weight: bold;
    color: var(--text-muted);
    display: block;
    margin-bottom: 5px;
    font-size: 11px;
}

.result-item span {
    color: var(--text);
    word-break: break-all;
    font-size: 14px;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* 最近历史 */
.recent-history {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border);
}

.recent-history h3 {
    color: var(--primary);
    margin-bottom: 15px;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary);
}

.history-item .time {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.history-item .content {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.history-item .input, .history-item .output {
    flex: 1;
    word-break: break-all;
}

.history-item .input {
    color: var(--text-muted);
}

.history-item .output {
    color: var(--text);
    font-weight: bold;
}

/* 历史记录板块 */
.history-panel {
    width: 100%;
}

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

.history-header h2 {
    color: var(--primary);
}

.history-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.history-controls input, .history-controls select {
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.history-table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
}

.history-table th, .history-table td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.history-table th {
    background: var(--bg);
    color: var(--text);
    font-weight: bold;
    font-size: 12px;
}

.history-table tr:hover {
    background: var(--bg);
}

.history-table .input-cell, .history-table .output-cell {
    max-width: 250px;
    word-break: break-all;
    font-family: monospace;
    font-size: 11px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

#page-info {
    color: var(--text-muted);
}

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

.modal-content {
    background: var(--card);
    margin: 10% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-muted);
}

.close:hover {
    color: var(--text);
}

.modal-content h2 {
    color: var(--primary);
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

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

.input-group {
    display: flex;
    gap: 10px;
}

.input-group input {
    flex: 1;
}

/* 响应式 */
@media (max-width: 768px) {
    .panel-container {
        grid-template-columns: 1fr;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .history-controls {
        flex-direction: column;
    }
    
    .history-controls input, .history-controls select {
        width: 100%;
    }
    
    .region-selector {
        flex-direction: column;
        align-items: flex-start;
    }
    
    header h1 {
        font-size: 1.2em;
    }
    
    .header-link {
        display: block;
        margin: 5px 0 0 0;
    }
}

/* 工具类 */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mt-20 {
    margin-top: 20px;
}

/* Toast 消息 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    animation: slideInRight 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* 大模态框 */
.modal-large {
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

/* 设置区块 */
.settings-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.settings-section h3 {
    color: var(--primary);
    margin-bottom: 16px;
    font-size: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

/* 登录历史列表 */
.login-history-list {
    max-height: 200px;
    overflow-y: auto;
}

.login-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 6px;
    margin-bottom: 8px;
    border-left: 3px solid var(--success);
}

.login-history-item.failed {
    border-left-color: var(--danger);
    background: #fef2f2;
}

.login-time {
    font-size: 12px;
    color: var(--text-muted);
}

.login-info {
    display: flex;
    gap: 16px;
    font-size: 12px;
}

.login-ip {
    color: var(--text);
}

.login-device {
    color: var(--text-muted);
}

.login-status {
    font-weight: 500;
}

.login-status.success { color: var(--success); }
.login-status.failed { color: var(--danger); }

/* 管理员统计卡片 */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: white;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 4px;
}

/* 管理员标签 */
.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 12px;
}

.admin-tab-btn {
    padding: 8px 20px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.admin-tab-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.admin-tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.admin-toolbar input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
}

.admin-toolbar select {
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
}

/* 管理员表格 */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.admin-table th, .admin-table td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text);
}

.admin-table tr:hover {
    background: var(--bg);
}

/* 角色标签 */
.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.role-badge.admin {
    background: #fef3c7;
    color: #92400e;
}

.role-badge.user {
    background: #e0f2fe;
    color: #075985;
}

/* 按钮警告色 */
.btn-warning {
    background: var(--accent);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

/* 响应式补充 */
@media (max-width: 768px) {
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .admin-tabs {
        flex-wrap: wrap;
    }
    
    .admin-toolbar {
        flex-direction: column;
    }
    
    .admin-toolbar input,
    .admin-toolbar select {
        width: 100%;
    }
    
    .modal-large {
        margin: 5% auto;
        width: 95%;
    }
}

/* 忘记密码链接 */
.forgot-password-link {
    text-align: center;
    margin-top: 15px;
}

.forgot-password-link a {
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
}

.forgot-password-link a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* 消息框 */
.message-box {
    margin-bottom: 15px;
}

.message-box .message {
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 13px;
}

.message-box .message.success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.message-box .message.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.message-box .message.info {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.message-box .message a {
    color: var(--primary);
    font-weight: 500;
}