/* ========================================
   IO ANALYSIS - LANDING PAGE
   ======================================== */

.tick-icon {
    filter: invert(67%) sepia(12%) saturate(599%) hue-rotate(176deg) brightness(94%) contrast(87%);
    transition: filter 0.2s ease; /* Smooth color swap */
}

.tick:hover .tick-icon {
    /* Converts black to #2B7FFF */
    filter: invert(41%) sepia(82%) saturate(2914%) hue-rotate(204deg) brightness(101%) contrast(106%);
}

/* Chart Control Buttons */
.chart-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.button-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.button-group-label {
    font-family: 'Inter', sans-serif;
    font-size: 10.5px;
    font-weight: 600;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
}

.chart-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 4px;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #64748B;
    background-color: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-btn:hover {
    background-color: #F1F5F9;
    border-color: #CBD5E1;
    color: #1E293B;
}

.chart-btn.active {
    background-color: #1E293B;
    border-color: #1E293B;
    color: white;
}

.chart-btn i {
    font-size: 16px;
}

.chart-btn span {
    line-height: 1;
}

.content-left ul,
.content-right ul {
    background-color: #ffffd8;
    padding: 8px 16px;
    text-align: left;
}

.content-left div,
.content-right div {
    background-color: #ffffd8;
    padding: 2px 4px;
    text-align: left;
    font-size: 0.9rem;
}

.content-left li,
.content-right li {
    font-size: 0.75rem;
    gap: 6px;
    list-style: none;
}

.io-search-container {
    display: flex;
    flex-direction: row;
    gap: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 10px 12px;
    align-items: center;
    width: 100%;
    position: relative;
}

.io-search-container i {
    padding-right: 8px;
    border-right: 1px solid #e2e8f0;
}

.io-search-container input {
    width: 100%;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: #4A5565;
    background-color: white;
    outline: none;
    font-family: "Inter", sans-serif;
}

.io-search-container .io-search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 12px;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    max-height: 350px;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    z-index: 1000;
}

.io-search-container .search-group-header {
    padding: 12px 16px;
    color: #334155;
    font-size: 14px;
    font-weight: 600;
}

.io-search-container .search-result-item,
.io-search-container .no-results {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none;
    color: #334155;
    font-size: 14px;
}

.io-search-container .search-result-item:hover {
    background-color: #f8fafc;
}

.io-search-container .search-result-item:last-child {
    border-bottom: none;
}


/* ========================================
   IO ANALYSIS - DETAIL PAGE
   ======================================== */

:root {
    --tree-line-color: #e2e8f0;
    --active-color: #2563eb;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-light: #f8fafc;
}

/* 1. Main Layout Containers */
.industry-detail-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.industry-info {
    flex: 0 0 auto;
    width: fit-content;
    min-width: 250px;
    max-width: 350px;
    height: fit-content;
    box-sizing: border-box;
    padding: 20px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.08);
    align-self: stretch;
    background: white;
    border-radius: 16px;
    margin: 0 16px 24px 16px;
}

/* 2. Header Section */
.industry-header-container {
    margin-bottom: 20px;
}

.industry-info-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.industry-left {
    display: flex;
    align-items: flex-start; /* Aligns items to the very top */
    gap: 12px;
    flex: 1;
}

.industry-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px; /* Small adjustment to center vertically with the first line of text */
    filter: invert(71%) sepia(10%) saturate(464%) hue-rotate(183deg) brightness(89%) contrast(89%);
}

.industry-description {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2; /* Kept at 1.2 */
    margin: 0;
    font-family: "Inter", sans-serif;
}

.industry-code {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
    padding: 4px 10px;
    background-color: #f1f5f9;
    border-radius: 6px;
    margin-top: 0;
    line-height: 1.2;
    display: flex;
    align-items: center;
    font-family: "Inter", sans-serif;
}

/* 3. Metrics Section */
.metrics-container {
    margin: 24px 0;
}

.metrics-label, .section-label {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 700;
    font-family: "Inter", sans-serif;
}

.metrics-list {
    margin-bottom: 24px;
}

.metric-row {
    display: grid;
    /* Col 1: Label takes remaining space */
    /* Col 2: Value fits its content */
    /* Col 3: Unit has a fixed width to ensure alignment */
    grid-template-columns: 1fr auto 15px;
    align-items: baseline;
    gap: 6px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
}

.metric-row:last-child {
    border-bottom: none;
}

.m-label {
    color: #64748b;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.m-value {
    color: #1e293b;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    text-align: right;
}

.m-unit {
    color: #94a3b8;
    font-weight: 500;
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    text-align: left;
}

/* 4. Hierarchy Tree Section */
.hierarchy-section {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

.hierarchy-tree {
    font-family: 'Inter', sans-serif;
}

.tree-item {
    display: flex;
    align-items: flex-start;
    padding: 6px 0;
    position: relative;
    font-size: 0.95rem;
}


.tree-link,
.tree-item.active {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    text-decoration: none;
    color: inherit;
}

.hover-icon {
    font-size: 0.75rem;
    margin-left: 8px;
    margin-top: 4px;
    color: #2563eb;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.tree-link:hover .name {
    color: #2563eb;
}

.tree-link:hover .hover-icon {
    opacity: 1;
    transform: translate(0, 0);
}

.tree-item .code {
    font-weight: 600;
    color: var(--text-muted);
    min-width: 35px;
    padding: 2px 6px;
    display: inline-block;
    line-height: 1.2;
}

.tree-item .name {
    color: #475569;
}

/* Vertical line for the main group */
.tree-group {
    margin-left: 12px;
    border-left: 1px solid #e2e8f0;
    padding-left: 0; /* Remove padding to keep line straight */
}

/* Vertical line for the sub-leaves */
.leaf-container {
    margin-left: 28px; /* Offset from level 2 line */
    border-left: 1px solid #e2e8f0;
}

/* level-2 horizontal connector */
.level-2 {
    padding-left: 15px; /* Creates space for the elbow */
}
.level-2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 20px; /* Length of horizontal line */
    border-top: 1px solid #e2e8f0;
}

/* level-3 horizontal connector */
.level-3 {
    padding-left: 35px; /* Deeper space for children */
}
.level-3::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 30px; /* Longer horizontal line for visual nesting */
    border-top: 1px solid #e2e8f0;
}

/* Active State */
.tree-item.active {
    color: var(--active-color);
}

.tree-item.active .name {
    font-weight: 700;
    color: var(--active-color);
}

.tree-item.active .code {
    background: #dbeafe;
    color: var(--active-color);
    border-radius: 4px;
}


/* ========================================
   IO ANALYSIS - CHARTS
   ======================================== */

.details-container {

}


.btn-switcher {
    display: flex;
    gap: 8px;
    margin: 0 0 6px;
    padding: 4px;
    justify-content: flex-start;
}

.chart-btn {
    padding: 8px 16px;
    font-family: "Inter", sans-serif;
    font-weight: 400;
    font-size: 14px;
    background-color: #FAFAFA;
    border: 1px solid #E5E7EB;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    color: #6B7280;
    border-radius: 4px;
    white-space: nowrap;
}

.chart-btn:hover {
    background-color: #F3F4F6;
}

.chart-btn.active {
    background-color: #F8F8FF;
    border-color: #2563EB;
    color: #111111;
}

.chart-panels {
    min-height: 420px;
    padding: 16px;
    border: 1px solid #E5E7EB;
    border-radius: 10px;

    background-color: #FFFFFF;

    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.06);

    display: none;
    width: 98%;
    box-sizing: border-box;
    overflow: hidden;
}

.chart-panels.active {
    display: block;
}

.io-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 4px 0 16px 0;
    align-items: start;
}

.outputs-grid,
.inputs-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    grid-template-rows: auto auto;
    gap: 16px;
    padding: 4px 0 16px 0;
    align-items: start;
}

.outputs-grid > #output-treemap-chart,
.inputs-grid > #input-treemap-chart {
    grid-column: 1 / -1;  /* Span full width on second row */
}

.chart-container {
    border: 1px solid #E5E7EB;
    padding: 8px 16px;
}

#output-composition-chart,
#input-composition-chart {
    height: 100%;
}

#output-top-industries-chart,
#input-top-industries-chart {
    width: fit-content;
    max-width: 100%;
    margin-right: 20px;
}

#output-treemap-chart,
#input-treemap-chart {
    width: fit-content;
    max-width: 100%;
    margin-right: 20px;
}

.network-switcher {
    display: inline-flex;
    background-color: #F3F4F6;
    padding: 4px;
    border-radius: 4px;
    gap: 6px;
    margin-left: 4px;
}

.network-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: none;
    background: transparent;
    font-family: "Inter", sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #6B7280;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}


.network-btn:not(.active):hover {
    background-color: rgba(0, 0, 0, 0.05);
}


.network-btn.active {
    background-color: #FFFFFF;
    color: #2563EB;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}


.viz-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    filter: invert(48%) sepia(13%) saturate(545%) hue-rotate(176deg) brightness(94%) contrast(91%);
    transition: filter 0.2s ease;
}


.network-btn.active .viz-icon {
    opacity: 1;
    filter: brightness(0) saturate(100%) invert(39%) sepia(68%) saturate(2839%) hue-rotate(203deg) brightness(101%) contrast(101%);
}


.network-viz {
    display: none;
    width: 100%;
    max-width: 1200px;
    height: fit-content;
    border: 1px solid #e5e7eb;
    margin: 8px 6px;
    padding: 16px;
    border-radius: 4px;
    overflow: hidden;
}


.network-viz.active {
    display: block;
}


#sankey-viz {
    width: 100%;
    max-width: 1200px;
    height: fit-content;
    border: 1px solid #e5e7eb;
    margin: 8px 6px;
    padding: 16px;
    border-radius: 4px;
    overflow: hidden;
}


.chart-footer {
    max-width: 750px;
    width: 100%;
    margin-top: 12px;
    box-sizing: border-box;
    overflow-wrap: break-word;
}