/* Search Page Styles - Modern, immersive design */

/* ==================== Layout ==================== */
.search-page {
    display: flex;
    flex-direction: column;
    /* Fill viewport minus navbar height */
    height: calc(100vh - 56px);
    height: calc(100dvh - 56px);
    /* Dynamic viewport height for mobile */
    overflow: hidden;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.search-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ==================== Header & Search Bar ==================== */
.search-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.search-bar-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.search-bar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.search-bar:focus-within {
    background: white;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-icon {
    color: #94a3b8;
    font-size: 1rem;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: #334155;
    outline: none;
}

.search-input::placeholder {
    color: #94a3b8;
}

.btn-clear {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.btn-clear:hover {
    color: #64748b;
}

/* Filter Chips */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.chip-blue {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.chip-green {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.chip-purple {
    background: #f3e8ff;
    color: #7c3aed;
    border: 1px solid #e9d5ff;
}

.chip-remove {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    margin-left: 0.25rem;
    opacity: 0.7;
}

.chip-remove:hover {
    opacity: 1;
}

/* Entity Toggles */
.entity-toggles {
    display: flex;
    gap: 0.5rem;
    padding-left: 1rem;
    border-left: 1px solid #e2e8f0;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: #64748b;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.toggle-label:hover {
    color: #3b82f6;
}

.toggle-label.active {
    color: #3b82f6;
    background: #eff6ff;
}

.toggle-label input[type="checkbox"] {
    accent-color: #3b82f6;
    margin-right: 0.25rem;
}

/* ==================== Filter Sidebar ==================== */
.filter-sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid #e2e8f0;
    padding: 1rem;
    overflow-y: auto;
    flex-shrink: 0;
}

.filter-section {
    margin-bottom: 1rem;
}

.filter-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.filter-divider {
    border: none;
    border-top: 1px solid #f1f5f9;
    margin: 1rem 0;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.875rem;
    color: #475569;
}

.filter-option:hover {
    background: #f8fafc;
}

.filter-option.selected {
    background: #eff6ff;
    color: #1d4ed8;
}

.filter-option input[type="checkbox"] {
    accent-color: #3b82f6;
}

.option-label {
    flex: 1;
}

.option-count {
    background: #f1f5f9;
    color: #64748b;
    font-size: 0.7rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
}

.category-icon {
    width: 1rem;
    color: #3b82f6;
}

/* ==================== Results Area ==================== */
.results-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.5rem;
    overflow: hidden;
    /* Changed from overflow-y: auto - handle scrolling in results-list */
    min-height: 0;
    /* Important for flex children to allow shrinking */
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1rem;
    flex-shrink: 0;
    /* Prevent header from shrinking */
}

.results-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    margin: 0;
}

.results-sort {
    font-size: 0.75rem;
    color: #94a3b8;
}

.results-sort strong {
    color: #475569;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
    overflow-y: auto;
    /* This is where scrolling happens */
    min-height: 0;
    /* Important for flex children to allow shrinking */
    padding-right: 0.5rem;
    /* Space for scrollbar */
}

/* ==================== Result Cards ==================== */
.result-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.result-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.result-card.selected {
    border-color: #3b82f6;
    border-left-width: 4px;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.result-card.offline {
    opacity: 0.7;
    background: #f8fafc;
}

.card-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-main {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.icon-blue {
    background: #dbeafe;
    color: #2563eb;
}

.icon-orange {
    background: #ffedd5;
    color: #ea580c;
}

.icon-green {
    background: #dcfce7;
    color: #16a34a;
}

.card-info {
    min-width: 0;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 0.25rem 0;
    transition: color 0.2s;
}

.result-card:hover .card-title {
    color: #2563eb;
}

.card-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: #64748b;
    flex-wrap: wrap;
}

.card-breadcrumb .separator {
    font-size: 0.6rem;
    color: #cbd5e1;
}

.layer-id {
    font-weight: 600;
    color: #475569;
}

.card-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
}

.status-badge.online {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.status-badge.offline {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.pulse {
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.btn-add {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.2s;
    padding: 0;
}

.btn-add:hover {
    color: #3b82f6;
    transform: scale(1.1);
}

/* Card Tags */
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.75rem;
}

.tag {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    background: #f1f5f9;
    color: #475569;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.card-description {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0.5rem 0 0 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* ==================== Empty States ==================== */
.no-results,
.welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    color: #64748b;
}

.no-results i,
.welcome-message i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.welcome-message h3 {
    font-size: 1.5rem;
    color: #334155;
    margin-bottom: 0.5rem;
}

.stats-line {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.stats-line span {
    color: #94a3b8;
}

.stats-line strong {
    color: #3b82f6;
    font-size: 1.1rem;
}

/* ==================== Pagination ==================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0;
    margin-top: auto;
}

.page-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #475569;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-numbers {
    display: flex;
    gap: 0.25rem;
}

.page-num {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #475569;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.page-num:hover {
    background: #f8fafc;
}

.page-num.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.page-ellipsis {
    padding: 0 0.5rem;
    color: #94a3b8;
}

/* ==================== Inspector Panel ==================== */
.inspector-panel {
    width: 380px;
    background: white;
    border-left: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.05);
}

.inspector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.inspector-title {
    font-weight: 600;
    color: #475569;
    font-size: 0.9rem;
}

.btn-close-inspector {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0;
    display: flex;
    transition: color 0.2s;
}

.btn-close-inspector:hover {
    color: #ef4444;
}

.inspector-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
}

.inspector-tabs .tab-btn {
    flex: 1;
    padding: 0.75rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.inspector-tabs .tab-btn:hover {
    background: #f8fafc;
}

.inspector-tabs .tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.inspector-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.info-section {
    margin-bottom: 1.25rem;
}

.info-section label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.url-field {
    display: flex;
    gap: 0;
}

.url-field input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-right: none;
    border-radius: 6px 0 0 6px;
    font-size: 0.75rem;
    color: #475569;
    font-family: monospace;
}

.btn-copy {
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0 6px 6px 0;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.info-box {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 6px;
    padding: 0.75rem;
}

.info-label {
    display: block;
    font-size: 0.65rem;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.info-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1e293b;
    font-family: monospace;
}

.capability-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.capability-tag {
    padding: 0.25rem 0.5rem;
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    font-size: 0.75rem;
}

.description-text {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

.inspector-actions {
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
    margin-top: auto;
}

.btn-primary-action {
    width: 100%;
    padding: 0.75rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary-action:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Preview Tab */
.preview-section {
    text-align: center;
}

.extent-info {
    text-align: left;
}

.extent-info label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.extent-values {
    font-family: monospace;
    font-size: 0.85rem;
    color: #475569;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.no-preview {
    padding: 2rem;
    color: #94a3b8;
}

.no-preview i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ==================== Toast Notification ==================== */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideInUp 0.3s ease;
    z-index: 1000;
}

.toast-notification.success {
    background: #22c55e;
    color: white;
}

.toast-notification.error {
    background: #ef4444;
    color: white;
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ==================== Scrollbar ==================== */
.filter-sidebar::-webkit-scrollbar,
.results-list::-webkit-scrollbar,
.inspector-content::-webkit-scrollbar {
    width: 6px;
}

.filter-sidebar::-webkit-scrollbar-track,
.results-list::-webkit-scrollbar-track,
.inspector-content::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.filter-sidebar::-webkit-scrollbar-thumb,
.results-list::-webkit-scrollbar-thumb,
.inspector-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.filter-sidebar::-webkit-scrollbar-thumb:hover,
.results-list::-webkit-scrollbar-thumb:hover,
.inspector-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==================== Expandable Cards & Nested Layers ==================== */
.btn-expand {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.9rem;
    transition: all 0.2s;
    margin-right: 0.25rem;
}

.btn-expand:hover {
    color: #3b82f6;
}

.btn-expand-layers {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.btn-expand-layers:hover {
    color: #f97316;
}

.result-card.expanded {
    border-color: #f97316;
}

/* Nested Layers Container */
.nested-layers {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed #e2e8f0;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }

    to {
        opacity: 1;
        max-height: 500px;
    }
}

.loading-layers {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    color: #64748b;
    font-size: 0.85rem;
}

.nested-layer-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin: 0.25rem 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    transition: all 0.2s;
}

.nested-layer-item:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.nested-layer-item .layer-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #dbeafe;
    color: #2563eb;
    border-radius: 4px;
    font-size: 0.75rem;
}

.nested-layer-item .layer-name {
    flex: 1;
    font-size: 0.85rem;
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nested-layer-item .layer-type {
    font-size: 0.7rem;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
}

.btn-add-small {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-add-small:hover {
    color: #22c55e;
    transform: scale(1.2);
}

.no-layers {
    padding: 0.75rem;
    color: #94a3b8;
    font-size: 0.85rem;
    font-style: italic;
    text-align: center;
}

/* ==================== Responsive ==================== */
@media (max-width: 1200px) {
    .inspector-panel {
        width: 320px;
    }
}

@media (max-width: 992px) {
    .filter-sidebar {
        width: 220px;
    }

    .entity-toggles {
        display: none;
    }
}

@media (max-width: 768px) {
    .filter-sidebar {
        display: none;
    }

    .inspector-panel {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        max-width: 400px;
        z-index: 100;
    }
}