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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #0f1420;
    color: #e4e7eb;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: grid;
    grid-template-columns: 240px 1fr 360px;
    grid-template-rows: 100vh;
    gap: 1px;
    background: #1a2332;
}

/* ============ 左侧股票列表 ============ */
.sidebar-left {
    background: #151b28;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #1e2838;
}

.sidebar-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1e2838;
}

.sidebar-header h2 {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.btn-add {
    background: #2d7d46;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-add:hover {
    background: #358a50;
}

.search-box {
    padding: 12px 16px;
    border-bottom: 1px solid #1e2838;
}

.search-box input {
    width: 100%;
    padding: 8px 12px;
    background: #1e2838;
    border: 1px solid #2a3648;
    border-radius: 4px;
    color: #e4e7eb;
    font-size: 13px;
    outline: none;
}

.search-box input:focus {
    border-color: #2d7d46;
}

.stock-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.stock-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid transparent;
    position: relative;
}

.stock-item:hover {
    background: #1e2838;
}

.stock-item.active {
    background: #2d7d46;
    border-left: 3px solid #4caf50;
    padding-left: 13px;
}

.stock-name {
    flex: 1;
    font-size: 14px;
    color: #e4e7eb;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stock-item.active .stock-name {
    color: #fff;
    font-weight: 500;
}

.stock-code {
    font-size: 12px;
    color: #6b7a90;
    margin-right: 8px;
}

.stock-item.active .stock-code {
    color: #cce0ff;
}

.btn-remove {
    background: transparent;
    border: none;
    color: #6b7a90;
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.stock-item:hover .btn-remove {
    opacity: 1;
}

.btn-remove:hover {
    color: #e74c3c;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid #1e2838;
}

.btn-refresh {
    width: 100%;
    padding: 8px;
    background: #1e2838;
    color: #a0b4cc;
    border: 1px solid #2a3648;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-refresh:hover {
    background: #2a3648;
    color: #fff;
}

/* ============ 中间K线区 ============ */
.main-content {
    background: #0f1420;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.stock-info-bar {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    background: #151b28;
    border-bottom: 1px solid #1e2838;
    gap: 24px;
    min-height: 80px;
}

.info-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
}

.stock-title {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
}

.stock-code-big {
    font-size: 13px;
    color: #6b7a90;
}

.info-center {
    flex: 1;
}

.price-info {
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.current-price {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
}

.current-price.up {
    color: #ef4444;
}

.current-price.down {
    color: #10b981;
}

.change-info {
    font-size: 14px;
    padding: 4px 10px;
    border-radius: 4px;
    background: #2a3648;
    color: #a0b4cc;
}

.change-info.up {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.change-info.down {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.info-right {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: right;
    min-width: 80px;
}

.metric-label {
    font-size: 11px;
    color: #6b7a90;
}

.metric-value {
    font-size: 15px;
    font-weight: 500;
    color: #e4e7eb;
}

.metric-sub {
    font-size: 11px;
    color: #6b7a90;
}

.metric-sub.low {
    color: #10b981;
}

.metric-sub.high {
    color: #ef4444;
}

.chart-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 16px;
    overflow-y: auto;
    min-height: 0;
}

.chart-box {
    background: #151b28;
    border-radius: 6px;
    border: 1px solid #1e2838;
    display: flex;
    flex-direction: column;
    min-height: 220px;
    flex: 1;
}

.chart-box.chart-main {
    min-height: 320px;
    flex: 1.5;
}

.chart-box.chart-small {
    min-height: 180px;
}

.chart-title {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #a0b4cc;
    border-bottom: 1px solid #1e2838;
}

.chart {
    flex: 1;
    min-height: 150px;
}

/* ============ 右侧新闻区 ============ */
.sidebar-right {
    background: #151b28;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #1e2838;
}

.news-tabs {
    display: flex;
    padding: 0 8px;
    border-bottom: 1px solid #1e2838;
    flex-wrap: wrap;
}

.tab-btn {
    flex: 1;
    padding: 12px 6px;
    background: transparent;
    border: none;
    color: #6b7a90;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    min-width: auto;
}

.tab-btn:hover {
    color: #a0b4cc;
}

.tab-btn.active {
    color: #4caf50;
    border-bottom-color: #4caf50;
}

.news-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.news-loading {
    text-align: center;
    padding: 40px;
    color: #6b7a90;
    font-size: 14px;
}

.news-item {
    padding: 12px 16px;
    border-bottom: 1px solid #1e2838;
    cursor: pointer;
    transition: background 0.15s;
}

.news-item:hover {
    background: #1e2838;
}

.news-item.ai-tagged {
    border-left: 3px solid #4caf50;
    padding-left: 13px;
}

.news-title {
    font-size: 13px;
    color: #e4e7eb;
    line-height: 1.5;
    margin-bottom: 6px;
    font-weight: 500;
}

.news-summary {
    font-size: 12px;
    color: #6b7a90;
    line-height: 1.5;
    margin-bottom: 6px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #556578;
}

.news-category {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
}

.news-link {
    color: #6b7a90;
    text-decoration: none;
}

.news-link:hover {
    color: #4caf50;
}

.news-update-info {
    padding: 10px 16px;
    border-top: 1px solid #1e2838;
    font-size: 12px;
    color: #556578;
    text-align: center;
}

/* ============ 弹窗 ============ */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #151b28;
    border-radius: 8px;
    width: 400px;
    border: 1px solid #2a3648;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #1e2838;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.modal-close {
    background: transparent;
    border: none;
    color: #6b7a90;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #fff;
}

.modal-body {
    padding: 20px;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    color: #a0b4cc;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 8px 12px;
    background: #0f1420;
    border: 1px solid #2a3648;
    border-radius: 4px;
    color: #e4e7eb;
    font-size: 14px;
    outline: none;
}

.form-group input:focus {
    border-color: #4caf50;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid #1e2838;
}

.btn-cancel, .btn-confirm {
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    border: none;
}

.btn-cancel {
    background: #2a3648;
    color: #a0b4cc;
}

.btn-cancel:hover {
    background: #3a4a5e;
}

.btn-confirm {
    background: #4caf50;
    color: #fff;
}

.btn-confirm:hover {
    background: #5cb860;
}

/* ============ 滚动条 ============ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0f1420;
}

::-webkit-scrollbar-thumb {
    background: #2a3648;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a4a5e;
}

/* ============ 响应式 ============ */
@media (max-width: 1200px) {
    .app-container {
        grid-template-columns: 200px 1fr 320px;
    }
}

@media (max-width: 960px) {
    .app-container {
        grid-template-columns: 180px 1fr 280px;
    }
}
