:host {
    width: 100%;
    box-sizing: border-box;
}

.collapsed {
    display: none !important;
}

/*
 * thinking animation
 * removing width because is causing layout change issues
 */
@keyframes pulse-border {
    0% {
        border-color: var(--tjp-color, #ff8b44);
        /* border-width: 1px; */
        box-shadow: 0 0 1px #ffcc0020;
        border-style: dotted;
        background-color: #00c8ff06;
    }

    50% {
        /* Using tjp-color as a vibrant "thinking" highlight */
        border-color: var(--tjp-color-contrast, #00c8ff);
        box-shadow: 0 1px 3px ff00d950;
        /* border-width: 1px 2px 1px 1px; */
        border-style: dashed;
        background-color: #d900ff03;
    }

    100% {
        border-color: var(--ibgib-color, #9c1227);
        box-shadow: 0 3px 5px #6200ff90;
        /* border-width: 1px 4px 1px 1px; */
        border-style: dotted;
        background-color: #bbff0010;
    }
}

/* When the component is thinking, its root element gets this class */
:host(.thinking) {
    animation: pulse-border 1.5s infinite;
}

#rabbit-hole-comment-component {
    /* base styles for the component's root div */
    padding-left: 3px;
    margin-left: 3px;
    border-left: 1px solid var(--ibgib-color, #ccc);

    &:hover {
        border: 2px solid var(--ibgib-color);
    }

    button.active {
        --active-color: rgba(199, 17, 235, 0.562);
        box-shadow: inset 1px 3px 4px var(--active-color);
        border-color: var(--active-color);
        border-width: 3px;
        border-style: solid;
    }

    .button-group {
        display: flex;
        flex-direction: row;
        gap: 0px;
        margin: 0px;

        button {
            background-color: var(--button-background-color-base, #f0f0f0);
            color: var(--button-text-color-base, #333);
            border: 1px solid var(--button-border-color-base, #ccc);
            border-radius: 4px;
            padding: 4px 8px;
            cursor: pointer;
            transition: all 0.2s ease-in-out;
        }

        button:hover {
            background-color: var(--button-hover-background-color, #e0e0e0);
            border-color: var(--button-hover-border-color, #bbb);
        }

        button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            background-color: var(--button-disabled-background-color, #e0e0e0);
            border-color: var(--button-disabled-border-color, #d0d0d0);
        }
    }

    #rabbit-hole-comment-header {
        display: flex;
        flex-direction: row;
        align-items: center;
        cursor: pointer;

        #expand-btn {
            width: 1.5em;
            aspect-ratio: 1;
            border-radius: 50%;
            padding: 3px;
            transition: transform 0.2s ease-in-out;
        }

        &.expanded #expand-btn {
            transform: rotate(90deg);
        }

        #comment-text {
            margin: 0 0 0 2px;
            flex-grow: 1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            transition: all 0.2s ease-in-out;
        }

        #command-bar {
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: flex-start;
            gap: 8px;
        }

        &:hover {
            #comment-text {
                text-decoration: underline;
                color: blue;
            }
        }
    }

    #rabbit-hole-comment-content {
        margin-left: 10px;
        border-left: 1px dashed #12d21c45;

        #view-container {
            padding-top: 0.5rem;
            gap: 0.75rem;
            /* space between detail views */
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            align-items: stretch;
            transition: all 0.3s ease-in-out;

            .comment-child {
                display: flex;
                align-items: stretch;
                justify-content: stretch;
            }

            .detail-view {
                border: 1px solid var(--primary-border-color, #ccc);
                border-radius: 5px;
                background-color: var(--secondary-background-color, #f9f9f9);
                padding: 0.5rem;
                display: flex;
                flex-direction: column;
                gap: 0.5rem;

                .detail-view-header {
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    font-weight: bold;
                }

                .detail-view-content {
                    padding-top: 0.5rem;
                    border-top: 1px solid var(--secondary-border-color, #eee);
                    display: flex;
                    flex-direction: column;
                    gap: 2px;

                    p {
                        margin: 0;
                        padding: 0.25rem;
                        background-color: var(--primary-background-color, #fff);
                        border-radius: 3px;
                    }
                }
            }
        }
    }

    #rabbit-hole-comment-footer {
        display: flex;
        justify-content: flex-end;
        padding-top: 5px;
    }

}
