.agent-card {
    display: flex;
    flex-direction: column;
    background-color: var(--gray-850);
    border-radius: 8px;
    border: 1px solid var(--gray-750);
    transition: all 0.3s ease-in-out;
    height: 100%;
    width: 100%;

    &:hover {
        border-color: var(--gray-600);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
        background-color: var(--gray-900);
        border-bottom: 1px solid var(--gray-750);
        height: 60px;
        transition: border-color 0.3s ease;
        border-top-left-radius: 8px;
        border-top-right-radius: 8px;

        .header-left {
            display: flex;
            align-items: center;
            max-width: calc(100% - 145px);

            .role-title {
                font-size: 16px;
                font-weight: 600;
                color: var(--gray-100);
                margin: 0;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                width: 100%;
            }
        }

        .header-icons {
            display: flex;
            align-items: center;
            gap: 8px;

            .icon-container {
                display: flex;
                align-items: center;
                justify-content: center;
                cursor: pointer;
                width: 28px;
                height: 28px;
                border-radius: 8px;
                transition: all 0.2s ease;
                position: relative;

                &.active {
                    .feature-icon {
                        color: var(--gray-200);
                    }
                    .memory-icon,
                    .delegation-icon {
                        opacity: 1;
                    }
                }

                .feature-icon {
                    color: var(--gray-500);
                    transition: color 0.2s ease;
                }

                .memory-icon,
                .delegation-icon,
                .menu-icon {
                    opacity: 0.7;
                }
            }

            .menu-icon-container {
                &:hover {
                    background-color: var(--gray-750);

                    .menu-icon {
                        color: var(--gray-300);
                        opacity: 1;
                    }
                }
            }

            .add-icon-container {
                background-color: rgba(104, 95, 255, 0.1);
                transition: transform 0.2s ease;
                transform-origin: center;

                &:hover {
                    background-color: rgba(104, 95, 255, 0.2);
                    transform: scale(1.05);
                }

                &:active {
                    transform: scale(0.95);
                }

                .plus-icon {
                    color: var(--accent-color);
                    stroke-width: 1.5;
                }
            }

            .remove-icon-container {
                background-color: rgba(128, 128, 128, 0.1);
                transition: transform 0.2s ease;
                transform-origin: center;

                .close-icon {
                    color: #6c757d;
                    stroke-width: 1.5;
                    transition: color 0.2s ease;
                }

                &:hover {
                    background-color: rgba(220, 53, 69, 0.2);
                    transform: scale(1.05);

                    .close-icon {
                        color: var(--red-color, #dc3545);
                    }
                }

                &:active {
                    background-color: rgba(220, 53, 69, 0.3);
                    transform: scale(0.95);

                    .close-icon {
                        color: var(--red-color, #dc3545);
                    }
                }
            }
        }
    }

    .body {
        flex: 1;
        padding: 16px;
        transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
        opacity: 1;
        visibility: visible;

        .section {
            margin-bottom: 16px;

            &:last-child {
                margin-bottom: 0;
            }

            .section-title {
                font-size: 14px;
                font-weight: 600;
                letter-spacing: 0.05em;
                text-transform: uppercase;
                color: var(--gray-400);
                margin: 0;
                margin-bottom: 4px; /* Reduced from 8px to 4px to make spacing smaller */
                height: 20px;
            }

            .section-subtitle {
                font-size: 14px;
                color: var(--gray-400);
                font-style: italic;
                margin: 0;
            }

            .collapsible-content {
                position: relative;
                min-height: 24px;

                .section-content {
                    font-size: 14px;
                    line-height: 1.5;
                    color: var(--gray-200);
                    margin: 0;
                    word-break: break-word;

                    &.truncated {
                        display: -webkit-box;
                        -webkit-line-clamp: 3;
                        line-clamp: 3;
                        -webkit-box-orient: vertical;
                        overflow: hidden;
                        text-overflow: ellipsis;
                    }
                }
            }

            // New styles for the details section
            .section-header {
                display: flex;
                justify-content: space-between;
                align-items: center;
                cursor: pointer;
                user-select: none;
                padding: 4px 6px;
                margin: -4px -6px;
                border-radius: 4px;
                transition: background-color 0.2s ease;

                &:hover {
                    background-color: var(
                        --gray-850,
                        rgba(255, 255, 255, 0.05)
                    );
                }

                .icon {
                    transition: transform 0.3s ease;
                    color: var(--gray-400);

                    &.expanded {
                        transform: rotate(180deg);
                    }
                }
            }

            .details-content {
                overflow: hidden;
                max-height: 0;
                opacity: 0;
                transition: max-height 0.3s ease, opacity 0.3s ease,
                    margin-top 0.3s ease;

                &.expanded {
                    max-height: 800px;
                    opacity: 1;
                    margin-top: 8px; /* Reduced from 12px to 8px */
                }
            }

            .details-subsection {
                margin-bottom: 16px;

                &:last-child {
                    margin-bottom: 8px;
                }

                .subsection-title {
                    font-size: 12px;
                    font-weight: 600;
                    color: var(--gray-400);
                    margin: 0 0 8px 0;
                    text-transform: uppercase;
                    /* Added hover styles for subsection title */
                    padding: 2px 4px;
                    margin: -2px -4px 6px -4px;
                    border-radius: 3px;
                    transition: background-color 0.2s ease;
                    display: flex;
                    align-items: center;
                    gap: 8px;

                    &:hover {
                        background-color: var(
                            --gray-850,
                            rgba(255, 255, 255, 0.05)
                        );
                    }

                    .tool-count {
                        font-size: 10px;
                        color: var(--gray-500);
                        font-weight: 400;
                        text-transform: none;
                    }
                }
            }
        }

        .toggle-button {
            background: none;
            border: none;
            color: var(--accent-color);
            cursor: pointer;
            font-size: 12px;
            padding: 2px 0;
            margin-top: 4px;
            display: block;
            text-align: left;
            height: 20px;

            &:hover {
                text-decoration: underline;
            }

            &.tools-toggle,
            &.tags-toggle {
                margin-top: 8px;
                font-size: 13px;
            }
        }

        .model-name {
            font-size: 14px;
            font-weight: 500;
            color: var(--gray-100);
            margin: 0;
        }

        .model-custom-name {
            font-size: 12px;
            color: var(--gray-400);
            margin: 4px 0 0;
        }

        .model-info-container {
            display: flex;
            align-items: center;
            gap: 0.75rem;

            .provider-icon {
                flex-shrink: 0;
            }

            .model-info {
                display: flex;
                flex-direction: column;

                .model-name {
                    font-weight: 500;
                    color: var(--gray-100);
                    font-size: 0.9rem;
                    margin: 0;
                }

                .model-custom-name {
                    color: var(--gray-400);
                    font-size: 0.8rem;
                    margin-top: 0.15rem;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                }
            }
        }

        .tools-container {
            display: flex;
            flex-direction: column;
            margin-top: 4px;

            .tool-item {
                display: flex;
                align-items: center;
                gap: 8px;
                padding: 4px 0;
                height: 28px;
                position: relative;

                app-icon {
                    color: var(--gray-400);
                    flex-shrink: 0;

                    &.tool-config {
                        color: var(--green-400);
                    }
                }

                .python-icon {
                    color: var(--blue-400);
                    font-size: 16px;
                    flex-shrink: 0;
                }

                .tool-name {
                    font-size: 14px;
                    color: var(--gray-200);
                    flex: 1;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                    min-width: 0;
                }
            }
        }
    }
}

:host([size="small"]) {
    .agent-card {
        transition: height 0.3s ease-in-out;

        .header {
            border-bottom-color: transparent;
            border-radius: 12px;
            .header-left {
                gap: 16px;
                max-width: calc(100% - 70px);
            }
        }

        .body {
            max-height: 0;
            opacity: 0;
            padding: 0 16px;
            visibility: hidden;
            transition: max-height 0.3s ease, opacity 0.2s ease,
                padding 0.3s ease, visibility 0s 0.3s;
        }
    }
}

:host([size="medium"]) {
    .agent-card {
        transition: height 0.3s ease-in-out;

        .header {
            .header-left {
                gap: 16px;
                max-width: calc(100% - 70px);
            }
        }
    }
}

:host([size="large"]) {
    .agent-card {
        transition: height 0.3s ease-in-out;

        .header {
            .header-left {
                gap: 16px;

                max-width: calc(100% - 170px);
            }
        }
    }
}
