/* 抖音私信管理系统 - 样式文件 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f0f2f5;
    color: #333;
    font-size: 14px;
}

.app {
    display: flex;
    height: 100vh;
}

/* ====== 侧边导航 ====== */
.sidebar {
    width: 220px;
    background: #1a1a2e;
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

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

.nav-menu {
    list-style: none;
    padding: 8px 0;
    flex: 1;
}

.nav-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: rgba(255,255,255,0.7);
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-left: 3px solid #fe2c55;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-footer .status-badge {
    font-size: 11px;
    padding: 4px 8px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.online {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}

.status-badge.offline {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
}

/* ====== 主内容区 ====== */
.main-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tab-panel {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.tab-panel.active {
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e8e8e8;
}

.panel-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a2e;
}

.panel-header .hint {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
}

/* ====== 按钮 ====== */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-sm {
    padding: 5px 14px;
    font-size: 13px;
}

.btn-primary {
    background: #fe2c55;
    color: #fff;
}

.btn-primary:hover {
    background: #e0264b;
}

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

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

.btn-success {
    background: #4caf50;
    color: #fff;
}

.btn-success:hover {
    background: #43a047;
}

.btn-warning {
    background: #ff9800;
    color: #fff;
}

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

.btn-danger {
    background: #f44336;
    color: #fff;
}

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

/* ====== 表单 ====== */
.form-group {
    margin-bottom: 16px;
}

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #fe2c55;
    box-shadow: 0 0 0 2px rgba(254, 44, 85, 0.1);
}

.form-group textarea {
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* ====== 结果提示 ====== */
.result-box {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
}

.result-box.success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.result-box.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* ====== 帮助区域 ====== */
.help-section {
    margin-top: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
}

.help-section h4 {
    margin-bottom: 12px;
    color: #1a1a2e;
}

.help-section ol {
    padding-left: 20px;
    line-height: 2;
}

.help-section kbd {
    display: inline-block;
    padding: 2px 6px;
    background: #f5f5f5;
    border: 1px solid #d9d9d9;
    border-radius: 3px;
    font-size: 12px;
}

.help-section .warn {
    margin-top: 12px;
    padding: 10px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 4px;
    color: #f57f17;
    font-size: 13px;
}

/* ====== 会话列表 ====== */
.conv-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.conv-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.conv-item:hover {
    background: #f5f5f5;
}

.conv-item.active {
    background: #fce4ec;
    border-left: 3px solid #fe2c55;
}

.conv-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 12px;
    flex-shrink: 0;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.conv-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    font-size: 18px;
    color: #999;
    font-weight: 600;
}

.conv-info {
    flex: 1;
    min-width: 0;
}

.conv-name {
    font-weight: 500;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.conv-name .badge {
    display: inline-block;
    background: #fe2c55;
    color: #fff;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: normal;
}

.conv-preview {
    font-size: 13px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ====== 聊天面板 ====== */
.chat-panel {
    display: flex;
    flex-direction: column;
}

.msg-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.msg-item {
    max-width: 70%;
    display: flex;
    flex-direction: column;
}

.msg-item.msg-self {
    align-self: flex-end;
}

.msg-item.msg-other {
    align-self: flex-start;
}

.msg-sender {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}

.msg-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    line-height: 1.5;
    word-break: break-all;
}

.msg-self .msg-bubble {
    background: #fe2c55;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.msg-other .msg-bubble {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    border: 1px solid #e8e8e8;
}

.msg-time {
    font-size: 11px;
    color: #bbb;
    margin-top: 4px;
}

.chat-input-bar {
    display: flex;
    gap: 10px;
    padding: 12px 0;
    border-top: 1px solid #e8e8e8;
}

.chat-input-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d9d9d9;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
}

.chat-input-bar input:focus {
    border-color: #fe2c55;
}

/* ====== 自动回复规则 ====== */
.card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
    margin-bottom: 20px;
}

.card h4 {
    margin-bottom: 16px;
    color: #1a1a2e;
}

.rules-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rule-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
    transition: all 0.15s;
}

.rule-item.disabled {
    opacity: 0.5;
}

.rule-info {
    flex: 1;
}

.rule-keyword {
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rule-keyword .tag {
    display: inline-block;
    padding: 2px 8px;
    background: #e3f2fd;
    color: #1565c0;
    border-radius: 4px;
    font-size: 12px;
}

.rule-reply {
    font-size: 13px;
    color: #666;
    margin-bottom: 2px;
}

.rule-meta {
    font-size: 12px;
    color: #bbb;
}

.rule-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ====== 日志 ====== */
.log-content {
    background: #1a1a2e;
    color: #a5d6a7;
    padding: 16px;
    border-radius: 8px;
    font-family: "Consolas", "Monaco", monospace;
    font-size: 13px;
    line-height: 1.6;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ====== 加载与空状态 ====== */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 14px;
}

.empty-hint {
    text-align: center;
    padding: 60px 20px;
    color: #bbb;
    font-size: 14px;
}

/* ====== 响应式 ====== */
/* ====== 机器人控制面板 ====== */
.bot-status-card {
    padding: 20px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    margin-bottom: 16px;
}

.bot-status-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
}

.bot-label {
    width: 80px;
    font-size: 14px;
    color: #666;
    flex-shrink: 0;
}

.bot-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
}

.bot-notice {
    padding: 14px 16px;
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.6;
    color: #1565c0;
}

.bot-log-section {
    margin-top: 20px;
}

.bot-log-section h4 {
    margin-bottom: 10px;
    font-size: 14px;
    color: #333;
}

/* ====== 调试面板 ====== */
.debug-notice {
    padding: 14px 16px;
    background: #fff3e0;
    border: 1px solid #ffe0b2;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.6;
    color: #e65100;
}

.debug-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.debug-item {
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
    background: #fff;
}

.debug-item.debug-ok {
    border-left: 4px solid #4caf50;
}

.debug-item.debug-warn {
    border-left: 4px solid #ff9800;
}

.debug-item.debug-err {
    border-left: 4px solid #f44336;
}

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

.debug-name {
    font-weight: 600;
    font-size: 14px;
}

.debug-status {
    font-size: 12px;
    color: #888;
}

.debug-url {
    font-size: 12px;
    color: #aaa;
    word-break: break-all;
    margin-bottom: 4px;
}

.debug-sc {
    font-size: 13px;
    color: #666;
}

.debug-detail {
    margin-top: 8px;
}

.debug-detail summary {
    cursor: pointer;
    font-size: 12px;
    color: #fe2c55;
}

.debug-detail pre {
    margin-top: 6px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

@media (max-width: 768px) {
    .app {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        overflow-x: auto;
    }
    .sidebar-header, .sidebar-footer {
        display: none;
    }
    .nav-menu {
        display: flex;
        flex-direction: row;
        padding: 0;
    }
    .nav-item {
        white-space: nowrap;
        padding: 10px 16px;
        border-left: none;
        border-bottom: 3px solid transparent;
    }
    .nav-item.active {
        border-left: none;
        border-bottom-color: #fe2c55;
    }
    .tab-panel {
        padding: 16px;
    }
}

/* ====== 表单增强 ====== */
.required {
    color: #fe2c55;
}

.optional {
    color: #999;
    font-size: 12px;
    font-weight: normal;
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #999;
    line-height: 1.4;
}

.form-hint code {
    background: #f5f5f5;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 11px;
    color: #e65100;
}

.help-section code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    color: #e65100;
    word-break: break-all;
}

.btn-success {
    background: #4caf50;
    color: #fff;
    border-color: #4caf50;
}

.btn-success:hover {
    background: #43a047;
}

.rule-match-type {
    display: inline-block;
    padding: 1px 6px;
    background: #e3f2fd;
    color: #1565c0;
    border-radius: 3px;
    font-size: 11px;
    margin-right: 6px;
}
