/* ===================================================================
   SCC Group Selector — Scoped Styles
   All classes prefixed scc-cs- to avoid host-page collisions.
   =================================================================== */

/* Modal sizing override — Bootstrap shell, custom interior */
.scc-cs-modal .modal-dialog {
    width: 800px;
    max-width: 95vw;
    margin: 60px auto;
}

.scc-cs-modal .modal-content {
    border: none;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 500px;
    padding: 0;
    font-family: 'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* ===== Header ===== */

.scc-cs-header {
    background: #434c56;
    color: white;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.scc-cs-header h3 {
    font-family: 'Roboto Condensed', 'Lato', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: white;
    margin: 0;
    padding: 0;
}

.scc-cs-close {
    background: none;
    border: none;
    color: #a9b2bc;
    font-size: 20px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.35s ease;
    line-height: 1;
}

.scc-cs-close:hover { color: white; background: rgba(255, 255, 255, 0.1); }

/* ===== Body (sidebar + content) ===== */

.scc-cs-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ===== Sidebar ===== */

.scc-cs-sidebar {
    width: 220px;
    min-width: 150px;
    max-width: 400px;
    border-right: 1px solid #c0ced8;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
}

.scc-cs-resize-handle {
    position: absolute;
    top: 0;
    right: -3px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 5;
}

.scc-cs-resize-handle:hover,
.scc-cs-resize-handle.active {
    background: rgba(50, 129, 208, 0.25);
}

.scc-cs-sidebar-search {
    padding: 8px 10px;
    background: #f2f5f7;
    border-bottom: 2px solid #c0ced8;
    flex-shrink: 0;
}

.scc-cs-filter-heading {
    display: block;
    margin: 0 0 5px 0;
    font-family: 'Roboto Condensed', 'Lato', sans-serif;
    font-weight: 900;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #707f8f;
}

.scc-cs-search-toggle {
    display: flex;
    border: 1px solid #c0ced8;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.scc-cs-stoggle-btn {
    flex: 1;
    padding: 4px 0;
    border: none;
    background: #fff;
    font-family: 'Roboto Condensed', 'Lato', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #707f8f;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scc-cs-stoggle-btn:hover { background: #dfe7ec; color: #2d3339; }

.scc-cs-stoggle-btn.active {
    background: #0f4d8a;
    color: #fff;
}

.scc-cs-sidebar-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #c0ced8;
    border-radius: 4px;
    font-family: 'Lato', sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: #2d3339;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s ease;
}

.scc-cs-sidebar-input:focus { border-color: #3281d0; }

.scc-cs-filter-badge {
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.scc-cs-symbol-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: #e8f0fa;
    border: 1px solid #b8ccd9;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    color: #0f4d8a;
}

.scc-cs-chip-remove {
    background: none;
    border: none;
    color: #0f4d8a;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    padding: 0 1px;
}

.scc-cs-chip-remove:hover { color: #d9534f; }

.scc-cs-chip-count {
    font-size: 11px;
    color: #707f8f;
    font-weight: 400;
}

.scc-cs-badge-text {
    display: inline-block;
    font-family: 'Roboto Condensed', 'Lato', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #0f4d8a;
    background: #e8f0fa;
    padding: 2px 6px;
    border-radius: 3px;
}

.scc-cs-badge-clear {
    border: none;
    background: none;
    font-size: 14px;
    color: #a9b2bc;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

.scc-cs-badge-clear:hover { color: #d9534f; }

.scc-cs-sidebar-tree {
    flex: 1;
    overflow-y: auto;
    padding: 4px 12px 8px 0;
}

.scc-cs-filtered-out { display: none !important; }
.scc-cs-overflow { display: none !important; }

.scc-cs-section { margin-bottom: 10px; }

.scc-cs-section-hdr {
    padding: 6px 8px 5px 8px;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    border-bottom: 1px solid #c0ced8;
    font-family: 'Roboto Condensed', 'Lato', sans-serif;
    font-weight: 900;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #707f8f;
    display: flex;
    align-items: center;
    user-select: none;
    transition: all 0.35s ease;
}

.scc-cs-section[data-section="etf"] .scc-cs-section-hdr { text-transform: none; }
.scc-cs-section-hdr:hover { background: #dfe7ec; }
.scc-cs-section-hdr.active { background: #dfe7ec; color: #2d3339; }

.scc-cs-section-hdr .scc-cs-section-label {
    cursor: pointer;
    flex: 1;
}

.scc-cs-cl-subgroup {
    padding: 4px 8px 2px 28px;
    font-family: 'Roboto Condensed', 'Lato', sans-serif;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #a9b2bc;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.35s ease;
}

.scc-cs-cl-subgroup:hover { background: #dfe7ec; color: #3281d0; }
.scc-cs-cl-subgroup.active { background: #dfe7ec; color: #2d3339; }

.scc-cs-cl-item {
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 400;
    color: #0f4d8a;
    cursor: pointer;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.35s ease;
    display: block;
}

.scc-cs-cl-item:hover { background: #dfe7ec; color: #3281d0; }
.scc-cs-cl-item.active { background: #dfe7ec; color: #3281d0; font-weight: 700; }
.scc-cs-cl-show-all, .scc-cs-section-show-all { font-style: italic; color: #7a8a94; }
.scc-cs-cl-show-all:hover, .scc-cs-section-show-all:hover { color: #3281d0; }

.scc-cs-parent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 10px;
    margin-bottom: 0;
    border-bottom: 2px solid #c0ced8;
    background: #f2f5f7;
    cursor: pointer;
    transition: background 0.2s ease;
}

.scc-cs-parent-header:hover { background: #e8f0fa; }
.scc-cs-parent-header.selected { background: #e8f0fa; }

.scc-cs-parent-select {
    font-size: 14px;
    font-weight: 700;
    color: #0f4d8a;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.scc-cs-parent-select input[type="checkbox"],
.scc-cs-parent-select input[type="radio"] {
    accent-color: #0f4d8a;
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.scc-cs-parent-meta {
    font-size: 11px;
    color: #707f8f;
    white-space: nowrap;
}

.scc-cs-parent-meta .scc-cs-member-count {
    display: inline-block;
    min-width: 4ch;
    text-align: right;
}

.scc-cs-section-hdr .scc-cs-section-chev {
    width: 16px;
    padding: 4px 0;
    margin-right: 4px;
    text-align: center;
    flex-shrink: 0;
    font-size: 9px;
    color: #707f8f;
    transition: transform 0.2s;
    cursor: pointer;
    border-radius: 3px;
}

.scc-cs-section-hdr .scc-cs-section-chev:hover { background: #c0ced8; }

.scc-cs-section-hdr .scc-cs-section-chev.expanded {
    transform: rotate(90deg);
}

.scc-cs-section-body { display: none; }
.scc-cs-section-body.visible { display: block; }

.scc-cs-tree-item {
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 400;
    color: #0f4d8a;
    cursor: pointer;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.35s ease;
    display: block;
}

.scc-cs-tree-item:hover { background: #dfe7ec; color: #3281d0; }
.scc-cs-tree-item.active { background: #dfe7ec; color: #3281d0; font-weight: 700; }

.scc-cs-tree-item::before,
.scc-cs-cl-item::before {
    content: '';
    display: inline-block;
    width: 20px;
}

.scc-cs-tree-branch {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.35s ease;
}

.scc-cs-tree-branch:hover { background: #dfe7ec; }
.scc-cs-tree-branch.active { background: #dfe7ec; }
.scc-cs-tree-branch.active .scc-cs-tree-label { color: #3281d0; font-weight: 700; }

.scc-cs-tree-branch .scc-cs-tree-label {
    flex: 1;
    font-size: 13px;
    font-weight: 400;
    color: #0f4d8a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scc-cs-tree-branch .scc-cs-tree-label:hover { color: #3281d0; }

.scc-cs-tree-branch .scc-cs-tree-label.scc-cs-region-group-label {
    font-family: 'Roboto Condensed', 'Lato', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 11px;
    color: #707f8f;
}

.scc-cs-tree-branch .chev {
    cursor: pointer;
    width: 16px;
    padding: 4px 0;
    margin-right: 4px;
    text-align: center;
    font-size: 9px;
    color: #707f8f;
    transition: transform 0.2s;
    flex-shrink: 0;
    border-radius: 3px;
}

.scc-cs-tree-branch .chev:hover { background: #c0ced8; }
.scc-cs-tree-branch .chev.expanded { transform: rotate(90deg); }

.scc-cs-tree-children { display: none; padding-left: 16px; }
.scc-cs-tree-children.visible { display: block; }

/* ===== Content Area ===== */

.scc-cs-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.scc-cs-home {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 30px;
    color: #5a6672;
    font-size: 14px;
    line-height: 1.6;
}

/* ===== Table ===== */

.scc-cs-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

.scc-cs-table th {
    background: #707f8f;
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Roboto Condensed', 'Lato', sans-serif;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    text-align: left;
    padding: 8px 10px;
}

.scc-cs-table td {
    padding: 7px 10px;
    border-bottom: 1px dotted #c0ced8;
    font-weight: 400;
    color: #2d3339;
    vertical-align: middle;
}

.scc-cs-table th:last-child,
.scc-cs-table td:last-child {
    width: 70px;
    text-align: right;
}

.scc-cs-table tr:nth-child(odd) td { background: #f2f5f7; }
.scc-cs-table tr:hover td { background: #dfe7ec; }
.scc-cs-table tr.selected td { background: #e8f0fa !important; }

.scc-cs-table tr.scc-cs-type-row td,
.scc-cs-table tr.scc-cs-type-row:hover td {
    width: auto;
    padding: 10px 10px 4px;
    background: #fff;
    border-bottom: 1px solid #c0ced8;
    font-family: 'Roboto Condensed', 'Lato', sans-serif;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #707f8f;
    text-align: left;
}


.scc-cs-table .tlink {
    color: #0f4d8a;
    cursor: pointer;
    overflow: hidden;
}

.scc-cs-name-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 32px;
}

.scc-cs-name-cell .scc-cs-region-dropdown { flex-shrink: 0; margin: 0; }

.scc-cs-col-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scc-cs-table .tlink:hover { color: #3281d0; text-decoration: underline; }

.scc-cs-table input[type="checkbox"],
.scc-cs-table input[type="radio"] {
    accent-color: #0f4d8a;
    width: 15px;
    height: 15px;
    cursor: pointer;
    vertical-align: middle;
    margin: 0;
}

/* ===== Footer ===== */

.scc-cs-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    border-top: 1px solid #c0ced8;
    background: #f2f5f7;
    flex-shrink: 0;
    position: relative;
}

.scc-cs-footer-count {
    font-size: 12px;
    font-weight: 700;
    color: #a9b2bc;
    margin-right: auto;
    white-space: nowrap;
}

.scc-cs-footer-count.clickable {
    cursor: pointer;
    color: #0f4d8a;
}

.scc-cs-footer-count.clickable:hover { text-decoration: underline; }

.scc-cs-footer-count.is-single {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scc-cs-footer-count.is-single.has-selection { margin-right: 0; color: #2d3339; }

.scc-cs-footer-clear {
    display: none;
    margin-left: -6px;
    margin-right: auto;
    padding: 0 4px;
    border: none;
    background: none;
    font-size: 18px;
    line-height: 1;
    color: #a9b2bc;
    cursor: pointer;
}

.scc-cs-footer-clear.visible { display: inline-block; }
.scc-cs-footer-clear:hover { color: #3281d0; }

.scc-cs-footer-limit {
    display: none;
    min-width: 0;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
    color: #624f04;
    background: #fff3cd;
    border: 1px solid #ffc400;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scc-cs-footer-limit.visible { display: inline-block; }

/* ===== Selection Popover ===== */

.scc-cs-selection-popover {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 10px;
    right: 10px;
    background: #fff;
    border: 1px solid #c0ced8;
    border-radius: 5px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    margin-bottom: 4px;
}

.scc-cs-selection-popover.visible { display: block; }

.scc-cs-sel-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-bottom: 1px solid #f2f5f7;
    font-size: 13px;
}

.scc-cs-sel-item:last-child { border-bottom: none; }

.scc-cs-sel-name {
    flex: 1;
    color: #2d3339;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scc-cs-sel-cat {
    font-size: 11px;
    color: #707f8f;
    white-space: nowrap;
}

.scc-cs-sel-remove {
    border: none;
    background: none;
    font-size: 16px;
    color: #a9b2bc;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}

.scc-cs-sel-icon { font-size: 11px; color: #707f8f; flex-shrink: 0; }
.scc-cs-sel-remove:hover { color: #d9534f; }

/* ===== Buttons ===== */

.scc-cs-btn {
    padding: 8px 14px;
    border: 2px solid #c0ced8;
    border-radius: 5px;
    background: white;
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #707f8f;
    cursor: pointer;
    transition: all 0.35s ease;
}

.scc-cs-btn:hover { border-color: #707f8f; color: #2d3339; }
.scc-cs-btn.green { background: #2abb67; border-color: #2abb67; color: white; }
.scc-cs-btn.green:hover { background: #26a65b; border-color: #26a65b; }
.scc-cs-btn.green:disabled { background: #a9b2bc; border-color: #a9b2bc; cursor: not-allowed; }

.scc-cs-btn-link {
    background: none;
    border: none;
    color: #0f4d8a;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    padding: 8px 12px;
    transition: all 0.35s ease;
}

.scc-cs-btn-link:hover { color: #3281d0; }

/* ===== Loading / State ===== */

.scc-cs-loading {
    text-align: center;
    padding: 40px 20px;
    color: #707f8f;
    font-size: 14px;
    font-weight: 700;
}

.scc-cs-loading i { margin-right: 6px; }

.scc-cs-empty {
    text-align: center;
    padding: 40px 20px;
    color: #a9b2bc;
    font-size: 14px;
    font-weight: 700;
}

.scc-cs-error {
    text-align: center;
    padding: 30px 20px;
    color: #cc000e;
    font-size: 14px;
    font-weight: 700;
}

/* ===== Trigger Button ===== */

/* ===== Region Dropdown (inline per-row) ===== */

.scc-cs-parent-header .scc-cs-region-dropdown { margin-left: auto; margin-right: 12px; }

.scc-cs-region-dropdown {
    display: inline-block;
    vertical-align: middle;
    min-width: 100px;
    width: auto;
    height: 28px;
    margin: 0 0 0 8px;
    padding: 2px 22px 2px 8px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: #fff url(//d.stockcharts.com/img/menu-icon.png) no-repeat right 5px center;
    background-size: 8px 10px;
    border: 2px solid #c0ced8;
    border-radius: 4px;
    outline: none !important;
    box-shadow: none !important;
    line-height: 1.4;
    font-family: 'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: #707f8f;
}

.scc-cs-region-dropdown:hover { border-color: #707f8f; color: #2d3339; }
.scc-cs-region-dropdown:focus { border-color: #c0ced8; color: #707f8f; }

/* ===== Trigger Button ===== */

.scc-cs-trigger { background-color: #0f4d8a; border-color: #0f4d8a; color: #fff; font-size: 14px; font-weight: bold; border-radius: 5px; transition: all 0.35s ease; }
.scc-cs-trigger:hover, .scc-cs-trigger:focus, .scc-cs-trigger:active, .scc-cs-trigger:active:focus { background-color: #3281d0; border-color: #3281d0; color: #fff; }
.scc-cs-trigger i { margin-right: 4px; }
