/* AlphaNexus Dashboard 样式 */

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(30, 30, 50, 0.8);
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --accent-pink: #ff6b9d;
    --accent-pink-light: rgba(255, 107, 157, 0.2);
    --accent-blue: #64b5f6;
    --accent-blue-light: rgba(100, 181, 246, 0.2);
    --accent-green: #4caf50;
    --accent-purple: #9c27b0;
    --accent-orange: #ff9800;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --glass-blur: blur(10px);
}

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

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* 头部样式 */
.dashboard-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding: 2rem;
    background: var(--bg-card);
    border-radius: 20px;
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.dashboard-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.dashboard-header .subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* 全局状态 */
.status-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.status-item {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: relative;
}

.status-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.status-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.status-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.status-button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.status-button-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-pill {
    font-size: 0.75rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid transparent;
}

.status-ok {
    color: var(--accent-green);
    border-color: rgba(76, 175, 80, 0.4);
    background: rgba(76, 175, 80, 0.15);
}

.status-delay {
    color: var(--accent-orange);
    border-color: rgba(255, 152, 0, 0.4);
    background: rgba(255, 152, 0, 0.15);
}

.status-error {
    color: var(--accent-pink);
    border-color: rgba(255, 107, 157, 0.4);
    background: rgba(255, 107, 157, 0.15);
}

.status-popover {
    position: static;
    width: 100%;
    background: var(--bg-secondary);
    border-radius: 14px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    padding: 0.8rem;
    margin-top: 0.6rem;
    display: none;
    max-height: 320px;
    overflow-y: auto;
}

.status-popover.is-open {
    display: block;
}

.status-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.status-popover-body {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.icon-button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
}

.source-row {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.6rem 0.8rem;
    background: rgba(255, 255, 255, 0.03);
}

.source-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}

.source-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.source-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.source-error {
    margin-top: 0.3rem;
    font-size: 0.75rem;
    color: var(--accent-pink);
}

/* 筛选条 */
.filters-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.filter-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
    align-items: end;
    justify-content: flex-end;
}

.secondary-button {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.55rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.secondary-button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.multi-select {
    position: relative;
}

.multi-select-toggle {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.multi-select-menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.5rem;
    display: none;
    z-index: 10;
    box-shadow: var(--shadow);
}

.multi-select.is-open .multi-select-menu {
    display: block;
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.4rem;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
}

.multi-select-option:hover {
    background: rgba(255, 255, 255, 0.06);
}

.multi-select-caret {
    color: var(--text-secondary);
}

/* 统计卡片 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.stat-card.tweets {
    border-left: 4px solid var(--accent-pink);
}

.stat-card.news {
    border-left: 4px solid var(--accent-blue);
}

.stat-card.keywords {
    border-left: 4px solid var(--accent-green);
}

.stat-card.quality {
    border-left: 4px solid var(--accent-orange);
}

.stat-icon {
    font-size: 2.5rem;
    min-width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-today {
    font-size: 0.8rem;
    color: var(--accent-green);
}

.stat-meta {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-delta {
    font-weight: 600;
}

.delta-up {
    color: var(--accent-green);
}

.delta-down {
    color: var(--accent-orange);
}

.delta-flat {
    color: var(--text-secondary);
}

/* 图表区域 */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 1.5rem;
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.chart-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

.chart-range {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.days-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.days-select:hover {
    background: rgba(255, 255, 255, 0.15);
}

.days-select:focus {
    outline: none;
    border-color: var(--accent-pink);
}

.days-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.filter-group .days-select {
    width: 100%;
}

.chart-wrapper {
    height: 300px;
    position: relative;
}

/* 页脚 */
.dashboard-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* 活跃关键词列表 */
.keywords-list-section {
    margin-bottom: 2rem;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 1.5rem;
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.keywords-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.keywords-list-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

.keywords-list-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.keywords-add {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.keywords-add-fields {
    display: flex;
    gap: 0.75rem;
    flex: 1;
    min-width: 260px;
}

.keyword-input {
    flex: 1;
    min-width: 200px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 0.9rem;
    border-radius: 10px;
    font-size: 0.9rem;
}

.keyword-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(100, 181, 246, 0.15);
}

.keywords-add-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.keywords-add-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.keywords-add-message.is-success {
    color: var(--accent-green);
}

.keywords-add-message.is-error {
    color: var(--accent-pink);
}

.keywords-add-message.is-info {
    color: var(--text-secondary);
}

.keywords-list-container {
    min-height: 300px;
    position: relative;
}

.keywords-list-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--text-secondary);
    animation: pulse 1.5s ease-in-out infinite;
}

.keywords-list-content {
    overflow-x: auto;
    padding-bottom: 0.4rem;
}

.keywords-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.7rem;
    font-size: 0.9rem;
    min-width: 720px;
}

.keywords-table thead {
    background: transparent;
}

.keywords-table th {
    padding: 0.7rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
    border-bottom: none;
    letter-spacing: 0.04em;
    font-size: 0.78rem;
}

.keywords-table th:nth-child(3),
.keywords-table th:nth-child(4),
.keywords-table th:nth-child(6) {
    text-align: right;
}

.keywords-table thead th:first-child {
    border-radius: 12px 0 0 12px;
}

.keywords-table thead th:last-child {
    border-radius: 0 12px 12px 0;
}

.keywords-table td {
    padding: 0.85rem 1rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.keywords-table tbody tr td:first-child {
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px 0 0 14px;
}

.keywords-table tbody tr td:last-child {
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0 14px 14px 0;
}

.keywords-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.08);
}

.keyword-name {
    min-width: 200px;
}

.keyword-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.01em;
}

.keyword-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-blue);
}

.keyword-number {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.keyword-time {
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.keyword-status {
    text-align: right;
}

.keyword-type-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.keyword-type-ticker {
    background: rgba(255, 107, 157, 0.2);
    color: var(--accent-pink);
    border: 1px solid rgba(255, 107, 157, 0.4);
}

.keyword-type-topic {
    background: rgba(100, 181, 246, 0.2);
    color: var(--accent-blue);
    border: 1px solid rgba(100, 181, 246, 0.4);
}

.keyword-type-hashtag {
    background: rgba(156, 39, 176, 0.2);
    color: var(--accent-purple);
    border: 1px solid rgba(156, 39, 176, 0.4);
}

.keyword-type-custom {
    background: rgba(255, 152, 0, 0.2);
    color: var(--accent-orange);
    border: 1px solid rgba(255, 152, 0, 0.4);
}

.keyword-type-unknown {
    background: rgba(160, 160, 176, 0.2);
    color: var(--text-secondary);
    border: 1px solid rgba(160, 160, 176, 0.4);
}

.keyword-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.keyword-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.keyword-status-active {
    background: rgba(76, 175, 80, 0.2);
    color: var(--accent-green);
    border: 1px solid rgba(76, 175, 80, 0.4);
}

.keyword-status-active::before {
    background: var(--accent-green);
    animation: pulse-dot 2s ease-in-out infinite;
}

.keyword-status-recent {
    background: rgba(100, 181, 246, 0.2);
    color: var(--accent-blue);
    border: 1px solid rgba(100, 181, 246, 0.4);
}

.keyword-status-recent::before {
    background: var(--accent-blue);
}

.keyword-status-idle {
    background: rgba(160, 160, 176, 0.2);
    color: var(--text-secondary);
    border: 1px solid rgba(160, 160, 176, 0.4);
}

.keyword-status-idle::before {
    background: var(--text-secondary);
}

.keyword-status-never {
    background: rgba(255, 152, 0, 0.2);
    color: var(--accent-orange);
    border: 1px solid rgba(255, 152, 0, 0.4);
}

.keyword-status-never::before {
    background: var(--accent-orange);
}

.keywords-list-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--text-secondary);
    font-size: 1rem;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

/* 响应式 */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 1rem;
    }

    .dashboard-header h1 {
        font-size: 1.8rem;
    }

    .filters-bar {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        justify-content: flex-start;
    }

    .stats-cards {
        grid-template-columns: 1fr 1fr;
    }

    .charts-section {
        grid-template-columns: 1fr;
    }

    .chart-container {
        min-width: auto;
    }

    .keywords-list-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .keywords-list-controls {
        width: 100%;
        flex-wrap: wrap;
    }

    .keywords-list-controls select,
    .keywords-list-controls button {
        flex: 1;
        min-width: 120px;
    }

    .keywords-add-fields {
        flex-direction: column;
        width: 100%;
    }

    .keywords-add-actions {
        width: 100%;
        justify-content: space-between;
    }

    .keywords-table {
        font-size: 0.8rem;
    }

    .keywords-table th,
    .keywords-table td {
        padding: 0.6rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }

    .status-bar {
        grid-template-columns: 1fr;
    }
}

/* 加载动画 */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* 添加关键词触发按钮 */
.keywords-add-trigger {
    margin-bottom: 1rem;
}

.keywords-add-trigger .secondary-button {
    background: linear-gradient(135deg, rgba(100, 181, 246, 0.15), rgba(255, 107, 157, 0.15));
    border: 1px solid rgba(100, 181, 246, 0.3);
    padding: 0.7rem 1.5rem;
    font-weight: 600;
}

.keywords-add-trigger .secondary-button:hover {
    background: linear-gradient(135deg, rgba(100, 181, 246, 0.25), rgba(255, 107, 157, 0.25));
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(100, 181, 246, 0.2);
}

.keywords-cancel {
    background: rgba(255, 107, 157, 0.1);
    border-color: rgba(255, 107, 157, 0.3);
}

.keywords-cancel:hover {
    background: rgba(255, 107, 157, 0.2);
}

/* 优先级选择弹窗 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-keyword {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 1.2rem;
    color: var(--accent-blue);
}

.priority-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.priority-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border-radius: 14px;
    border: 2px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.3s ease;
}

.priority-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.priority-high {
    border-color: rgba(255, 152, 0, 0.4);
}

.priority-high:hover {
    background: rgba(255, 152, 0, 0.15);
    border-color: var(--accent-orange);
}

.priority-low {
    border-color: rgba(100, 181, 246, 0.4);
}

.priority-low:hover {
    background: rgba(100, 181, 246, 0.15);
    border-color: var(--accent-blue);
}

.priority-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.priority-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.priority-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.modal-footer {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.modal-cancel {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.6rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.modal-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}