﻿:root {
    --bg-main: #131722;
    --bg-toolbar: #1c2030;
    --border-color: #2a2e39;
    --text-main: #d1d4dc;
    --text-muted: #848e9c;
    --bg-legend: rgba(19, 23, 34, 0.65);
    --btn-bg: #2a2e39;
    --bg-popup: #1c2030;
    --bg-input: #2a2e39;
    --item-hover: #2a2e39;
    --filter-active: #1e222d;
    --filter-active-text: #2962ff;
}

.light-mode {
    --bg-main: #ffffff;
    --bg-toolbar: #f0f3fa;
    --border-color: #e0e3eb;
    --text-main: #131722;
    --text-muted: #707a8a;
    --bg-legend: rgba(255, 255, 255, 0.75);
    --btn-bg: #e0e3eb;
    --bg-popup: #ffffff;
    --bg-input: #f0f3fa;
    --item-hover: #f0f3fa;
    --filter-active: #e0e3eb;
    --filter-active-text: #2962ff;
}

body, .container {
    margin: 0;
    padding: 0;
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    transition: background-color 0.3s;
}

/* Toolbar */
.chart-toolbar {
    height: 45px;
    background-color: var(--bg-toolbar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 10px;
    box-sizing: border-box;
}

.symbol-trigger-btn {
    background-color: var(--btn-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    outline: none;
    font-size: 14px;
    min-width: 100px;
    text-align: left;
}

.chart-toolbar select, .theme-btn {
    background-color: var(--btn-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    outline: none;
}

    .chart-toolbar select:hover, .symbol-trigger-btn:hover, .theme-btn:hover {
        border-color: #008000;
    }

.theme-btn {
    margin-left: auto;
    font-size: 12px;
}

.footer {
    font-size: 13px;
    padding-left: 10px;
    padding-right: 10px;
    height: 35px;
}
    .footer a {
        color: var(--text-main);
    }

/* Biểu đồ */
#chart-wrapper {
    position: relative;
    width: 100vw;
    height: calc(100vh - 80px);
}

#chart-container {
    width: 100%;
    height: 100%;
}

/* Bảng thông tin thông số (Legend) */
.chart-legend {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
    font-size: 13px;
    user-select: none;
    pointer-events: none;
    background: var(--bg-legend);
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.legend-row-main, .legend-row-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.legend-title {
    font-weight: bold;
    color: var(--text-main);
}

.legend-resolution, .legend-exchange {
    color: var(--text-muted);
    font-size: 12px;
}

.legend-sub-title {
    color: var(--text-muted);
    font-size: 12px;
}

.lbl-val {
    font-family: Helvetica;
    font-weight: 500;
    margin-left: 2px;
    margin-right: 8px;
}

.text-up {
    color: #008000 !important;
}

.text-down {
    color: #ff0000 !important;
}

#loading-status {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(240, 160, 32, 0.85);
    color: #131722;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    display: none;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* --- POPUP SEARCH MODAL --- */
.search-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 50px;
    z-index: 999;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s, visibility 0.2s;
}

    .search-modal-overlay.active {
        visibility: visible;
        opacity: 1;
    }

.search-popup {
    background-color: var(--bg-popup);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 750px;
    max-width: 95%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.popup-title {
    font-size: 18px;
    font-weight: bold;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

    .close-btn:hover {
        color: var(--text-main);
    }

.search-input-wrapper {
    padding: 10px 15px;
}

    .search-input-wrapper input {
        width: 100%;
        background-color: var(--bg-input);
        border: 1px solid var(--border-color);
        border-radius: 4px;
        padding: 12px 15px;
        color: var(--text-main);
        font-size: 14px;
        outline: none;
        box-sizing: border-box;
    }

        .search-input-wrapper input:focus {
            border-color: #2962ff;
        }

.filter-tabs {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
}

.filter-tab {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 15px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

    .filter-tab.active {
        background-color: var(--filter-active);
        color: var(--filter-active-text);
        font-weight: bold;
    }

.results-list {
    overflow-y: auto;
    flex: 1;
    min-height: 250px;
}

.result-item-header {
    display: flex;
    padding: 8px 15px;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    font-weight: bold;
}

.result-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

    .result-item:hover {
        background-color: var(--item-hover);
    }

.col-code {
    width: 100px;
    font-weight: bold;
    color: #2962ff;
}

.col-desc {
    flex: 1;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.col-type {
    width: 80px;
    color: var(--text-muted);
    font-size: 11px;
}

.col-exch {
    width: 100px;
    text-align: right;
    font-weight: 500;
    color: var(--text-main);
}

.no-data, .searching-text {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 14px;
}

@media only screen and (max-width: 900px) {
    .footer {
        height:50px;
    }
    #chart-wrapper {
        height: calc(100vh - 95px);
    }
}

@media only screen and (max-width: 767px) {
    .footer {
        height: 60px;
        font-size:11px;
    }

    #chart-wrapper {
        height: calc(100vh - 100px);
    }
}