/* 价格监控运维面板样式 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #1a1a2e;
    color: #eee;
    line-height: 1.6;
    min-height: 100vh;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #333;
}

header h1 {
    font-size: 1.8em;
    color: #00d4ff;
}

.refresh-info {
    color: #888;
    font-size: 0.9em;
    margin-top: 10px;
}

/* 状态卡片 */
.glance {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    background: #111936;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}

.glance-item {
    background: #16213e;
    border-radius: 10px;
    padding: 15px;
    border: 1px solid #222b45;
}

.glance-item span {
    color: #7f8fa6;
    font-size: 0.8em;
}

.glance-item strong {
    display: block;
    font-size: 1.6em;
    color: #00ffea;
}

.glance-item small {
    color: #8899c0;
    font-size: 0.85em;
}

.critical-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    background: #361919;
    border-radius: 10px;
    padding: 12px 15px;
    border: 1px solid #ff4444;
    margin-bottom: 20px;
}

.critical-strip span {
    background: rgba(255, 68, 68, 0.1);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85em;
    color: #ffb4b4;
}

.panel {
    background: #16213e;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #1f2a44;
}

.panel-head {
    margin-bottom: 15px;
}

.panel-head h2 {
    margin-bottom: 5px;
    font-size: 1.2em;
    color: #00d4ff;
}

.panel-head p {
    color: #7f8fa6;
    font-size: 0.9em;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.status-card-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.status-card {
    background: #0f1c33;
    border-radius: 12px;
    padding: 16px;
    border: 2px solid #1f2a44;
}

.status-card.online { border-color: #00ff88; }
.status-card.warning { border-color: #ffaa00; }
.status-card.offline { border-color: #ff4444; }

.status-card h3 {
    font-size: 1.1em;
    color: #fff;
}

.status-icon {
    font-size: 1em;
    color: #ccd6f6;
}

.dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    animation: pulse 2s infinite;
}

.dot.green { background: #00ff88; }
.dot.yellow { background: #ffaa00; }
.dot.red { background: #ff4444; }

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

.stats p {
    margin: 8px 0;
    color: #ccc;
}

/* 数据来源状态 */
.source-status {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 15px 0;
    padding: 12px;
    background: #111f3c;
    border-radius: 10px;
}

.source-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #ccc;
}

.source-item.online {
    color: #00ff88;
}

.source-item.offline {
    color: #ff4444;
}


.source-label {
    font-weight: 600;
    color: #00d4ff;
}

.source-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.source-dot.green { background: #00ff88; }
.source-dot.red { background: #ff4444; }

.last-time {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #1f2a44;
    color: #7f8fa6;
    font-size: 0.85em;
}

.timeline {
    list-style: none;
    border-left: 2px solid #233554;
    margin-left: 10px;
    padding-left: 20px;
    max-height: 600px;
    overflow-y: auto;
}

.timeline-item {
    margin-bottom: 20px;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -29px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #00d4ff;
    border: 2px solid #0f1c33;
}

.timeline-item:hover {
    transform: translateX(4px);
}

.timeline-time {
    color: #7f8fa6;
    font-size: 0.85em;
}

.timeline-content {
    background: #0f1c33;
    border-radius: 10px;
    padding: 12px;
    border: 1px solid #1f2a44;
}

.timeline-title {
    font-weight: 600;
    color: #fff;
}

.timeline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 6px 0;
    font-size: 0.85em;
    align-items: center;
}

.duration-pill {
    background: #102a43;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #1f4068;
}

.health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.health-card {
    background: #0f1c33;
    border-radius: 10px;
    padding: 15px;
    border: 1px solid #1f2a44;
}

.health-card ul {
    margin-top: 10px;
    padding-left: 15px;
    color: #a0aec0;
    font-size: 0.9em;
}

.state-text {
    color: #fff;
    font-weight: 600;
}

.system-card {
    margin-top: 20px;
    background: rgba(0, 212, 255, 0.08);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #00d4ff;
}

.panel.bottom-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.panel-block {
    background: #0f1c33;
    border-radius: 12px;
    padding: 15px;
    border: 1px solid #1f2a44;
}

.panel-block h3 {
    color: #00d4ff;
    margin-bottom: 10px;
}

.mini-table th,
.mini-table td {
    border-bottom: 1px solid #1f2a44;
}

.link-btn {
    background: transparent;
    border: 1px solid #00d4ff;
    color: #00d4ff;
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.8em;
}

.trend-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trend-hour {
    width: 60px;
    display: inline-block;
    color: #7f8fa6;
    font-size: 0.85em;
}

.trend-bar {
    flex: 1;
    background: #1f2a44;
    border-radius: 6px;
    overflow: hidden;
    margin: 0 10px;
    height: 8px;
    display: inline-block;
    vertical-align: middle;
}

.trend-bar span {
    display: block;
    height: 100%;
    background: #00d4ff;
}

.trend-meta {
    color: #a0aec0;
    font-size: 0.85em;
}

.trend-list li {
    display: flex;
    align-items: center;
}

.reason-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reason-list li {
    background: #111f3c;
    border-radius: 10px;
    padding: 10px;
    border: 1px solid #1f2a44;
    cursor: pointer;
}

.reason-list strong {
    display: block;
    color: #fff;
}

.reason-list span {
    font-size: 0.85em;
    color: #a0aec0;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #0f1c33;
    border-radius: 12px;
    padding: 20px;
    width: 90%;
    max-width: 520px;
    z-index: 1001;
    border: 1px solid #1f2a44;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
}

.modal-backdrop.hidden {
    display: none;
}

.modal-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.4em;
    position: absolute;
    top: 10px;
    right: 15px;
    cursor: pointer;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.modal-grid span {
    display: block;
    font-size: 0.75em;
    color: #8899c0;
    text-transform: uppercase;
}

.modal-grid strong {
    font-size: 1em;
    color: #fff;
}

.modal-reason {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #1f2a44;
}

.modal-reason span {
    display: block;
    font-size: 0.8em;
    color: #8899c0;
    margin-bottom: 6px;
}

.modal-reason p {
    color: #eaeaea;
}

@media (max-width: 768px) {
    .timeline {
        max-height: none;
    }

    .modal {
        top: auto;
        bottom: 0;
        left: 0;
        transform: none;
        width: 100%;
        border-radius: 12px 12px 0 0;
    }
}

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

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #333;
}

th {
    background: #0f3460;
    color: #00d4ff;
    font-weight: 600;
}

tr:hover {
    background: #1f4068;
}

.no-data {
    text-align: center;
    color: #666;
    padding: 30px;
}

.reason {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #888;
}

.backup-ok {
    color: #00ff88;
}

.backup-critical {
    color: #ff4444;
    font-weight: bold;
}

.backup-unknown {
    color: #ffaa00;
}

/* 导航 */
.nav {
    text-align: center;
    background: transparent;
    padding: 10px;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    background: #0f3460;
    color: #00d4ff;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid #00d4ff;
    transition: all 0.3s;
}

.btn:hover {
    background: #00d4ff;
    color: #1a1a2e;
}

footer {
    text-align: center;
    color: #666;
    padding: 20px;
    font-size: 0.85em;
}

/* 详情页样式 */
.filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.filters select, .filters input {
    padding: 8px 12px;
    background: #0f3460;
    border: 1px solid #333;
    color: #eee;
    border-radius: 6px;
}

.filters button {
    padding: 8px 20px;
    background: #00d4ff;
    color: #1a1a2e;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.filters button:hover {
    background: #00b8e6;
}

.chart-container {
    height: 300px;
    margin: 20px 0;
}

.tolerance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.tolerance-item {
    text-align: center;
    padding: 15px;
    background: #0f3460;
    border-radius: 8px;
}

.tolerance-item .value {
    font-size: 1.8em;
    color: #00ff88;
    font-weight: bold;
}

.tolerance-item .label {
    color: #888;
    font-size: 0.9em;
}
