/* QuoteTable Component - 响应式行情表格组件 */
/* 可独立使用，无第三方依赖 - ATGPM主题风格 */

.quote-table-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    font-family: 'Open Sans', 'Montserrat', sans-serif;
    /* 与Live_Price.aspx页面融合的样式 */
    background: #ffffff;
    border: none;
    border-radius: 0;
    box-shadow: none;
    color: #555;
    font-size: 15px;
    overflow: hidden;
}

/* 表格头部 */
.quote-table-header {
    display: grid;
    grid-template-columns: 2fr 80px 1fr 1fr 0.8fr 1.2fr 1fr 1fr;
    padding: 12px 0;
    background: #bd9e56;
    font-weight: 700;
    font-size: 13px;
    color: #ffffff;
    border-bottom: 2px solid #bd9e56;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.quote-table-header > div {
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

.quote-table-header > div:last-child {
    border-right: none;
}

.quote-table-header .symbol-column {
    text-align: left;
}

.quote-table-header .chart-column {
    text-align: center;
}

.quote-table-header .high-column,
.quote-table-header .low-column {
    text-align: right;
    padding-right: 8px;
}

.quote-table-header .ask-column {
    text-align: right;
    padding-right: 8px;
}

.quote-table-header .spread-column {
    text-align: right;
    padding-right: 8px;
}

.quote-table-header .bid-column,
.quote-table-header .ask-column {
    text-align: right;
    padding-right: 8px;
}

/* 表格主体 */
.quote-table-body {
    /* 无高度限制 */
    overflow-y: visible;
    padding: 0;
    background: #ffffff;
}

/* 表格行 */
.quote-table-row {
    display: grid;
    grid-template-columns: 2fr 80px 1fr 1fr 0.8fr 1.2fr 1fr 1fr;
    padding: 12px 0;
    border-bottom: 1px solid #f5f5f5;
    transition: background-color 0.2s ease, transform 0.2s ease;
    animation: fadeIn 0.3s ease;
    background: #ffffff;
    min-height: 50px;
    align-items: center;
}

.quote-table-row > div {
    border-right: 1px solid #f5f5f5;
}

.quote-table-row > div:last-child {
    border-right: none;
}

.quote-table-row:nth-child(odd) {
    /* 隔行换色 - 使用页面主题的浅色背景 */
    background: #f9f9f9;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quote-table-row:hover {
    background-color: #f5f0e0;
    transform: translateX(2px);
}

/* 合约名称区域 */
.quote-symbol-wrapper {
    display: flex;
    align-items: center;
}

.quote-symbol-badge {
    padding: 3px 8px;
    border-radius: 3px;
    display: inline-block;
    border: 1px solid transparent;
}

.quote-symbol-badge.bg-up {
    color: #d9534f;
    background: transparent;
    border-color: transparent;
}

.quote-symbol-badge.bg-down {
    color: #28a745;
    background: transparent;
    border-color: transparent;
}

.quote-symbol-badge.bg-flat {
    color: #000000;
    background: transparent;
}

.quote-symbol-name {
    font-weight: 700;
    font-size: 15px;
    color: #000000;
    letter-spacing: 0.3px;
}

/* 价格列 - 股票风格 */
.quote-price {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
}

.quote-price.up .price-value {
    color: #d9534f;
}

.quote-price.down .price-value {
    color: #28a745;
}

/* 高低价颜色 */
.price-high {
    color: #d9534f;
}

.price-low {
    color: #28a745;
}

/* 点差颜色 */
.price-spread {
    color: #111827;
}

/* CHANGE 列居中对齐 */
.quote-table-header .change-column {
    text-align: center;
    padding-right: 0;
}

.quote-table-row > div:nth-child(5) .quote-price {
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
}

/* SPREAD 列容器右对齐 - 使用更高优先级选择器 */
.quote-table-row > div:nth-child(8) {
    justify-self: end !important;
    text-align: right !important;
}

.quote-table-row > div:nth-child(8) .quote-price {
    justify-content: flex-end !important;
    align-items: flex-end !important;
    text-align: right !important;
}

.price-value {
    font-family: 'Open Sans', 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #000000;
}

.price-change {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 2px;
    min-width: 60px;
    text-align: center;
}

.price-change.bg-up {
    background: #d9534f;
    color: white;
}

.price-change.bg-down {
    background: #28a745;
    color: white;
}

.price-change.bg-flat {
    background: #e0e0e0;
    color: #999;
}

/* 价格列（旧版兼容） */
.quote-bid,
.quote-ask {
    text-align: right;
    font-family: 'Open Sans', 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    color: #212121;
    letter-spacing: 0.3px;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2px);
    }
}

/* 空状态 */
.quote-table-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 13px;
}

.quote-table-empty-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.3;
}

/* 加载状态 */
.quote-table-loading {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.quote-loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: #bd9e56;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.quote-table-loading > div:last-child {
    margin-top: 16px;
    font-size: 14px;
    color: #666;
}

/* 移动端加载状态优化 */
@media (max-width: 768px) {
    .quote-table-loading {
        padding: 60px 20px;
    }

    .quote-loading-spinner {
        width: 50px;
        height: 50px;
        border: 4px solid #f0f0f0;
        border-top-color: #bd9e56;
    }

    .quote-table-loading > div:last-child {
        margin-top: 20px;
        font-size: 16px;
        color: #555;
        font-weight: 500;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 搜索高亮 */
.quote-table-row.search-highlight {
    background-color: rgba(189, 158, 86, 0.2);
    animation: highlightPulse 1s ease;
}

@keyframes highlightPulse {
    0%, 100% {
        background-color: rgba(189, 158, 86, 0.2);
    }
    50% {
        background-color: rgba(189, 158, 86, 0.3);
    }
}

/* 隐藏图表列 */
.quote-table-header.hide-chart .chart-column,
.quote-table-row.hide-chart .quote-chart-wrapper {
    display: none;
}

/* 响应式设计 - 平板 */
@media (max-width: 768px) {
    .quote-table-header {
        grid-template-columns: 1.5fr 70px 0.9fr 0.9fr 0.7fr 1fr 1fr 1fr;
        font-size: 11px;
        padding: 6px 10px;
    }

    .quote-table-row {
        grid-template-columns: 1.5fr 70px 0.9fr 0.9fr 0.7fr 1fr 1fr 1fr;
        padding: 5px 8px;
    }

    .quote-symbol-name {
        font-size: 11px;
    }

    .price-value {
        font-size: 13px;
    }

    .price-change {
        font-size: 10px;
        padding: 1px 4px;
        min-width: 50px;
    }

    .quote-spark, .quote-spark-skeleton {
        width: 70px;
        height: 26px;
    }
}

/* 响应式设计 - 手机 */
@media (max-width: 480px) {
    .quote-table-header {
        font-size: 10px;
        padding: 5px 8px;
    }

    .quote-table-row {
        padding: 6px 8px;
    }

    .quote-symbol-name {
        font-size: 11px;
    }

    .price-value {
        font-size: 11px;
    }

    .price-change {
        font-size: 9px;
        padding: 1px 3px;
        min-width: 45px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 360px) {
    .quote-table-header {
        font-size: 10px;
        padding: 4px 6px;
    }

    .quote-table-row {
        padding: 5px 6px;
    }

    .quote-symbol-name {
        font-size: 10px;
    }

    .price-value {
        font-size: 10px;
    }

    .price-change {
        font-size: 9px;
        padding: 1px 2px;
        min-width: 40px;
    }
}

/* 折线图列 */
.quote-chart-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.quote-spark {
    display: block;
    width: 80px;
    height: 30px;
}

.quote-spark.is-hidden {
    display: none;
}

.quote-spark-skeleton {
    width: 80px;
    height: 30px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f5f5f5 0%, #e0e0e0 50%, #f5f5f5 100%);
    background-size: 200% 100%;
    animation: quote-spark-loading 1.2s ease-in-out infinite;
}

.quote-spark-skeleton.is-hidden {
    display: none;
}

@keyframes quote-spark-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 预热进度样式 */
.warmup-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.warmup-status {
    margin-top: 16px;
    font-size: 14px;
    color: #4b5563;
    font-weight: 500;
}

.warmup-progress-bar {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 16px;
}

.warmup-progress-fill {
    height: 100%;
    background: #bd9e56;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.warmup-progress-text {
    margin-top: 8px;
    font-size: 12px;
    color: #6b7280;
}

/* ==================== 移动端垂直布局优化 ==================== */
@media (max-width: 768px) {
    /* 移动端 grid 布局：3列 */
    .quote-table-header {
        grid-template-columns: 1.8fr 1fr 1fr !important;
        min-height: 44px;
        padding: 10px 0;
        align-items: center;
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0.3px;
        background: linear-gradient(180deg, #d4af67 0%, #bd9e56 100%);
    }

    /* 移动端表头去掉列分隔线 */
    .quote-table-header > div {
        border-right: none !important;
    }

    .quote-table-header .symbol-column {
        font-size: 13px;
        text-align: left !important;
        justify-self: start !important;
    }

    .quote-table-header .ask-column,
    .quote-table-header .bid-column {
        text-align: right !important;
        justify-self: end !important;
        padding-right: 4px;
    }

    .quote-table-row {
        grid-template-columns: 1.8fr 1fr 1fr !important;
        min-height: 48px;
        padding: 10px 0;
        align-items: center;
    }

    /* 移动端行内容使用更轻的分隔线 */
    .quote-table-row > div {
        border-right: none !important;
    }

    .quote-table-row .quote-symbol-wrapper {
        justify-self: start !important;
    }

    .quote-table-row .quote-price {
        justify-self: end !important;
        padding-right: 4px;
    }

    /* 调整字体大小 - 基础字体增大1号 */
    .price-value {
        font-size: 15px;
        font-weight: 600;
    }

    .quote-symbol-name {
        font-size: 14px;
        font-weight: 600;
    }

    /* 价格主要部分（包括整数、小数点和前面的位数） */
    .price-main {
        font-size: 15px;
        font-weight: 600;
    }

    /* 价格最后两位 - 放大 (25px)，不加粗 */
    .price-last-two {
        font-size: 25px;
        font-weight: 400;
    }
}
