/* Tối ưu CSS dùng chung cho các bảng dữ liệu (Tỷ giá, Giá vàng, Lãi suất, Chỉ số) */
.clean-data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    margin-bottom: 0.5rem;
}

.clean-data-table th,
.clean-data-table td {
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    background: #fff;
    vertical-align: middle;
}

.clean-data-table th {
    color: #000080;
    font-weight: 700;
    font-size: 15px;
    text-align: left;
}

.clean-data-table td {
    font-size: 14px;
    color: #1f2937;
}

.clean-data-table tbody tr:hover td {
    background-color: #f1f5f9;
}

/* Các class tiện ích cho cột trong bảng */
.clean-data-table th.text-center,
.clean-data-table td.text-center {
    text-align: center;
}

.clean-data-table th.text-right,
.clean-data-table td.text-right {
    text-align: right;
}

.clean-data-table td.font-bold {
    font-weight: 700;
}

.clean-data-table td.text-navy {
    color: #000080;
}

.clean-data-table td.text-green {
    color: #16a34a;
}

.clean-data-table td.text-red {
    color: #dc2626;
}

/* Container cuộn ngang cho bảng */
.table-responsive-scroll {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

/* Tiện ích cho box Cờ / Icon kết hợp text */
.icon-text-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-text-box img {
    width: 24px;
    height: auto;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.icon-text-box .text-primary-bold {
    font-weight: 700;
    color: #2563eb;
    font-size: 15px;
}

/* Dành cho ô Tìm kiếm ở các trang Công cụ */
.tools-search-input {
    padding: 8px 32px 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background-color: #ffffff;
    color: #1e293b;
    outline: none;
    font-size: 15px;
    width: 240px;
    max-width: 100%;
    transition: all 0.2s ease;
}

.tools-search-input:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.search-wrapper {
    position: relative;
    display: inline-block;
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #94a3b8;
    font-size: 18px;
    font-weight: 600;
    display: none;
    user-select: none;
    line-height: 1;
}

.search-clear-btn:hover {
    color: #64748b;
}

/* Rounded wrapper for tables (Gold, Exchange, Interest Rates) */
.rounded-table-wrapper {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}
.rounded-table-wrapper table {
    border-style: hidden;
    margin-bottom: 0 !important;
}
.rounded-table-wrapper table th:first-child,
.rounded-table-wrapper table td:first-child { border-left: none !important; }
.rounded-table-wrapper table th:last-child,
.rounded-table-wrapper table td:last-child { border-right: none !important; }
.rounded-table-wrapper table tr:first-child th { border-top: none !important; }
.rounded-table-wrapper table tr:last-child td { border-bottom: none !important; }

/* Premium Table - Dùng chung cho Home, Cổ phiếu, Chỉ số */
.premium-table {
    border-collapse: collapse !important;
    width: 100% !important;
    background: #ffffff;
}
.premium-table th {
    background-color: #f9fafb !important;
    color: #6b7280 !important;
    font-size: 12px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    font-weight: 600 !important;
    padding: 14px 16px !important;
    border-bottom: 1px solid #e5e7eb !important;
    text-align: left;
}
.premium-table th a {
    color: inherit !important;
    text-decoration: none !important;
    transition: color 0.15s ease !important;
}
.premium-table th a:hover {
    color: var(--color-link, #2563eb) !important;
}
.premium-table td {
    padding: 16px !important;
    border-bottom: 1px solid #f3f4f6 !important;
    vertical-align: middle;
    transition: background-color 0.2s ease !important;
}
.premium-table tr.clickable-row {
    cursor: pointer !important;
}
.premium-table tr.clickable-row:hover td {
    background-color: #f9fafb !important;
}

/* Căn phải cho table cell */
.premium-table .align-right {
    text-align: right;
}

/* Indices Panel */
.indices-table-panel {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    overflow: hidden;
}
.indices-table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}
.indices-table-head p {
    margin: 0 0 .2rem;
    color: var(--color-link, #2563eb);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.indices-table-head h2 {
    margin: 0;
    color: #111827;
    font-size: 1.35rem;
    font-weight: 700;
}
.indices-table-head span {
    color: #64748b;
    font-weight: 600;
}
.indices-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.indices-table__name {
    min-width: 210px;
    position: sticky;
    left: 0;
    z-index: 2;
    background: #ffffff;
}
.premium-table thead .indices-table__name {
    z-index: 3;
    background-color: #f9fafb !important;
}

/* Indices Specific Cells */
.index-name {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: #111827;
    text-decoration: none;
}
.index-name__flag {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fee2e2;
    color: #dc2626;
    font-size: .75rem;
    font-weight: 700;
}
.index-name strong,
.index-name em {
    display: block;
    font-style: normal;
}
.index-name strong {
    color: #111827;
    font-weight: 700;
    font-size: 14px;
}
.index-name em {
    margin-top: .15rem;
    color: #64748b;
    font-weight: 600;
    font-size: 12px;
}
.index-price {
    color: #111827;
    font-weight: 700;
    font-size: 14px;
}
.index-change {
    font-weight: 600;
    font-size: 13px;
}
.is-positive {
    color: #16a34a !important;
}
.is-negative {
    color: #dc2626 !important;
}
.is-neutral {
    color: #64748b !important;
}
.index-spark {
    width: 128px;
    display: flex;
    align-items: center;
    gap: .55rem;
}
.index-spark svg {
    width: 74px;
    height: 34px;
    overflow: visible;
}
.index-spark polyline {
    fill: none;
    stroke: currentColor;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.index-spark span {
    font-weight: 700;
}
.indices-empty {
    text-align: center;
    color: #64748b;
    padding: 3rem 1rem;
}