/* ============================================================
   industry-chart-grid.css  v2
   - 4 cột desktop / 2 tablet / 1 mobile
   - Không có cell-header riêng — label overlay trong chart
   ============================================================ */

/* ── Wrapper ─────────────────────────────────────────────── */
.lcni-icg-wrap {
    position: relative;
    width: 100%;
    min-width: 0;         /* prevent flex/grid parent from shrinking this */
    box-sizing: border-box;
}

/* ── Loader ──────────────────────────────────────────────── */
.lcni-icg-loader {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 0;
    font-size: 0.88rem;
    color: var(--lcni-text-muted, #94a3b8);
}
.lcni-icg-loader.hidden { display: none; }

.lcni-icg-spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.12);
    border-top-color: var(--lcni-accent, #3b82f6);
    border-radius: 50%;
    animation: lcni-icg-spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes lcni-icg-spin { to { transform: rotate(360deg); } }

/* ── Error ───────────────────────────────────────────────── */
.lcni-icg-error {
    padding: 10px 14px;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: 6px;
    color: #fca5a5;
    font-size: 0.85rem;
}

/* ── Grid — 4 cột desktop, 2 tablet, 1 mobile ────────────── */
.lcni-icg-grid {
    display: grid;
    gap: 2px;                          /* viền mỏng giống ảnh mẫu */
    grid-template-columns: repeat(4, 1fr);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
@media (max-width: 900px) {
    .lcni-icg-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .lcni-icg-wrap {
        width: 100vw;
        max-width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        padding-left: 0;
        padding-right: 0;
    }
    .lcni-icg-grid {
        grid-template-columns: 1fr;
        gap: 1px;
        width: 100%;
    }
    .lcni-icg-cell {
        width: 100%;
        height: 200px;
    }
}

/* ── Cell ────────────────────────────────────────────────── */
.lcni-icg-cell {
    position: relative;
    height: var(--lcni-icg-cell-h, 200px);
    background: #0d1117;
    overflow: hidden;
    cursor: pointer;
    transition: filter 0.15s;
    display: flex;
    flex-direction: column;
}
.lcni-icg-cell:hover {
    filter: brightness(1.12);
    z-index: 1;
}

/* ── Header cố định (không phủ chart) ───────────────────── */
.lcni-icg-cell-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px 4px;
    flex-shrink: 0;
    background: rgba(13, 17, 23, 0.92);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    min-height: 28px;
    gap: 6px;
}
.lcni-icg-cell-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}
.lcni-icg-cell-name {
    font-size: 0.76rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

/* % phiên gần nhất — inline ngay sau tên ngành */
.lcni-icg-cell-last-inline {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}
.lcni-icg-cell-last-inline.up   { color: #4ade80; }
.lcni-icg-cell-last-inline.down { color: #f87171; }
.lcni-icg-cell-last-inline.flat { color: #94a3b8; }
.lcni-icg-cell-last-arrow {
    font-size: 0.62rem;
    line-height: 1;
}
.lcni-icg-cell-last-pct {
    font-size: 0.72rem;
    letter-spacing: 0.01em;
}

/* % tổng kỳ — bên phải header */
.lcni-icg-cell-pct {
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}
.lcni-icg-cell-pct.up   { color: #4ade80; }
.lcni-icg-cell-pct.down { color: #f87171; }
.lcni-icg-cell-pct.flat { color: #94a3b8; }

/* Chart canvas — chiếm phần còn lại của cell */
.lcni-icg-cell-chart {
    flex: 1;
    min-height: 0;
    position: relative;
}

/* ── Modal overlay ───────────────────────────────────────── */
.lcni-icg-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}
@media (max-width: 600px) {
    .lcni-icg-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    animation: lcni-icg-fadein 0.15s ease;
}
@keyframes lcni-icg-fadein { from { opacity: 0; } to { opacity: 1; } }

.lcni-icg-modal {
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    width: min(1280px, 96vw);
    max-height: 92vh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,0.7);
    animation: lcni-icg-slideup 0.18s ease;
}
@media (max-width: 600px) {
    .lcni-icg-modal {
        width: 100%;
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
        border-bottom: none;
        animation: lcni-icg-slideup-mobile 0.22s ease;
    }
    @keyframes lcni-icg-slideup-mobile {
        from { transform: translateY(60px); opacity: 0; }
        to   { transform: translateY(0);    opacity: 1; }
    }
}
@keyframes lcni-icg-slideup {
    from { transform: translateY(18px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.lcni-icg-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.lcni-icg-modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: #e2e8f0;
}
.lcni-icg-modal-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.12s, background 0.12s;
}
.lcni-icg-modal-close:hover { color: #fff; background: rgba(255,255,255,0.08); }

.lcni-icg-modal-stats {
    display: flex;
    gap: 20px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-wrap: nowrap;
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.lcni-icg-stat { display: flex; flex-direction: column; gap: 2px; }
.lcni-icg-stat-label { font-size: 0.68rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; }
.lcni-icg-stat-value { font-size: 0.92rem; font-weight: 600; color: #e2e8f0; }
.lcni-icg-stat-value.up   { color: #4ade80; }
.lcni-icg-stat-value.down { color: #f87171; }

.lcni-icg-modal-chart { flex: 1; min-height: 400px; padding: 10px 14px 10px 10px; }
.lcni-icg-modal-loader { display: flex; align-items: center; justify-content: center; height: 100%; gap: 10px; color: #64748b; font-size: 0.85rem; }

/* ── Methodology note ────────────────────────────────────── */
.lcni-icg-note {
    margin-top: 10px;
}
.lcni-icg-note-details {
    border: 1px solid #2d3748;
    border-radius: 8px;
    background: #0f172a;
    overflow: hidden;
}
.lcni-icg-note-summary {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px;
    cursor: pointer;
    font-size: 0.78rem;
    color: #94a3b8;
    user-select: none;
    list-style: none;
    background: #0f172a;
    transition: color 0.15s, background 0.15s;
}
.lcni-icg-note-summary::-webkit-details-marker { display: none; }
.lcni-icg-note-summary::marker { display: none; }
.lcni-icg-note-summary:hover { color: #cbd5e1; background: #1e293b; }
.lcni-icg-note-details[open] .lcni-icg-note-summary { color: #cbd5e1; background: #1e293b; border-bottom: 1px solid #2d3748; }
.lcni-icg-note-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 1px solid currentColor;
    font-size: 0.68rem;
    font-style: normal;
    flex-shrink: 0;
    line-height: 1;
}
.lcni-icg-note-body {
    padding: 14px 16px 16px;
    font-size: 0.78rem;
    color: #94a3b8;
    line-height: 1.6;
    background: #0f172a;
}
.lcni-icg-note-body p {
    margin: 0 0 10px;
}
.lcni-icg-note-body strong {
    color: #e2e8f0;
}
.lcni-icg-note-formula {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 10px 14px;
    margin: 0 0 10px;
    font-size: 0.77rem;
    color: #cbd5e1;
    font-family: 'Consolas', 'Menlo', monospace;
}
.lcni-icg-frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    vertical-align: middle;
    line-height: 1.3;
}
.lcni-icg-frac span:first-child {
    border-bottom: 1px solid #64748b;
    padding-bottom: 2px;
    white-space: nowrap;
}
.lcni-icg-frac span:last-child {
    padding-top: 2px;
    white-space: nowrap;
}
.lcni-icg-note-sub {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0 0 10px !important;
}
.lcni-icg-note-example {
    background: #1e293b;
    border-left: 2px solid #3b82f6;
    border-radius: 0 4px 4px 0;
    padding: 8px 12px;
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.7;
}
.lcni-icg-note-eg-title {
    display: block;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 2px;
}
.lcni-icg-note-example strong {
    color: #4ade80;
}

/* ── Note sections & use-cases ───────────────────────────── */
.lcni-icg-note-section {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #1e293b;
}
.lcni-icg-note-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.lcni-icg-note-section-title {
    display: block;
    font-size: 0.76rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}
/* 3-col tips grid */
.lcni-icg-note-grid3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
@media (max-width: 640px) {
    .lcni-icg-note-grid3 { grid-template-columns: 1fr; }
}
.lcni-icg-note-tip {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #1e293b;
    border: 1px solid #2d3748;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.74rem;
    color: #94a3b8;
    line-height: 1.55;
}
.lcni-icg-note-tip strong { color: #e2e8f0; }
.lcni-icg-note-tip-icon {
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1.4;
}
/* Use-cases */
.lcni-icg-note-usecases {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
@media (max-width: 640px) {
    .lcni-icg-note-usecases { grid-template-columns: 1fr; }
}
.lcni-icg-note-uc {
    background: #1e293b;
    border: 1px solid #2d3748;
    border-radius: 6px;
    padding: 9px 11px;
    font-size: 0.74rem;
    color: #94a3b8;
    line-height: 1.55;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.lcni-icg-note-uc strong {
    font-size: 0.76rem;
    color: #e2e8f0;
    font-weight: 600;
}

/* ── Modal two-column body layout ────────────────────────── */
.lcni-icg-modal-body {
    display: grid;
    grid-template-columns: 1fr 320px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
@media (max-width: 900px) {
    .lcni-icg-modal-body {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
    .lcni-icg-modal-chart {
        min-height: 260px;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }
    .lcni-icg-modal-sidebar {
        max-height: none;
        overflow-y: visible;
    }
    .lcni-icg-modal-top-chart {
        height: 180px;
    }
}

.lcni-icg-modal-chart {
    flex: 1;
    min-height: 400px;
    padding: 10px 14px 10px 10px;
    border-right: 1px solid rgba(255,255,255,0.06);
}

/* ── Sidebar: top stocks ─────────────────────────────────── */
.lcni-icg-modal-sidebar {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    overflow-y: auto;
    background: rgba(255,255,255,0.02);
    min-height: 0;
}
.lcni-icg-modal-sidebar-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
    flex-shrink: 0;
}

/* ── Top stocks rows ─────────────────────────────────────── */
.lcni-icg-ts-row {
    display: grid;
    grid-template-columns: 18px 70px 58px 46px 1fr 42px;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 11px;
}
.lcni-icg-ts-row:last-child { border-bottom: none; }

.lcni-icg-ts-rank {
    color: #475569;
    font-size: 10px;
    text-align: right;
}
.lcni-icg-ts-sym {
    font-weight: 700;
    color: #e2e8f0;
    font-size: 12px;
}
.lcni-icg-ts-sym-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.lcni-icg-ts-eye {
    border: 1px solid rgba(148,163,184,0.28);
    background: rgba(15,23,42,0.65);
    color: #94a3b8;
    font-size: 11px;
    line-height: 1;
    border-radius: 999px;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}
.lcni-icg-ts-eye.on {
    color: #e2e8f0;
    border-color: rgba(148,163,184,0.5);
}
.lcni-icg-ts-eye.off {
    color: #64748b;
    opacity: 0.7;
}
.lcni-icg-ts-price {
    color: #94a3b8;
    text-align: right;
    font-size: 11px;
}
.lcni-icg-ts-pct {
    font-weight: 700;
    text-align: right;
    font-size: 11px;
}
.lcni-icg-ts-pct.up   { color: #4ade80; }
.lcni-icg-ts-pct.down { color: #f87171; }
.lcni-icg-ts-pct:not(.up):not(.down) { color: #64748b; }

.lcni-icg-ts-bar-wrap {
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    overflow: hidden;
}
.lcni-icg-ts-bar {
    display: block;
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s;
}
.lcni-icg-ts-bar.up   { background: #22c55e; }
.lcni-icg-ts-bar.down { background: #ef4444; }
.lcni-icg-ts-bar:not(.up):not(.down) { background: #475569; }

.lcni-icg-ts-val {
    color: #475569;
    font-size: 10px;
    text-align: right;
    white-space: nowrap;
}

/* Bar chart ECharts container */
.lcni-icg-modal-top-chart {
    flex-shrink: 0;
    height: 220px;
    margin-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 8px;
}

/* (last-badge styles removed — replaced by lcni-icg-cell-last-inline in header) */
