/* User Bot 配置页面样式 */

/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

/* 容器布局 */
.container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* 侧边栏样式 */
.sidebar {
    width: 260px;
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.sidebar-header .subtitle {
    font-size: 12px;
    opacity: 0.9;
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #ecf0f1;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    font-size: 14px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    border-left-color: #667eea;
}

.nav-item.active {
    background: rgba(102, 126, 234, 0.15);
    border-left-color: #667eea;
    color: white;
    font-weight: 500;
}

.nav-icon {
    font-size: 18px;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.nav-text {
    flex: 1;
}

.sidebar-footer {
    padding: 16px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-top: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}

.api-key-section label {
    font-size: 12px;
    color: rgba(255,255,255,0.9);
    margin-bottom: 8px;
    display: block;
    font-weight: 500;
}

.api-key-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.api-key-input-group input {
    flex: 1;
    padding: 8px 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: white;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

.api-key-input-group input::placeholder {
    color: rgba(255,255,255,0.3);
}

.api-key-input-group input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(0,0,0,0.3);
}

.api-key-status {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

.btn-icon {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
}

.btn-icon:hover {
    background: rgba(255,255,255,0.2);
}

/* 主内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f5f7fa;
}

.page-header {
    background: white;
    padding: 20px 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    flex-shrink: 0;
    border-bottom: 1px solid #e9ecef;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: #2c3e50;
}

.page-description {
    color: #6c757d;
    margin: 0;
    font-size: 14px;
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #333;
}

.card-body {
    padding: 0;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #6b7280;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.form-check input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.form-check label {
    margin: 0;
    font-weight: normal;
    cursor: pointer;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* 模态对话框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-content.modal-small {
    max-width: 500px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    color: #374151;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e5e7eb;
}

/* 认证步骤 */
.auth-step {
    padding: 20px 0;
}

.auth-step p {
    margin-bottom: 20px;
    color: #6b7280;
}

.success-message {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 20px;
}

.success-message p {
    font-size: 1.25rem;
    font-weight: 600;
    color: #10b981;
}

/* 状态网格 */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.status-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.status-value {
    font-size: 1.125rem;
    font-weight: 600;
}

.status-value.success {
    color: #10b981;
}

.status-value.error {
    color: #ef4444;
}

.auth-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* 表单行 */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

/* 表单组 */
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    font-family: 'Courier New', monospace;
    resize: vertical;
}

.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 过滤规则列表 */
.filter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background-color: #f9fafb;
    border-radius: 6px;
    margin-bottom: 10px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
}

.filter-item:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

.filter-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-type-badge {
    display: inline-block;
    padding: 4px 10px;
    background-color: #dbeafe;
    color: #1e40af;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.filter-description {
    flex: 1;
    font-size: 0.875rem;
    color: #374151;
}

.filter-actions {
    display: flex;
    gap: 6px;
}

.btn-icon {
    padding: 4px 8px;
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

/* 过滤规则模板 */
.filter-templates {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.filter-templates label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.template-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-template {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-template:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
}

/* 复选框组 */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background-color: #f9fafb;
    border-radius: 4px;
}

.checkbox-group .form-check {
    margin: 0;
}

/* 数据表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.data-table th {
    background-color: #f9fafb;
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
}

.data-table tbody tr:hover {
    background-color: #f9fafb;
}

.data-table code {
    background-color: #f3f4f6;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.875rem;
    font-family: 'Courier New', monospace;
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-secondary {
    background-color: #e5e7eb;
    color: #374151;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

/* 文本样式 */
.text-muted {
    color: #9ca3af;
    font-size: 0.875rem;
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    gap: 6px;
}

/* Webhook URL 样式 */
.webhook-url {
    font-size: 0.75rem;
    color: #6b7280;
}

/* 空消息 */
.empty-message {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 0.875rem;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

/* 确认对话框 */
.confirm-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.confirm-overlay.active {
    display: flex;
}

.confirm-dialog {
    background: white;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.confirm-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.confirm-icon {
    font-size: 2rem;
}

.confirm-icon.danger {
    color: #ef4444;
}

.confirm-icon.warning {
    color: #f59e0b;
}

.confirm-icon.info {
    color: #3b82f6;
}

.confirm-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.confirm-body {
    padding: 20px;
}

.confirm-body p {
    margin: 0;
    color: #374151;
}

.confirm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e5e7eb;
}

.confirm-btn {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.confirm-btn-confirm {
    background-color: #3b82f6;
    color: white;
}

.confirm-btn-confirm:hover {
    background-color: #2563eb;
}

.confirm-btn-confirm.danger {
    background-color: #ef4444;
}

.confirm-btn-confirm.danger:hover {
    background-color: #dc2626;
}

.confirm-btn-cancel {
    background-color: #e5e7eb;
    color: #374151;
}

.confirm-btn-cancel:hover {
    background-color: #d1d5db;
}

/* 提示消息 */
#alert-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert {
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 0.875rem;
    animation: slideIn 0.3s ease-out;
}

.alert.fade-out {
    animation: slideOut 0.3s ease-out;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .status-grid {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 0.75rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px;
    }
}

/* 仪表板样式 */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
}

.page-header h2 {
    margin: 0 0 8px 0;
    font-size: 1.875rem;
    font-weight: 700;
    color: #111827;
}

.page-description {
    margin: 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card {
    min-height: 120px;
}

.status-display {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-icon {
    font-size: 3rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background-color: #f3f4f6;
}

.status-icon.success {
    background-color: #d1fae5;
}

.status-icon.error {
    background-color: #fee2e2;
}

.status-icon.info {
    background-color: #dbeafe;
}

.status-text {
    flex: 1;
}

.status-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 4px;
}

.status-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.status-value.success {
    color: #10b981;
}

.status-value.error {
    color: #ef4444;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    padding: 20px;
    background-color: #f9fafb;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
}

.client-stats {
    margin-top: 30px;
}

.client-stats h4 {
    margin: 0 0 15px 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

/* 时间范围选择器 */
.time-range-selector select {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    background-color: white;
    cursor: pointer;
}

.time-range-selector select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 日志查看器 */
.log-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.log-controls select,
.log-controls input {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
}

.log-controls input[type="number"] {
    width: 80px;
}

.log-controls label {
    font-size: 0.875rem;
    color: #6b7280;
}

.logs-viewer {
    max-height: 500px;
    overflow-y: auto;
    background-color: #1f2937;
    border-radius: 4px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.log-entry {
    padding: 6px 0;
    border-bottom: 1px solid #374151;
    color: #d1d5db;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-timestamp {
    color: #9ca3af;
    margin-right: 10px;
}

.log-level {
    font-weight: 600;
    margin-right: 10px;
}

.log-entry.log-error .log-level {
    color: #ef4444;
}

.log-entry.log-warn .log-level {
    color: #f59e0b;
}

.log-entry.log-info .log-level {
    color: #3b82f6;
}

.log-entry.log-debug .log-level {
    color: #6b7280;
}

.log-message {
    color: #e5e7eb;
}

/* 按钮状态 */
.btn.active {
    background-color: #10b981;
    color: white;
}

.btn.active:hover {
    background-color: #059669;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .header-actions button {
        flex: 1;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .log-controls {
        flex-wrap: wrap;
    }
}

/* 自定义 Alert 对话框动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
