.suggestion-flair {
    --icon-size: var(--icon-s);
}

.mobile-option-setting-item-option-icon {
    --icon-size: var(--icon-l);
}

.cmdr {
    transition: transform 400ms 0s;

    &.status-bar-item {
        margin: 0;
    }
}

.cmdr-removing {
    transform: translateX(100%);
    z-index: 0;
}

.cmdr-ribbon-removing {
    transform: scale(0%);
}

.cmdr-setting-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;

    h1 {
        font-weight: 900;
        margin-top: 6px;
        margin-bottom: 12px;
    }
}

.cmdr-base-component {
    padding: 0px 20px;
    margin-bottom: -18px;
}

.cmdr-menu-more-options {
    color: var(--text-muted);
    position: absolute;
    right: 6px;
    padding-top: 2px;
    transform: scale(0.9);
    transition: all 150ms ease;

    &:hover {
        color: var(--text-primary);
    }
}

.cmdr-mobile .cmdr-credits {
    place-content: center;
}

.cmdr-fill {
    border: 2px solid transparent;
    width: 100%;
}

.cmdr-icon {
    display: flex;
    align-items: center;
    height: 28px;
    color: var(--icon-color);
    opacity: var(--icon-opacity);
}

.cmdr-setting-modal > .modal {
    height: 60vh;
    width: 80vw;
}

.cmdr-editable {
    display: inline-block;

    input {
        padding: 0;
        border: none;
        height: unset;
        background-color: transparent !important;
        border-bottom: 1px solid var(--interactive-accent);
        border-radius: 0;
    }

    &:hover {
        background-color: var(--background-modifier-hover);
    }
}

.cmdr-setting-content {
    height: calc(100% - 10rem);

    .setting-item:first {
        border-top: none;
    }
}

.cmdr-commands-empty {
    display: flex;
    place-items: center;
    flex-flow: column;
    margin: 2.5rem 0 1.25rem 0;

    place-content: center;

    svg {
        width: 100%;
    }

    h3 {
        margin: 8px 0px;
        font-weight: 900;
    }
}

.cmdr-sep-con:not(:empty) {
    background-color: var(--background-primary);
    border: 1px solid var(--background-modifier-border);
    padding: 12px;
    border-radius: 12px;

    .setting-item:first-of-type {
        padding-top: 0;
    }

    .setting-item:last-of-type {
        padding-bottom: 0;
    }

    .cmdr-callout-warning {
        padding: var(--callout-title-padding);
        display: flex;
        gap: var(--size-4-1);
        font-size: var(--callout-title-size);
        color: rgb(var(--callout-color));
        line-height: var(--line-height-tight);
        font-weight: bold;
    }

    p.cmdr-warning-description {
        margin: 8px 0;
    }
}

.cmdr-setting-collapser {
    .cmdr-setting-collapser-content {
        transition: all 0.3s ease-in-out;
        overflow: hidden;

        .setting-item {
            padding-top: 12px;
        }
    }

    .cmdr-setting-collapser-header-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        margin-bottom: 8px;
    }

    .cmdr-setting-collapser-header {
        display: flex;
        cursor: pointer;
        margin: 0;
        flex: 1;

        span {
            font-weight: 600;
            margin-top: 0;
            align-self: end;
        }
    }

    .cmdr-setting-collapser-tools {
        display: flex;
        align-items: center;
        margin-left: 12px;
    }

    &[aria-expanded="false"] .cmdr-setting-collapser-content {
        max-height: 0 !important;
        transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
    }
}

.cmdr-viewer-tools-bottom {
    width: 100%;
    margin-top: 12px;
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;

    button {
        margin: 0 24px;
    }
}

.cmdr-viewer-tools-bar {
    display: flex;
    align-items: center;
}

.cmdr-adder {
    opacity: 0;
    transition: opacity 120ms ease;

    &:hover {
        opacity: 1;
    }

    &.view-action {
        // place adder button to the left of commander-added buttons
        order: -1001;
    }
}

.cmdr-page-header {
    // place commander buttons to the left of view and Obsidian buttons
    order: -1000;
}

.cmdr-macro-builder {
    .modal {
        height: 80vh;
        width: 95vw;
        padding: 0px;
    }

    .modal-close-button {
        z-index: 99;
    }

    .modal-content {
        margin-top: 0px;
    }

    .cmdr-macro-icon {
        display: flex;
        justify-content: center;
    }

    .cmdr-macro-control {
        position: absolute;
        z-index: 5;
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 3em;
        top: 0;

        .cmdr-macro-button {
            background-color: var(--background-secondary-alt);
            aspect-ratio: 1;
            display: flex;
            justify-content: center;
            align-items: center;
            border-radius: 2px;
            outline: 1px solid var(--background-modifier-border);
            padding: 2px;
        }
    }
}

.cmdr-setting-header {
    margin-bottom: 24px;
    overflow-y: hidden;
    overflow-x: auto;

    .cmdr-setting-tab-group {
        display: flex;
        align-items: flex-end;
        border-bottom: 2px solid var(--background-modifier-border);
    }

    &.cmdr-mobile .cmdr-setting-tab-group {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        border: none;

        .cmdr-tab {
            border-left: none !important;
            border-right: none !important;
            border-top: none !important;
            transform: none;
            transition: color 200ms ease;
            width: 100%;
            display: flex;
            font-weight: 500;
            justify-content: space-between;

            &:first-child {
                margin-left: 0px;
            }

            &.cmdr-tab-active {
                transform: none;
            }
        }
    }

    .cmdr-tab {
        padding: 6px 8px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        white-space: nowrap;
        border-left: 2px solid transparent;
        border-right: 2px solid transparent;

        &:first-child {
            margin-left: 6px;
        }

        &.cmdr-tab-active {
            border-bottom: 2px solid var(--background-primary);
            transform: translateY(2px);
            border-radius: 2px;
            border-left: 2px solid var(--background-modifier-border);
            border-top: 2px solid var(--background-modifier-border);
            border-right: 2px solid var(--background-modifier-border);
        }
    }
}

.is-tablet .cmdr-tab {
    border: none !important;
    margin-bottom: 2px;
    padding: 10px;
    font-size: 1.08em;
    display: flex;
    align-items: center;

    .cmdr-block {
        display: flex;
        align-items: center;
    }
}

.cmdr-mobile-modify-grid {
    padding: 22px;

    .cmdr-mobile-modify-option {
        display: flex;
        width: 100%;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 16px;

        > input {
            max-width: 70%;
        }

        .dropdown {
            margin: auto;
        }
    }
}

.cmdr-credits {
    display: flex;

    > span {
        color: var(--text-muted);
        font-size: 14px;
    }
}

.cmdr-about {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 64px;

    hr {
        width: 100%;
        margin-top: 0;
    }

    button {
        display: flex;
        align-items: center;
        height: 2.6em;
        font-weight: 700;
        gap: 16px;
        border-radius: 6px;
        margin-bottom: 8px;

        &:last-of-type {
            margin-bottom: 32px;
        }
    }

    .setting-item {
        button {
            margin: 0;
        }
    }

    .cmdr-icon-wrapper {
        display: flex;

        > svg {
            width: 90px;
            height: 90px;
        }
    }

    .cmdr-version {
        text-decoration: none;
        font-size: 12px;
        color: var(--text-muted);
    }
}

.cmdr-name-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;

    button {
        margin: 8px;
    }
}

.cmdr-icon.mod-warning {
    cursor: default;
    padding: 4px 6px;
}

.cmdr-hider-title {
    display: flex;
    flex-direction: column;
    align-items: center;

    h3 {
        margin-top: 0;
        margin-bottom: 8px;
        font-weight: 900;
    }

    p {
        margin-top: 0;
        margin-bottom: 26px;
        width: 50%;
        text-align: center;
    }
}

.setting-item-control .cmdr-editable {
    width: 2em;
    text-align: center;

    input,
    span {
        width: 2em;
        color: var(--text-normal);
    }
}

.view-action:not(:last-child) {
    margin-right: var(--cmdr-spacing);
}

.titlebar-button:not(:last-child),
.status-bar-item:not(:last-child) {
    margin-right: calc(var(--cmdr-spacing) - 8px);
}

.side-dock-ribbon-action:not(:last-child) {
    margin-bottom: calc(var(--cmdr-spacing) - 8px);
}

.cmdr-cta {
    position: relative;

    &::after {
        content: "";
        position: absolute;
        top: -10%;
        width: 104%;
        left: -2%;
        height: 120%;
        outline: 2px solid var(--color-accent);
        border-radius: 1em;
        pointer-events: none;
    }
}

.cmdr-suggest-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8em;
    max-width: 25em;
    margin: 0 auto;

    .cmdr-suggest-item-icon {
        align-self: center;
        color: var(--icon-color);
        opacity: var(--icon-opacity);
    }

    .cmdr-suggest-content {
        flex: 1 1 auto;
        overflow: hidden;
        text-overflow: ellipsis;
        .cmdr-suggest-item-description {
            font-size: smaller;
            color: dimgray;
        }

        .cmdr-suggest-item-source {
            font-style: italic;
            color: dimgray;
        }
    }

    .cmdr-suggest-group-name {
        flex: 1 1 auto;
        overflow: hidden;
        text-overflow: ellipsis;
        color: var(--text-muted);
        font-weight: bold;
        font-size: small;
    }
}

.cmdr-suggest-item-icon {
    display: flex;
    align-self: center;
    justify-content: center;
}

.cmdr-standalone-menu {
    overflow: scroll;
}

.cmdr-standalone-menu-item {
    margin-left: 6px;
    &:hover {
        background-color: var(--background-modifier-hover);
    }
}

.cmdr-triggers {
    display: flex;
    font-size: var(--font-ui-small);
    padding: 0.5em var(--size-2-3);
    align-items: center;

    .cmdr-trigger-pill {
        display: flex;
        margin-left: 0.75em;

        .cmdr-icon {
            align-self: center;
            padding: 0 0;
        }

        input {
            border: 1px solid var(--background-modifier-border-hover);
            border-radius: var(--radius-s);
            max-width: 6em;
            padding-left: 6px;
            padding-right: 6px;
        }
    }

    .cmdr-trigger-add {
        margin-left: 1em;
        vertical-align: bottom;
    }
}

/* Command viewer styles */
.cmdr-command-viewer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-family: var(--font-interface);
    font-size: var(--font-ui-small);
    color: var(--text-normal);
}

/* Command wrapper */
.cmdr-command-wrapper {
    width: 100%;

    &.is-group {
        font-weight: var(--font-bold);
    }

    /* Setting item */
    .cmdr-setting-item {
        display: flex;
        align-items: center;
        padding: 6px 2px;
        width: 100%;

        > *:first-child {
            margin-inline-end: var(--size-2-3);
        }
    }

    /* Icon */
    .cmdr-icon {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Setting item info */
    .cmdr-item-info {
        overflow: hidden;
        margin: 0 8px;
        max-width: 350px;
        text-align: left;

        .cmdr-item-name {
            font-weight: var(--font-normal);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .cmdr-item-description {
            color: var(--text-muted);
            font-size: var(--font-smaller);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    }

    /* Setting item control */
    .cmdr-item-control {
        flex: 1 1 auto;
        text-align: end;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        gap: var(--size-2-2);
    }

    /* Group collapser button */
    .cmdr-group-collapser-button {
        margin-right: 4px;
        color: var(--text-muted);

        &:hover {
            color: var(--text-normal);
        }
    }
}

/* Group collapser */
.cmdr-group-collapser {
    width: 100%;

    &[aria-expanded="false"] {
        .cmdr-group-collapser-content {
            display: none;
        }
    }
}

/* Group collapser content */
.cmdr-group-collapser-content {
    margin-left: 18px;
    margin-top: 6px;
    margin-bottom: 6px;
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;

    &::before {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: 2px;
        background-color: var(--background-modifier-border);
        border-radius: 1px;
    }

    /* Add highlight on hover to improve visual hierarchy */
    &:hover::before {
        background-color: var(--interactive-accent);
        opacity: 0.5;
    }

    /* Style for child commands to make them visually distinct */
    .cmdr-command-item {
        position: relative;

        /* Highlight connector on hover */
        &:hover::before {
            background-color: var(--interactive-accent);
            opacity: 0.5;
        }
    }
}

/* Sortable styles */
.sortable-fallback {
    opacity: 0.8;
    background-color: var(--background-primary);
    border: 1px solid var(--background-modifier-border);
    border-radius: var(--radius-s);
    box-shadow: var(--shadow-s);
    pointer-events: none;
    z-index: 1000;
}

/* Drag overlay styles */
.cmdr-sortable-drag {
    opacity: 0.8;
    z-index: 999;
}

.cmdr-sortable-ghost {
    opacity: 0.3;
    background-color: var(--background-modifier-hover);
    border: 1px dashed var(--interactive-accent);
    border-radius: var(--radius-s);
}

/* Mobile styles */
.mobile-option-setting-item {
    display: flex;
    align-items: center;
    padding: 8px 0;

    .mobile-option-setting-item-name {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Add Binding Modal Styles */
.cmdr-binding-editor-modal {
    max-width: 100%;
    padding: 0 20px;

    .cmdr-setting-item {
        display: flex;
        flex-direction: column;
        padding: 12px 0;
        border-top: 1px solid var(--background-modifier-border);

        &:first-child {
            border-top: none;
        }
    }

    .cmdr-setting-item-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 8px;
    }

    .cmdr-setting-item-name {
        font-weight: 600;
    }

    .cmdr-icon-preview {
        align-self: center;
        justify-content: center;
        color: var(--icon-color);
        opacity: var(--icon-opacity);
        margin-left: 8px;
    }

    .cmdr-input {
        width: 100%;
        padding: 2px 8px;
        border-radius: 4px;
        border: 1px solid var(--background-modifier-border);
        background-color: var(--background-primary);
    }

    .cmdr-suggest-wrapper {
        position: relative;
        width: 100%;
    }

    .cmdr-suggest-container {
        position: absolute;
        width: 100%;
        max-height: 200px;
        overflow-y: auto;
        border: 1px solid var(--background-modifier-border);
        border-radius: 4px;
        background-color: var(--background-primary);
        z-index: 100;
        margin-top: 4px;
    }

    .cmdr-suggest-item {
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px;
        max-width: 100%;
        margin: 0;

        &:hover {
            background-color: var(--background-modifier-hover);
        }
    }

    .cmdr-suggest-item-title {
        flex: 1;
        font-weight: 500;
    }

    .cmdr-suggest-item-icon {
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .cmdr-empty-state {
        padding: 8px;
        text-align: center;
        color: var(--text-muted);
    }

    .dropdown {
        width: 100%;
        padding: 2px 8px;
        border-radius: 4px;
        border: 1px solid var(--background-modifier-border);
        background-color: var(--background-primary);
    }

    .cmdr-modal-button-container {
        display: flex;
        justify-content: flex-end;
        margin-top: 16px;
        gap: 8px;
    }

    .cmdr-setting-error {
        color: var(--text-error);
        font-size: 12px;
        margin-top: 4px;
        min-height: 16px;

        &:not(.active) {
            display: none;
        }
    }
}

/* Title with tip container */
.cmdr-setting-title-with-tip {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tip text styling */
.cmdr-setting-item-tip {
    font-size: 0.8em;
    color: var(--text-muted);
    font-style: italic;
}

/* SortableCommandTree styles */
.cmdr-sortable-item {
    display: flex;
    align-items: center;
    padding-left: calc(var(--depth, 0) * var(--indentation-width, 20px));
    position: relative;

    &.cmdr-clone {
        cursor: grabbing;
        background-color: var(--background-secondary);
        z-index: 999;

        * {
            cursor: grabbing;
        }
    }

    .cmdr-drag-handle-icon {
        cursor: grab;
        padding: var(--size-2-2) var(--size-2-3);
        height: auto;
        display: flex;
    }

    .cmdr-children-count {
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        background-color: var(--interactive-accent);
        color: var(--text-on-accent);
        border-radius: 4px;
        padding: 2px 6px;
        font-size: 12px;
    }
}

/* Group collapser styles */
.cmdr-group-collapser {
    &[aria-expanded="false"] .cmdr-group-collapser-content {
        display: none;
    }
}

.cmdr-group-collapser-content {
    margin-left: 20px;
    border-left: 1px dashed var(--background-modifier-border);
    padding-left: 10px;
}
