/* 舆情分发系统 v4.0 - 样式表 */

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

:root {
    --primary: #1890ff;
    --primary-dark: #096dd9;
    --success: #52c41a;
    --warning: #faad14;
    --danger: #f5222d;
    --bg: #f0f2f5;
    --bg-card: #fff;
    --text: #333;
    --text-secondary: #666;
    --border: #e8e8e8;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

/* 头部 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    padding: 16px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.header h1 {
    font-size: 24px;
    color: var(--primary);
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg);
    border-radius: 20px;
    font-size: 14px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.status-dot.offline {
    background: var(--danger);
}

/* FRP隧道状态指示器 */
.frp-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.08);
    border-radius: 16px;
    font-size: 12px;
    cursor: default;
    user-select: none;
}

.frp-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.frp-dot.connected {
    background: var(--success);
    box-shadow: 0 0 5px var(--success);
    animation: pulse-green 2s infinite;
}

.frp-dot.starting {
    background: #f59e0b;
    box-shadow: 0 0 5px #f59e0b;
    animation: pulse-orange 1s infinite;
}

.frp-dot.process_running {
    background: #60a5fa;
    box-shadow: 0 0 5px #60a5fa;
}

.frp-dot.disconnected {
    background: #9ca3af;
}

@keyframes pulse-green {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes pulse-orange {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 标签页 */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: var(--bg-card);
    padding: 12px 16px;
    border-radius: var(--radius);
}

.tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-secondary);
    border-radius: var(--radius);
    transition: all 0.2s;
}

.tab:hover {
    background: var(--bg);
}

.tab.active {
    background: var(--primary);
    color: #fff;
}

/* 内容区域 */
.tab-content {
    display: none;
}

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

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

.stat-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-card.success .stat-value {
    color: var(--success);
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 卡片 */
.card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card h3 {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

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

.card-header h3 {
    margin: 0;
    padding: 0;
    border: none;
    white-space: nowrap;
    flex-shrink: 0;
}

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

/* 按钮 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

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

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

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
}

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

.btn-secondary {
    background: var(--bg);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--border);
}

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

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

/* 快捷操作 */
.quick-actions {
    display: flex;
    gap: 12px;
}

/* 表格 */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

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

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

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

.table .text-center {
    text-align: center;
    color: var(--text-secondary);
}

/* 表单 */
.form {
    max-width: 600px;
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s;
}

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

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.form-hint {
    color: var(--primary) !important;
}

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

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

.checkbox-label input {
    width: auto !important;
}

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

/* 提示 */
.tips {
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    padding: 16px;
    border-radius: var(--radius);
}

.tips p {
    margin-bottom: 8px;
}

.tips p:last-child {
    margin-bottom: 0;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 24px;
    background: var(--text);
    color: #fff;
    border-radius: var(--radius);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 1001;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: var(--success);
}

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

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

.pagination button, .page-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
}

.pagination button:hover, .page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination button.active, .page-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

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

/* 风险等级标签 */
.risk-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.risk-tag.low {
    background: #d9f7be;
    color: #52c41a;
}

.risk-tag.medium {
    background: #ffe58f;
    color: #faad14;
}

.risk-tag.high {
    background: #ffccc7;
    color: #f5222d;
}

/* 状态标签 */
.status-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.status-tag.sent {
    background: #d9f7be;
    color: #52c41a;
}

.status-tag.pending {
    background: #ffe58f;
    color: #faad14;
}

.status-tag.failed {
    background: #ffccc7;
    color: #f5222d;
}

/* 开关 */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 44px;
    height: 24px;
    background-color: #dc3545;
    transition: 0.3s;
    border-radius: 24px;
}

.switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.switch input:checked + .slider {
    background-color: #28a745;
}

.switch input:checked + .slider:before {
    transform: translateX(20px);
}

/* 响应式 */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 8px;
    }
}

/* 监测方案目标标签 */
.scheme-target-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin: 2px 4px 2px 0;
    background: #e6f7ff;
    color: #1890ff;
}

.scheme-target-tag.person {
    background: #fff7e6;
    color: #fa8c16;
}

/* 复选框网格 */
.checkbox-grid {
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 8px;
}

.checkbox-group {
    margin-bottom: 16px;
}

.checkbox-group h4 {
    margin-bottom: 8px;
    color: #666;
    font-size: 13px;
    border-bottom: 1px solid #e8e8e8;
    padding-bottom: 4px;
}

.checkbox-group .checkbox-label {
    display: flex !important;
    align-items: center;
    padding: 8px 12px;
    background: #fff;
    border-radius: 4px;
    margin-bottom: 4px;
}

.checkbox-group .checkbox-label:hover {
    background: #f0f8ff;
}

.checkbox-group .checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
}

.checkbox-group .checkbox-label input:disabled {
    opacity: 0.5;
}

/* 大弹窗 */
.modal-large {
    max-width: 700px;
}

/* ============ SKILL 判断日志弹窗 ============ */
#skillLogModal .modal-content {
    max-width: 95vw;
    max-height: 90vh;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#skillLogModal .modal-header {
    flex-shrink: 0;
}
#skillLogModal .modal-body {
    flex: 1 1 auto;
    overflow-x: auto;
    overflow-y: auto;
    min-height: 0;
    padding: 4px 0;
}
#skillLogModal .modal-footer {
    flex-shrink: 0;
    padding-top: 12px;
}
/* 日志表格在窄屏时的最小宽度 */
#skillLogModalBody table {
    min-width: 900px;
    white-space: nowrap;
}

/* Webhook预览 */
.webhook-preview {
    font-family: monospace;
    font-size: 12px;
    color: #666;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
}

/* 内容单元格 */
.content-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============ ��¼���� ============ */
.login-modal-content {
    width: 380px;
    padding: 32px 28px;
    text-align: center;
}

.login-header {
    margin-bottom: 24px;
}

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

.login-subtitle {
    color: #888;
    font-size: 13px;
}

.login-error {
    color: #e74c3c;
    font-size: 13px;
    margin: 8px 0;
    min-height: 18px;
    text-align: left;
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 15px;
}

.login-hint {
    margin-top: 16px;
    font-size: 12px;
    color: #999;
}

/* ============ �û��Ǳ� ============ */
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#logoutBtn {
    display: inline-block !important;
}

/* ============ ��ťС�ߴ� ============ */
.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

/* ============ ��¼����ǿ���ö� ============ */
#loginModal,
#changePwdModal {
    z-index: 9999 !important;
    pointer-events: auto !important;
}

#loginModal .modal-content,
#changePwdModal .modal-content {
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}
