/* ============================================================
   工银积存金价格监控 - 科技金融风UI样式
   深色背景 + 蓝金渐变 + 网格底纹 + 发光效果
   ============================================================ */

/* ---------- CSS 变量 ---------- */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #0f1525;
    --bg-card: rgba(15, 21, 37, 0.85);
    --bg-card-hover: rgba(20, 28, 48, 0.9);
    --border-color: rgba(59, 130, 246, 0.15);
    --border-glow: rgba(59, 130, 246, 0.3);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #3b82f6;
    --accent-gold: #f59e0b;
    --accent-green: #10b981;
    --accent-purple: #8b5cf6;
    --accent-red: #ef4444;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Consolas', 'Courier New', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

/* ---------- 基础重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ---------- 网格底纹背景 ---------- */
.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(59, 130, 246, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.025) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 0;
    pointer-events: none;
}

.grid-glow {
    position: fixed;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 60%;
    background: radial-gradient(ellipse at center,
        rgba(59, 130, 246, 0.05) 0%,
        rgba(245, 158, 11, 0.02) 40%,
        transparent 70%);
    z-index: 0;
    pointer-events: none;
}

/* ---------- 顶部状态栏 ---------- */
.header {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    height: 64px;
    background: linear-gradient(135deg,
        rgba(15, 21, 37, 0.95) 0%,
        rgba(10, 14, 26, 0.95) 100%);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 20px;
    color: var(--accent-gold);
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
    animation: logo-pulse 3s ease-in-out infinite;
}

@keyframes logo-pulse {
    0%, 100% { opacity: 1; text-shadow: 0 0 10px rgba(245, 158, 11, 0.5); }
    50% { opacity: 0.7; text-shadow: 0 0 20px rgba(245, 158, 11, 0.8); }
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(135deg, #60a5fa 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-label {
    color: var(--text-muted);
    font-size: 12px;
}

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

.status-online {
    background: var(--accent-green);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
    animation: dot-pulse 2s ease-in-out infinite;
}

.status-error {
    background: var(--accent-red);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.status-idle {
    background: var(--text-muted);
}

@keyframes dot-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

#workTimeText {
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.work-time-active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.work-time-inactive {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(100, 116, 139, 0.3);
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg,
        rgba(59, 130, 246, 0.15) 0%,
        rgba(59, 130, 246, 0.05) 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    color: var(--accent-blue);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.refresh-btn:hover {
    background: linear-gradient(135deg,
        rgba(59, 130, 246, 0.25) 0%,
        rgba(59, 130, 246, 0.1) 100%);
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
}

.refresh-btn:active {
    transform: scale(0.96);
}

.refresh-btn svg {
    transition: transform 0.5s ease;
}

.refresh-btn:active svg {
    transform: rotate(180deg);
}

/* ---------- 主内容区 ---------- */
.main {
    position: relative;
    z-index: 2;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 32px 48px;
}

/* ---------- 价格卡片 ---------- */
.price-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.price-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.price-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-glow);
    transform: translateY(-2px);
    box-shadow: 0 4px 24px rgba(59, 130, 246, 0.12);
}

.card-indicator {
    height: 3px;
    width: 100%;
}

.indicator-blue {
    background: linear-gradient(90deg, var(--accent-blue), rgba(59, 130, 246, 0.2));
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.indicator-gold {
    background: linear-gradient(90deg, var(--accent-gold), rgba(245, 158, 11, 0.2));
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.indicator-green {
    background: linear-gradient(90deg, var(--accent-green), rgba(16, 185, 129, 0.2));
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.indicator-purple {
    background: linear-gradient(90deg, var(--accent-purple), rgba(139, 92, 246, 0.2));
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
}

.card-body {
    padding: 20px 24px;
}

.card-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-family: var(--font-mono);
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 6px;
}

.value-blue {
    color: var(--accent-blue);
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.value-gold {
    color: var(--accent-gold);
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

.value-green {
    color: var(--accent-green);
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.value-purple {
    color: var(--accent-purple);
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.card-time {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ---------- 图表区域 ---------- */
.chart-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    backdrop-filter: blur(8px);
}

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

.chart-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    position: relative;
    padding-left: 14px;
}

.chart-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 18px;
    background: linear-gradient(180deg, var(--accent-blue), var(--accent-gold));
    border-radius: 2px;
}

/* ---------- 范围按钮 ---------- */
.range-buttons {
    display: flex;
    gap: 8px;
}

.range-btn {
    padding: 6px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.range-btn:hover {
    border-color: var(--border-glow);
    color: var(--text-primary);
}

.range-btn.active {
    background: linear-gradient(135deg,
        rgba(59, 130, 246, 0.2) 0%,
        rgba(245, 158, 11, 0.1) 100%);
    border-color: var(--accent-blue);
    color: var(--text-primary);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

/* ---------- 日期选择器 ---------- */
.date-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-picker-wrapper label {
    font-size: 13px;
    color: var(--text-secondary);
}

.date-picker-wrapper input[type="date"] {
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    color-scheme: dark;
}

.date-picker-wrapper input[type="date"]:hover {
    border-color: var(--border-glow);
}

.date-picker-wrapper input[type="date"]:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.2);
}

.load-btn {
    padding: 6px 16px;
    background: linear-gradient(135deg,
        rgba(59, 130, 246, 0.15) 0%,
        rgba(59, 130, 246, 0.05) 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    color: var(--accent-blue);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.load-btn:hover {
    background: linear-gradient(135deg,
        rgba(59, 130, 246, 0.25) 0%,
        rgba(59, 130, 246, 0.1) 100%);
    border-color: rgba(59, 130, 246, 0.5);
}

/* ---------- 图表容器 ---------- */
.chart-container {
    position: relative;
    height: 320px;
}

/* ---------- 预警配置区域 ---------- */
.alert-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    backdrop-filter: blur(8px);
}

.alert-section .chart-title {
    margin-bottom: 20px;
}

.alert-form {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr auto;
    gap: 16px;
    align-items: end;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    color: var(--text-muted);
}

.form-group select,
.form-group input {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    transition: all 0.2s ease;
}

.form-group select:hover,
.form-group input:hover {
    border-color: var(--border-glow);
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.2);
}

.add-alert-btn {
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--accent-blue) 0%, #2563eb 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.add-alert-btn:hover {
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.add-alert-btn:active {
    transform: scale(0.97);
}

/* ---------- 预警列表 ---------- */
.alert-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
    font-size: 14px;
}

.alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.alert-item:hover {
    border-color: var(--border-glow);
}

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

.alert-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

.alert-direction {
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.alert-up {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-down {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-price {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-gold);
    white-space: nowrap;
}

.alert-webhook {
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

.alert-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.alert-actions button {
    padding: 5px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    color: var(--text-secondary);
}

.btn-toggle:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.btn-test:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.btn-delete:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

/* ---------- 滚动条样式 ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.4);
}

/* ---------- 响应式布局 ---------- */
@media (max-width: 1024px) {
    .price-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .alert-form {
        grid-template-columns: 1fr 1fr;
    }

    .form-group-webhook {
        grid-column: span 2;
    }

    .add-alert-btn {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 16px;
        height: auto;
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .header-right {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }

    .main {
        padding: 16px;
    }

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

    .card-value {
        font-size: 1.8rem;
    }

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

    .alert-form {
        grid-template-columns: 1fr;
    }

    .form-group-webhook {
        grid-column: span 1;
    }

    .add-alert-btn {
        grid-column: span 1;
    }

    .alert-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .alert-info {
        flex-wrap: wrap;
    }

    .alert-webhook {
        max-width: 100%;
    }
}

/* ============================================================
   3D金融视觉升级 - 新增样式
   ============================================================ */

/* ---------- 背景画布 ---------- */
.bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ---------- 涨跌趋势箭头 ---------- */
.price-trend {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 18px;
    font-weight: bold;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
    line-height: 1;
}

.price-trend.trend-show {
    animation: trend-fade-in 0.3s ease forwards;
}

.price-trend.trend-hide {
    animation: trend-fade-out 0.5s ease forwards;
}

@keyframes trend-fade-in {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes trend-fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* ---------- 价格数字跳动效果 ---------- */
.card-value.pulse {
    animation: card-value-pulse 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes card-value-pulse {
    0% {
        transform: scale(1);
        text-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
    }
    40% {
        transform: scale(1.18);
        text-shadow: 0 0 35px rgba(245, 158, 11, 0.9),
                     0 0 15px rgba(255, 255, 255, 0.6);
    }
    100% {
        transform: scale(1);
        text-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
    }
}

/* ---------- 实时价格发光脉动 ---------- */
#activePrice {
    animation: active-price-glow 2s ease-in-out infinite;
}

@keyframes active-price-glow {
    0%, 100% {
        text-shadow: 0 0 20px rgba(59, 130, 246, 0.5),
                     0 0 10px rgba(245, 158, 11, 0.3);
    }
    50% {
        text-shadow: 0 0 35px rgba(59, 130, 246, 0.8),
                     0 0 20px rgba(245, 158, 11, 0.6),
                     0 0 10px rgba(255, 255, 255, 0.3);
    }
}
