/*
 * Reusable countermeasures control-selection styling.
 * Control-selection components render in light DOM and should not depend on RiskManagement.css.
 */

control-selection-panel,
security-domain-browser {
    display: block;
    width: 100%;
}

control-selection-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

control-selection-panel .selector-shell {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    min-height: 0;
}

control-selection-panel .selector-mode-switch {
    display: inline-flex;
    gap: 0;
    padding: 2px;
    border: 1px solid rgba(148, 163, 184, 0.42);
    border-radius: 7px;
    background: #f8fbfd;
}

control-selection-panel .selector-mode-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 28px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #475569;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

control-selection-panel .selector-mode-option:hover {
    background: rgba(2, 140, 186, 0.1);
    color: #0f172a;
}

control-selection-panel .selector-mode-option:focus-visible {
    outline: 2px solid rgba(2, 140, 186, 0.45);
    outline-offset: 1px;
}

control-selection-panel .selector-mode-option.is-active {
    background: #028cba;
    color: #ffffff;
}

control-selection-panel .control-catalogue-type-svg-icon {
    display: block;
    color: #334155;
}

control-selection-panel .control-catalogue-type-svg-icon-control-catalogue {
    width: 21px;
    height: 17px;
}

control-selection-panel .control-catalogue-type-svg-icon-security-domain-model {
    width: 24px;
    height: 16px;
}

control-selection-panel .control-catalogue-type-svg-icon .icon-fill {
    fill: #ffffff;
}

control-selection-panel .control-catalogue-type-svg-icon .icon-stroke {
    fill: none;
    stroke: currentColor;
    stroke-linejoin: round;
}

control-selection-panel .control-catalogue-type-svg-icon-control-catalogue .icon-stroke {
    stroke-linecap: round;
    stroke-width: 1.45;
}

control-selection-panel .control-catalogue-type-svg-icon-security-domain-model .icon-stroke {
    shape-rendering: crispEdges;
    stroke-linecap: square;
    stroke-width: 1;
}

control-selection-panel .selector-mode-option:hover .control-catalogue-type-svg-icon {
    color: #0f172a;
}

control-selection-panel .selector-mode-option.is-active .control-catalogue-type-svg-icon {
    color: #028cba;
}

control-selection-panel .selector-workspace {
    display: grid;
    grid-template-rows: minmax(280px, 1fr) minmax(220px, 0.72fr);
    flex: 1 1 auto;
    gap: 12px;
    height: 100%;
    min-height: 0;
    align-content: stretch;
}

control-selection-panel .workspace-top-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(360px, 0.82fr) minmax(640px, 1.18fr);
    height: 100%;
    min-height: clamp(280px, 36vh, 520px);
    align-items: stretch;
}

control-selection-panel .workspace-top-grid > * {
    height: 100%;
    min-height: 0;
}

control-selection-panel .workspace-top-grid security-domain-browser,
control-selection-panel .workspace-top-grid control-table-panel {
    height: 100%;
    min-height: 0;
}

control-selection-panel .selected-controls-panel {
    align-self: stretch;
    height: 100%;
    min-height: 0;
}

control-selection-panel .selected-controls-panel .data-table-panel-shell {
    border-color: rgba(2, 140, 186, 0.18);
    background: linear-gradient(180deg, #f8fbfd 0%, #ffffff 100%);
}

control-selection-panel .selected-controls-panel .data-table-panel-header,
control-selection-panel .selected-controls-panel .data-table-panel-footer {
    background: #f8fbfd;
}

security-domain-browser .hierarchy-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

security-domain-browser .hierarchy-toggle {
    border: none;
    background: transparent;
    color: #0f172a;
    width: 1.4rem;
    min-width: 1.4rem;
    height: 1.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

security-domain-browser .hierarchy-toggle:hover {
    background: rgba(2, 140, 186, 0.12);
}

security-domain-browser .hierarchy-toggle:focus-visible {
    outline: 2px solid rgba(2, 140, 186, 0.45);
    outline-offset: 1px;
}

security-domain-browser .hierarchy-toggle.placeholder {
    cursor: default;
    color: transparent;
}

security-domain-browser .hierarchy-text {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

security-domain-browser .hierarchy-text-uncategorised {
    color: #64748b;
    font-style: italic;
}

security-domain-browser .hierarchy-name {
    display: block;
    max-width: min(340px, 100%);
}

security-domain-browser .control-catalogue-type-icon.assetTypeIcon span.Uncategorised {
    display: inline-block;
    width: 16px;
    height: 16px;
    padding: 0;
    border: 1px dashed #94a3b8;
    border-radius: 999px;
    background: #f8fafc;
}

security-domain-browser .data-table-grid {
    table-layout: fixed;
}

security-domain-browser .data-table-grid th,
security-domain-browser .data-table-grid td {
    padding-left: 10px;
    padding-right: 10px;
}

@media (max-width: 1100px) {
    control-selection-panel .workspace-top-grid {
        grid-template-columns: 1fr;
    }
}
