/* ── 全局 ─────────────────────────────────────────────────── */
@import url('/inter-font.css');

* { box-sizing: border-box; }

body {
    font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    min-height: 100vh;
    margin: 0;
    color: #e2e8f0;
}

.page-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

/* ── 页头 ─────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.page-title .icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3em;
    box-shadow: 0 4px 15px rgba(102,126,234,.4);
}
.page-title h1 {
    margin: 0;
    font-size: 1.5em;
    font-weight: 700;
    background: linear-gradient(135deg, #a78bfa, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.page-title .subtitle {
    font-size: 0.8em;
    color: #94a3b8;
    margin-top: 2px;
}

/* ── 状态栏 ───────────────────────────────────────────────── */
.status-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 12px;
    padding: 10px 18px;
    font-size: 0.82em;
    flex-wrap: wrap;
}
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #22d3ee;
    box-shadow: 0 0 0 0 rgba(34,211,238,.4);
    animation: pulse-dot 2s infinite;
    flex-shrink: 0;
}
.status-dot.off { background: #64748b; animation: none; box-shadow: none; }
@keyframes pulse-dot {
    0%   { box-shadow: 0 0 0 0 rgba(34,211,238,.4); }
    70%  { box-shadow: 0 0 0 8px rgba(34,211,238,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,211,238,0); }
}
.status-text { color: #94a3b8; }
.status-text strong { color: #e2e8f0; }
.countdown-badge {
    background: rgba(102,126,234,.25);
    color: #a78bfa;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.btn-toggle-poll {
    padding: 5px 14px;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,.15);
    transition: all 0.2s;
}
.btn-toggle-poll.running {
    background: rgba(239,68,68,.15);
    color: #f87171;
    border-color: rgba(239,68,68,.3);
}
.btn-toggle-poll.running:hover { background: rgba(239,68,68,.25); }
.btn-toggle-poll.stopped {
    background: rgba(34,211,238,.12);
    color: #22d3ee;
    border-color: rgba(34,211,238,.3);
}
.btn-toggle-poll.stopped:hover { background: rgba(34,211,238,.22); }

/* ── 面板 ────────────────────────────────────────────────── */
.panel {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}
.panel-title {
    font-size: 0.95em;
    font-weight: 700;
    color: #c4b5fd;
    margin: 0 0 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.panel-title::before {
    content: '';
    width: 3px; height: 16px;
    background: linear-gradient(#667eea, #764ba2);
    border-radius: 2px;
}

/* ── 添加表单 ─────────────────────────────────────────────── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}
.form-row.single { grid-template-columns: 1fr; }
.form-row.triple { grid-template-columns: 1fr 1fr 1fr; }
@media(max-width:600px) { .form-row { grid-template-columns: 1fr; } }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
    font-size: 0.78em;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.form-group input, .form-group select, .form-group textarea {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 9px;
    color: #e2e8f0;
    padding: 9px 13px;
    font-size: 0.9em;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-group input::placeholder { color: #64748b; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124,58,237,.2);
}
.form-group select option { background: #1e1b4b; color: #e2e8f0; }

/* 条件列表 */
.conditions-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}
.condition-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 8px;
    align-items: center;
}
@media(max-width:600px) {
    .condition-row { grid-template-columns: 1fr 1fr; }
    .condition-row .del-cond { grid-column: span 2; }
}
.btn-del-cond {
    background: rgba(239,68,68,.15);
    border: none;
    color: #f87171;
    border-radius: 7px;
    width: 32px; height: 32px;
    cursor: pointer;
    font-size: 1em;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s;
}
.btn-del-cond:hover { background: rgba(239,68,68,.3); }

.btn-add-cond {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(102,126,234,.15);
    border: 1px dashed rgba(102,126,234,.4);
    color: #a5b4fc;
    border-radius: 9px;
    padding: 7px 14px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}
.btn-add-cond:hover { background: rgba(102,126,234,.25); border-style: solid; }

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}
.btn-primary {
    padding: 10px 26px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.92em;
    font-weight: 700;
    cursor: pointer;
    transition: all .25s;
    box-shadow: 0 4px 15px rgba(102,126,234,.35);
    font-family: inherit;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(102,126,234,.45); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.btn-secondary {
    padding: 10px 22px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.15);
    color: #94a3b8;
    border-radius: 10px;
    font-size: 0.92em;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}
.btn-secondary:hover { background: rgba(255,255,255,.13); color: #e2e8f0; }

/* ── 监控列表 ─────────────────────────────────────────────── */
.monitor-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.monitor-card {
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 14px;
    padding: 18px 20px;
    transition: border-color .2s, transform .2s;
    animation: slideIn .3s ease;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.monitor-card:hover { border-color: rgba(124,58,237,.4); }
.monitor-card.disabled { opacity: .5; }
.monitor-card.triggered {
    border-color: rgba(250,204,21,.6);
    box-shadow: 0 0 20px rgba(250,204,21,.15);
}

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

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.asset-badge {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: 700;
    letter-spacing: .04em;
}
.asset-badge.stock { background: rgba(34,211,238,.15); color: #22d3ee; }
.asset-badge.bond  { background: rgba(168,85,247,.15);  color: #c084fc; }
.card-name { font-weight: 700; font-size: 1.05em; color: #e2e8f0; }
.card-code { font-size: 0.82em; color: #64748b; font-family: monospace; }
.card-note { font-size: 0.8em; color: #94a3b8; margin-top: 2px; }

.card-actions { display: flex; gap: 7px; flex-shrink: 0; }
.btn-icon {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    color: #94a3b8;
    border-radius: 8px;
    width: 30px; height: 30px;
    cursor: pointer;
    font-size: 0.9em;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s;
}
.btn-icon:hover { background: rgba(255,255,255,.15); color: #e2e8f0; }
.btn-icon.del:hover { background: rgba(239,68,68,.2); color: #f87171; border-color: rgba(239,68,68,.3); }
.btn-icon.on  { background: rgba(34,211,238,.12); color: #22d3ee; border-color: rgba(34,211,238,.3); }
.btn-icon.off { background: rgba(100,116,139,.12); color: #64748b; }

/* 行情条 */
.quote-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    background: rgba(255,255,255,.04);
    border-radius: 9px;
    padding: 10px 14px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.quote-price {
    font-size: 1.4em;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #f0f0f0;
}
.quote-change.up   { color: #4ade80; font-weight: 600; }
.quote-change.down { color: #f87171; font-weight: 600; }
.quote-change.flat { color: #94a3b8; }
.quote-field { display: flex; flex-direction: column; gap: 1px; }
.quote-label { font-size: 0.68em; color: #64748b; text-transform: uppercase; }
.quote-val   { font-size: 0.88em; color: #cbd5e1; font-variant-numeric: tabular-nums; }
.quote-premium { color: #fcd34d; }

.no-quote {
    font-size: 0.8em;
    color: #475569;
    font-style: italic;
    padding: 6px 0;
}

/* 条件标签 */
.cond-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.cond-tag {
    background: rgba(124,58,237,.15);
    border: 1px solid rgba(124,58,237,.25);
    color: #c4b5fd;
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 0.78em;
    font-weight: 500;
}
.cond-tag.hit {
    background: rgba(250,204,21,.15);
    border-color: rgba(250,204,21,.4);
    color: #fcd34d;
}

/* 最近推送时间 */
.last-alert {
    font-size: 0.75em;
    color: #475569;
    margin-top: 8px;
}
.last-alert strong { color: #64748b; }

/* 提醒闪光 */
.alert-flash {
    font-size: 0.7em;
    background: rgba(250,204,21,.15);
    border: 1px solid rgba(250,204,21,.4);
    color: #fcd34d;
    border-radius: 6px;
    padding: 2px 8px;
    animation: flashBlink 1s ease 3;
}
@keyframes flashBlink {
    0%,100% { opacity: 1; }
    50% { opacity: .3; }
}

/* ── 空状态 ───────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #475569;
}
.empty-state .icon { font-size: 2.8em; margin-bottom: 12px; }
.empty-state p { font-size: 0.9em; }

/* ── Toast ────────────────────────────────────────────────── */
#toast-wrap {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 99999;
}
.toast {
    padding: 12px 20px;
    border-radius: 12px;
    color: #fff;
    font-size: 0.88em;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,.35);
    animation: toastIn .3s ease;
    max-width: 320px;
}
.toast.success { background: linear-gradient(135deg, #059669, #047857); }
.toast.error   { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.toast.info    { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── 输入加载旋转 ─────────────────────────────────────────── */
.spin {
    display: inline-block;
    animation: spin .7s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── 折叠添加区域 ─────────────────────────────────────────── */
.toggle-add-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(102,126,234,.2), rgba(118,75,162,.2));
    border: 1px solid rgba(102,126,234,.35);
    color: #a78bfa;
    border-radius: 12px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    font-family: inherit;
    transition: all .2s;
    width: 100%;
    justify-content: center;
    margin-bottom: 16px;
}
.toggle-add-btn:hover {
    background: linear-gradient(135deg, rgba(102,126,234,.3), rgba(118,75,162,.3));
    transform: translateY(-1px);
}
.add-panel { display: none; }
.add-panel.open { display: block; }

/* 分隔线 */
.divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,.07);
    margin: 8px 0 16px;
}

/* 轮询间隔 */
.interval-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.interval-wrap input[type=range] {
    flex: 1;
    accent-color: #7c3aed;
}
.interval-label {
    font-size: 0.82em;
    color: #a78bfa;
    min-width: 52px;
    text-align: right;
    font-weight: 600;
}

/* modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn .2s;
}
.modal-backdrop.open { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
    background: #1e1b4b;
    border: 1px solid rgba(124,58,237,.4);
    border-radius: 18px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal-title {
    font-size: 1.05em;
    font-weight: 700;
    color: #c4b5fd;
    margin: 0 0 18px;
}
.modal-actions { display: flex; gap: 10px; margin-top: 22px; justify-content: flex-end; }
.btn-danger {
    padding: 9px 22px;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 0.9em;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}