/* ========================================
   INTEGRATION BROWSER & ENHANCED SEARCH UI
   ======================================== */

/* Integration Browser Modal */
.integration-browser-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.integration-browser-modal.active {
    display: flex;
}

.integration-browser-content {
    background: linear-gradient(135deg, #1e1e2e 0%, #2a2a3e 100%);
    border-radius: 24px;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.integration-browser-header {
    padding: 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.integration-browser-header h2 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.integration-browser-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    transition: all 0.3s ease;
}

.integration-browser-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.integration-browser-search {
    padding: 0 32px 24px;
}

.integration-search-input {
    width: 100%;
    padding: 16px 20px 16px 50px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    color: #fff;
    font-size: 16px;
    transition: all 0.3s ease;
}

.integration-search-input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.08);
}

.integration-search-wrapper {
    position: relative;
}

.integration-search-wrapper i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 18px;
}

.integration-categories {
    padding: 0 32px 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.integration-category-chip {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.integration-category-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.integration-category-chip.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.integration-browser-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 32px 32px;
}

.integration-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.integration-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.integration-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--integration-color, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.integration-card:hover::before {
    transform: scaleX(1);
}

.integration-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.integration-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.integration-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: var(--integration-color, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    color: #fff;
    flex-shrink: 0;
}

.integration-card-title {
    flex: 1;
}

.integration-card-title h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.integration-card-title p {
    margin: 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
}

.integration-card-description {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.integration-card-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.integration-use-case-tag {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.integration-node-type {
    padding: 6px 12px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 8px;
    font-size: 11px;
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.integration-requires-auth {
    padding: 6px 12px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 8px;
    font-size: 11px;
    color: #fff;
    font-weight: 600;
}

/* Tag Filter Chips */
.tag-filter-container {
    margin: 24px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tag-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.tag-filter-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tag-filter-clear {
    background: none;
    border: none;
    color: #667eea;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tag-filter-clear:hover {
    background: rgba(102, 126, 234, 0.1);
}

.tag-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-chip {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tag-chip i {
    font-size: 11px;
}

.tag-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.tag-chip.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.tag-chip.active i {
    animation: pulse 2s infinite;
}

/* App Badges on Templates */
.template-integration-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.integration-badge {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--badge-color, rgba(255, 255, 255, 0.1));
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.integration-badge i {
    font-size: 10px;
}

.integration-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Browse Integrations Button */
.browse-integrations-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.browse-integrations-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.browse-integrations-btn i {
    font-size: 16px;
}

/* Enhanced Search Bar */
.template-search-enhanced {
    position: relative;
    margin-bottom: 24px;
}

.template-search-enhanced input {
    width: 100%;
    padding: 16px 50px 16px 50px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    color: #fff;
    font-size: 16px;
    transition: all 0.3s ease;
}

.template-search-enhanced input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.template-search-enhanced .search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 18px;
    pointer-events: none;
}

.template-search-enhanced .clear-search {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.template-search-enhanced.has-value .clear-search {
    display: flex;
}

.template-search-enhanced .clear-search:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) rotate(90deg);
}

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #2a2a3e;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-suggestions.active {
    display: block;
}

.search-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-suggestion-item:last-child {
    border-bottom: none;
}

.search-suggestion-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.search-suggestion-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--suggestion-color, rgba(255, 255, 255, 0.1));
    color: #fff;
    font-size: 14px;
}

.search-suggestion-content {
    flex: 1;
}

.search-suggestion-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 2px 0;
}

.search-suggestion-type {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
}

/* Active Filters Display */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.active-filters.hidden {
    display: none;
}

.active-filter-chip {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.active-filter-chip .remove-filter {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.active-filter-chip .remove-filter:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .integration-browser-content {
        width: 95%;
        max-height: 95vh;
    }

    .integration-browser-header {
        padding: 20px;
    }

    .integration-browser-header h2 {
        font-size: 22px;
    }

    .integration-browser-search,
    .integration-categories,
    .integration-browser-body {
        padding-left: 20px;
        padding-right: 20px;
    }

    .integration-grid {
        grid-template-columns: 1fr;
    }

    .tag-filter-chips {
        gap: 8px;
    }

    .tag-chip {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Empty State */
.integration-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.5);
}

.integration-empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.integration-empty-state h3 {
    font-size: 20px;
    margin: 0 0 12px 0;
    color: rgba(255, 255, 255, 0.7);
}

.integration-empty-state p {
    font-size: 14px;
    margin: 0;
}