/**********************************/
/* Bubble                         */
/**********************************/

.bubble-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    pointer-events: none;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    transition: backdrop-filter .2s ease;
}

.bubble-backdrop--active {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: auto;
}


.bubble {
    width: 100%;
    border: 1px solid var(--primary-color);
    margin: 0;
    overflow: visible;
    box-sizing: border-box;
    position: relative;
    z-index: 50;
}

.bubble__row {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    min-height: 36px;
    padding: 0;
    box-sizing: border-box;
    background: var(--background-color);
    color: var(--primary-color);
}

.bubble__nodes {
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 0;
    flex: 1 1 auto;
}

.bubble__actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    padding: 4px 4px 4px 8px;
    color: inherit;
    box-sizing: border-box;
}

.bubble__actions[hidden] {
    display: none;
}

.bubble__panel {
    position: absolute;
    top: 100%;
    left: -1px;
    right: -1px;
    z-index: 1000;
    background: var(--background-color);
    border: 1px solid var(--primary-color);
    border-top: 1px solid rgba(120, 120, 120, 0.12);
    padding: 10px 12px 12px 12px;
    box-sizing: border-box;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.bubble__panel[hidden] {
    display: none;
}

/**********************************/
/* Bubble header nodes            */
/**********************************/

.bubble-node {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: 360px;
    flex: 0 1 360px;
    margin: 0;
    padding: 4px 34px 4px 8px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.bubble-node[hidden] {
    display: none;
}
.bubble-node--expandable {
    cursor: pointer;
}

.bubble-node--expandable .bubble-button {
    pointer-events: none;
    cursor: inherit;
}

.bubble-node--expandable .bubble-button:hover,
.bubble-node--expandable .bubble-button:active {
    background: transparent;
}

.bubble-node--expandable {
    border-radius: 0px;
    transition: background .15s ease;
}

.bubble-node--expandable:not(.state-disabled):hover {
    background: rgba(120, 120, 120, 0.06);
}

.bubble-node--expandable.state-expanded:not(.state-disabled),
.bubble-node--expandable:not(.state-disabled):active {
    background: rgba(120, 120, 120, 0.18);
}


.bubble-node--expandable::after {
    content: "\f078";
    font-family: "Font Awesome 7 Pro";
    font-weight: 900;
    font-size: 14px;
    line-height: 1;
    position: absolute;
    right: 12px;
    top: 50%;
    color: inherit;
    opacity: 0;
    transform: translateY(calc(-50% - 2px)) scale(.86);
    transition: opacity .16s ease, transform .16s ease;
    pointer-events: none;
}

.bubble-node--expandable:not(.state-disabled):hover::after {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

.bubble-node--expandable.state-expanded:not(.state-disabled)::after {
    opacity: 1;
    transform: translateY(-50%) rotate(180deg) scale(1);
}

.bubble-node__button {
    flex: 0 0 auto;
}

.bubble-node__text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    line-height: 1.3;
    overflow: hidden;
    flex: 1 1 auto;
}

.bubble-node__title {
    font-size: 11px;
    font-weight: 500;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.06em;
}

.bubble-node__sub {
    font-size: 10px;
    color: #9AA0A6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.08em;
}

/**********************************/
/* Bubble buttons                 */
/**********************************/

.bubble-button {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    box-sizing: border-box;
    transition: background .15s ease, color .15s ease, opacity .15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    position: relative;
    font-family: inherit;
    flex: 0 0 auto;
}

.bubble-button::before,
.bubble-button::after {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    line-height: 1;
    transition: opacity .16s ease, transform .16s ease;
}

.bubble-button-icon {
    font-size: 14px;
    line-height: 1;
    display: inline-block;
    opacity: 1;
    transform: scale(1);
    transition: opacity .16s ease, transform .16s ease;
}

.bubble-node .bubble-button-icon {
    font-size: 20px;
}

.bubble-button:hover {
    background: rgba(120,120,120,.12);
}

.bubble-button:active {
    background: rgba(120,120,120,.18);
}

.bubble-button:disabled {
    cursor: default;
    pointer-events: none;
}

.bubble-button--static {
    cursor: default;
    pointer-events: none;
}

.bubble-button--static:hover,
.bubble-button--static:active {
    background: transparent;
}

/**********************************/
/* Bubble toggle button states    */
/**********************************/

.bubble-button--toggle::after {
    content: "\f0d7";
    font-family: "Font Awesome 7 Pro";
    font-weight: 900;
    font-size: 14px;
    opacity: 0;
    transform: translateY(-2px) scale(.86);
}

.bubble-button--toggle:hover::before,
.bubble-button--toggle[aria-expanded="true"]::before {
    opacity: 0;
    transform: translateY(2px) scale(.86);
}

.bubble-button--toggle:hover::after {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.bubble-button--toggle[aria-expanded="true"]::after {
    opacity: 1;
    transform: rotate(180deg) scale(1);
}

/**********************************/
/* Bubble list                    */
/**********************************/

.bubble-list {
    width: 100%;
    padding: 5px 10px;
    border: none;
    background: #fff;
    color: #616D8A;
    cursor: pointer;
    box-sizing: border-box;
    transition: background .15s ease, color .15s ease, opacity .15s ease;
    text-align: left;
    display: grid;
    grid-template-columns: 16px minmax(0,220px) minmax(220px, 1fr) minmax(0, auto);
    column-gap: 8px;
    align-items: center;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 12px;
}

.bubble-list:hover {
    background: #f3f3f3;
}

.bubble-list span {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.bubble-list:disabled {
    cursor: default;
    pointer-events: none;
}

.bubble-button--selected .bubble-select__mark {
    opacity: 1;
}

/**********************************/
/* Bubble select                  */
/**********************************/

.bubble-select__list {
    margin-top: 0;
    overflow: hidden;
    background: #fff;
}

.bubble-select__empty {
    padding: 10px 12px;
    font-size: 12px;
    color: #9AA0A6;
    font-style: italic;
}

.bubble-select__mark {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

/**********************************/
/* Bubble semantic colors         */
/**********************************/

.bubble-status--ok,
.bubble-status--ok * {
    color: #007234;
    font-weight: 500;
}

.bubble-status--fail,
.bubble-status--fail * {
    color: #B9332E;
    font-weight: 500;
}

/**********************************/
/* Universal UI states            */
/**********************************/

.state-disabled {
    color: #bbb !important;
    opacity: .55;
    cursor: default !important;
    pointer-events: none;
}

.state-disabled * {
    color: inherit !important;
}

.state-pending {
    color: #9AA0A6 !important;
}

.state-pending * {
    color: inherit !important;
}

.bubble-button.state-pending .bubble-button-icon,
.state-pending .bubble-button .bubble-button-icon,
.bubble-button.state-pending::after,
.state-pending .bubble-button::after {
    opacity: 0;
}

.bubble-button.state-pending::after,
.state-pending .bubble-button::after {
    content: '';
    width: 14px;
    height: 14px;
    inset: auto;
    border: 2px solid #9AA0A6;
    border-right-color: transparent;
    border-radius: 50%;
    box-sizing: border-box;
    opacity: 1;
    transform: none;
    animation: bubble-spin .65s linear infinite;
}

/**********************************/
/* Animation                      */
/**********************************/

@keyframes bubble-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}