.tools-body {
    position: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100vw;
    min-height: 100vh;
    z-index: 1;
    gap: 20px;
    overflow: auto;

}

.tools-close-btn {
    position: fixed;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    border-radius: 20px;
    cursor: pointer;
    top: 2%;
    z-index: 1;
    -webkit-backdrop-filter: blur(20px);
            backdrop-filter: blur(20px);
    /* Blur effect for a modern look */
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(114, 114, 114, 0.1);
    /* Subtle shadow */
    border: 2px solid rgba(128, 128, 128, 0.144);
}
/* Modal Overlay */
.modal-body {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(12px);
            backdrop-filter: blur(12px);
    background-color: rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    padding: 16px;
    box-sizing: border-box;
}

.modal-body.modal-visible {
    opacity: 1;
    visibility: visible;
    -webkit-backdrop-filter: blur(16px);
            backdrop-filter: blur(16px);
}

/* Modal Wrapper */
.modal-wrapper {
    position: relative;
    width: 100%;
    width: auto;
    max-width: 90vw;
    max-height: 96vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.modal-visible .modal-wrapper {
    transform: scale(1) translateY(0);
}

/* Close Button */
.modal-close-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(128, 128, 128, 0.3);
    cursor: pointer;
    border-radius: 50%;
    margin-bottom: 16px;
    transition: all 0.2s ease;
    -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
    color: inherit;
}

.modal-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(128, 128, 128, 0.5);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-close-btn:active {
    transform: scale(0.95);
}

/* Modal Container */
.modal-cont {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    min-width: 280px;
    max-width: 100%;
    max-height: calc(90vh - 60px);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(128, 128, 128, 0.2);
    border-radius: 24px;
    padding: 32px 24px;
    gap: 24px;
    -webkit-backdrop-filter: blur(20px);
            backdrop-filter: blur(20px);

    /* Smooth scrolling */
    scroll-behavior: smooth;
    scrollbar-width: thin;
}

/* Custom scrollbar for webkit browsers */
.modal-cont::-webkit-scrollbar {
    width: 6px;
}

.modal-cont::-webkit-scrollbar-track {
    background: transparent;
}

.modal-cont::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.3);
    border-radius: 3px;
}

.modal-cont::-webkit-scrollbar-thumb:hover {
    background: rgba(128, 128, 128, 0.5);
}

/* Theme Specific Styles */
html.dark .modal-body {
    background-color: rgba(0, 0, 0, 0.4);
}

html.dark .modal-cont {
    background: linear-gradient(135deg, #1C273B 0%, #191E2B 100%);
    border-color: rgba(255, 255, 255, 0.1);
}

html.dark .modal-close-btn {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

html.dark .modal-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

html.light .modal-body {
    background-color: rgba(255, 255, 255, 0.2);
}

html.light .modal-cont {
    background: linear-gradient(135deg, #D6E2FB 0%, #E3EBFD 100%);
    border-color: rgba(0, 0, 0, 0.1);
}

html.light .modal-close-btn {
    background-color: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.2);
    color: #000000;
}

html.light .modal-close-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.3);
}

/* Responsive Design */

/* Large Desktop */
@media screen and (min-width: 1200px) {
    .modal-cont {
        min-width: 400px;
        padding: 40px 32px;
        gap: 32px;
    }
}

/* Desktop */
@media screen and (min-width: 768px) and (max-width: 1199px) {
    .modal-cont {
        min-width: 350px;
        padding: 36px 28px;
        gap: 28px;
    }
}

/* Tablet */
@media screen and (min-width: 481px) and (max-width: 767px) {
    .modal-body {
        padding: 12px;
    }

    .modal-cont {
        min-width: 300px;
        max-width: 95%;
        padding: 28px 20px;
        gap: 20px;
        border-radius: 20px;
    }

    .modal-close-btn {
        width: 36px;
        height: 36px;
        margin-bottom: 12px;
    }
}

/* Mobile */
@media screen and (max-width: 480px) {
    .modal-body {
        padding: 8px;
        align-items: flex-start;
        padding-top: 60px;
    }

    .modal-wrapper {
        max-height: calc(100vh - 80px);
        width: 100%;
    }

    .modal-cont {
        width: 100%;
        min-width: unset;
        max-width: 100%;
        padding: 20px 16px;
        gap: 16px;
        border-radius: 16px;
        margin: 0;
        max-height: calc(100vh - 140px);
    }

    .modal-close-btn {
        width: 32px;
        height: 32px;
        margin-bottom: 8px;
    }
}

/* Extra Small Mobile */
@media screen and (max-width: 360px) {
    .modal-cont {
        padding: 16px 12px;
        gap: 12px;
        border-radius: 12px;
    }

    .modal-close-btn {
        width: 28px;
        height: 28px;
    }

    .modal-close-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* Height-based responsive adjustments */
@media screen and (max-height: 600px) {
    .modal-body {
        padding: 8px;
    }

    .modal-cont {
        max-height: calc(100vh - 80px);
        padding: 16px 20px;
        gap: 16px;
    }

    .modal-close-btn {
        margin-bottom: 8px;
    }
}

/* Landscape mobile orientation */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .modal-body {
        padding: 4px;
        padding-top: 20px;
    }

    .modal-cont {
        max-height: calc(100vh - 60px);
        padding: 12px 16px;
        gap: 12px;
    }
}

/* Focus and accessibility improvements */
.modal-close-btn:focus {
    outline: 2px solid rgba(59, 130, 246, 0.5);
    outline-offset: 2px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {

    .modal-body,
    .modal-wrapper,
    .modal-close-btn {
        transition: none;
    }

    .modal-body {
        -webkit-backdrop-filter: blur(8px);
                backdrop-filter: blur(8px);
    }

    .modal-body.modal-visible {
        -webkit-backdrop-filter: blur(8px);
                backdrop-filter: blur(8px);
    }
}
.selectmcp-btn-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: left;
    gap: 5px;
    padding: 5px 10px;
    min-width: 90%;
    max-width: 90vw;
    max-height: 80vh;
    min-height: 20vh;
    overflow: hidden;
}

.selectmcp-btn-modal hr {
    width: 98%;
    box-shadow: 0 4px 6px rgba(var(--bg-color1), 114, 0.1);
    border-color: rgba(var(--bg-color1), 0.144);
}

.selectmcp-btn-modal label {
    width: 100%;
    display: flex;
    justify-content: center;
    text-align: left;
    font-weight: 600;
    margin-bottom: 5px;
}

.selectmcp-btn-cont {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 5px;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 5px;
}

.mcp-server-group {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.mcp-checkbox {
    position: relative;
    display: flex;
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.server-checkbox {
    border-radius: 10px;
    font-weight: 500;
}

.server-checkbox:hover {
    background: rgba(94, 129, 173, 0.15);
}

.mcptool-checkbox {
    padding: 5px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-left: 2px solid rgba(94, 129, 173, 0.3);
}

.mcptool-checkbox:hover {
    background: rgba(94, 129, 173, 0.1);
}

.mcp-content {
    position: relative;
    min-height: 50px;
    /* Allows flex items to shrink below content size */
}

.mcp-controls {
    position: relative;
    min-height: 50px;
}

.expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    color: rgba(94, 129, 173, 0.8);
}

.expand-btn:hover {
    background: rgba(94, 129, 173, 0.2);
}

.mcp-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 20px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(94, 129, 173, 0.2);
    border-top: 2px solid rgba(94, 129, 173, 0.8);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.mcp-check {
    position: relative;
    display: block;
    width: 42px;
    height: 20px;
}

.mcp-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.mcptool-name {
    color: rgba(var(--text-color), 0.9);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
    font-size: 12px;
}

.mcp-tools-count {
    font-size: 11px;
    color: rgba(var(--text-color), 0.6);
    font-weight: 400;
}

.tools-dropdown {
    display: flex;
    flex-direction: column;
    justify-content: left;
    gap: 2px;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid rgba(var(--border-color), 0.2);
    animation: slideDown 0.2s ease-out;
    max-height: 20vh;
    overflow-y: scroll;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.selected-tools-summary {
    width: 100%;
    margin-top: 5px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(94, 129, 173, 0.1);
    border: 1px solid rgba(94, 129, 173, 0.2);
    max-height: 50vh;
    overflow-y: scroll;
}

.summary-label {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    color: rgba(var(--text-color), 0.8);
}

.selected-tools-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tool-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(94, 129, 173, 0.2);
    border-radius: 12px;
    font-size: 11px;
    color: rgba(var(--text-color), 0.9);
    max-width: 100%;
    width: auto;
    overflow: hidden;

    span {
        max-width: 95%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

.remove-tool-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
    font-size: 12px;
    color: rgba(var(--text-color), 0.6);
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.add-mcp-btn {
    width: 100%;
    padding: 5px 10px;
    cursor: pointer;
}

.remove-tool-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(var(--text-color), 0.9);
}

/* Scrollbar styling */
.selectmcp-btn-cont::-webkit-scrollbar {
    width: 4px;
}

.selectmcp-btn-cont::-webkit-scrollbar-track {
    background: rgba(var(--bg-color1), 0.1);
    border-radius: 2px;
}

.selectmcp-btn-cont::-webkit-scrollbar-thumb {
    background: rgba(94, 129, 173, 0.3);
    border-radius: 2px;
}

.selectmcp-btn-cont::-webkit-scrollbar-thumb:hover {
    background: rgba(94, 129, 173, 0.5);
}


html.dark .mcptool-checkbox {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: rgba(94, 129, 173, 0.4);
}

html.light .mcptool-checkbox {
    background: rgba(0, 0, 0, 0.05);
    border-left-color: rgba(94, 129, 173, 0.6);
}

html.dark .selected-tools-summary {
    background: rgba(94, 129, 173, 0.15);
    border-color: rgba(94, 129, 173, 0.3);
}

html.light .selected-tools-summary {
    background: rgba(94, 129, 173, 0.1);
    border-color: rgba(94, 129, 173, 0.25);
}

html.dark .tool-tag {
    background: rgba(94, 129, 173, 0.25);
}

html.light .tool-tag {
    background: rgba(94, 129, 173, 0.2);
}

@media screen and (max-width: 500px) {
    .selectmcp-btn-modal {
        min-width: 100%;
    }
}
