/* QQ机器人管理平台 - 全局样式 */

:root {
    --primary: #1890ff;
    --primary-dark: #096dd9;
    --primary-light: #e6f7ff;
    --success: #52c41a;
    --warning: #faad14;
    --danger: #ff4d4f;
    --info: #1890ff;
    --text-primary: #262626;
    --text-secondary: #595959;
    --text-muted: #8c8c8c;
    --bg-base: #f0f2f5;
    --bg-white: #ffffff;
    --border-color: #d9d9d9;
    --border-light: #f0f0f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --sidebar-width: 240px;
    --header-height: 56px;
}

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

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

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

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

/* ========== 登录页面 ========== */

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

.login-container {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 400px;
    max-width: 90vw;
}

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

.login-header .logo {
    font-size: 36px;
    margin-bottom: 8px;
}

.login-header h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 13px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 13px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
    outline: none;
    background: var(--bg-white);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.form-control::placeholder {
    color: #bfbfbf;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    gap: 6px;
    line-height: 1.5;
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

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

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

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

.btn-success:hover {
    background: #389e0d;
}

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

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

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

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

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

.btn-sm {
    padding: 4px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

.login-footer a {
    font-size: 13px;
    color: var(--text-muted);
}

.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    display: none;
}

.alert.show {
    display: block;
}

.alert-error {
    background: #fff2f0;
    border: 1px solid #ffccc7;
    color: var(--danger);
}

.alert-success {
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    color: var(--success);
}

.alert-info {
    background: var(--primary-light);
    border: 1px solid #91d5ff;
    color: var(--primary);
}

/* ========== 布局 ========== */

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: #001529;
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: width 0.3s;
}

.sidebar-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo {
    font-size: 24px;
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-menu {
    list-style: none;
    padding: 8px 0;
}

.sidebar-menu li {
    margin: 2px 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.65);
    font-size: 14px;
    transition: all 0.3s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    color: #fff;
    background: var(--primary);
}

.sidebar-menu a .icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    padding: 8px 0;
    transition: color 0.3s;
}

.sidebar-footer a:hover {
    color: #fff;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.content-header {
    background: var(--bg-white);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.content-header h1 {
    font-size: 18px;
    font-weight: 600;
}

.content-header .header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.content-body {
    padding: 24px;
}

/* ========== 卡片 ========== */

.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    background: #fafafa;
}

/* ========== 统计卡片 ========== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.blue { background: #e6f7ff; color: var(--primary); }
.stat-icon.green { background: #f6ffed; color: var(--success); }
.stat-icon.orange { background: #fff7e6; color: var(--warning); }
.stat-icon.red { background: #fff2f0; color: var(--danger); }

.stat-info h4 {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-info p {
    color: var(--text-muted);
    font-size: 13px;
}

/* ========== 表格 ========== */

.table-wrapper {
    overflow-x: auto;
}

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

thead th {
    background: #fafafa;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}

tbody tr:hover {
    background: #fafafa;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ========== 状态标签 ========== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    gap: 4px;
}

.badge-online {
    background: #f6ffed;
    color: var(--success);
}

.badge-offline {
    background: #f5f5f5;
    color: var(--text-muted);
}

.badge-error {
    background: #fff2f0;
    color: var(--danger);
}

.badge-active {
    background: #f6ffed;
    color: var(--success);
}

.badge-disabled {
    background: #fff2f0;
    color: var(--danger);
}

.badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ========== 模态框 ========== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 520px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close,
.btn-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    line-height: 1;
}

.modal-close:hover,
.btn-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 12px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ========== 日志 ========== */

.log-list {
    max-height: 400px;
    overflow-y: auto;
}

.log-item {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13px;
}

.log-item:last-child {
    border-bottom: none;
}

.log-time {
    color: var(--text-muted);
    white-space: nowrap;
    font-size: 12px;
    min-width: 140px;
}

.log-type {
    font-weight: 500;
    min-width: 50px;
}

.log-type.info { color: var(--primary); }
.log-type.warning { color: var(--warning); }
.log-type.error { color: var(--danger); }
.log-type.bot { color: var(--success); }

.log-message {
    flex: 1;
    word-break: break-all;
}

/* ========== 机器人卡片 ========== */

.bot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.bot-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    border: 1px solid var(--border-light);
    transition: box-shadow 0.3s;
}

.bot-card:hover {
    box-shadow: var(--shadow-md);
}

.bot-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.bot-card-header h4 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bot-card-info {
    margin-bottom: 16px;
}

.bot-card-info .info-row {
    display: flex;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.bot-card-info .info-row .label {
    min-width: 80px;
    color: var(--text-muted);
}

.bot-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========== 空状态 ========== */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state p {
    margin-bottom: 16px;
}

/* ========== 复选框组 ========== */

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    padding: 6px 0;
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* ========== 消息测试 ========== */

.message-test {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.message-test textarea {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: monospace;
    resize: vertical;
}

/* ========== Toast 消息 ========== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.toast-success {
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    color: #389e0d;
}

.toast-error {
    background: #fff2f0;
    border: 1px solid #ffccc7;
    color: #cf1322;
}

.toast-info {
    background: var(--primary-light);
    border: 1px solid #91d5ff;
    color: var(--primary);
}

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

/* ========== 响应式 ========== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .bot-grid {
        grid-template-columns: 1fr;
    }
    
    .login-container {
        padding: 24px;
    }
    
    .message-test {
        grid-template-columns: 1fr;
    }
}

/* ========== 选择框样式 ========== */

select.form-control {
    appearance: auto;
}

/* ========== Loading ========== */

.loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== 操作按钮组 ========== */

.action-buttons {
    display: flex;
    gap: 4px;
}

.action-buttons .btn {
    padding: 4px 8px;
    font-size: 12px;
}
