/* =============================================================================
   SEARCH LAYOUT & NAVIGATION
   Layout, pagination, filters, and search interface components
   ============================================================================= */

/* =============================================================================
   SEARCH FILTER TABS (Google-style)
   ============================================================================= */

.search-filter-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 24px;
    padding: 0 4px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    box-sizing: border-box;
}

.filter-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s ease;
    position: relative;
    white-space: nowrap;
}

.filter-tab.active {
    color: #ffffff;
    background: rgba(73,0,194,0.2);
    border-bottom: 2px solid #4900c2;
}

.filter-tab:hover:not(.active) {
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.05);
}

.filter-tab i {
    font-size: 14px;
    opacity: 0.8;
}

.filter-tab.active i {
    opacity: 1;
    color: #4900c2;
}

.tab-divider {
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.15);
    margin: 0 8px;
}

.more-filters {
    color: rgba(255,255,255,0.6);
    padding: 12px 16px;
    font-size: 14px;
}

/* =============================================================================
   SEARCH MAIN LAYOUT
   ============================================================================= */

.search-main-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 20px;
    height: fit-content;
}

/* =============================================================================
   SEARCH STATISTICS & INFO
   ============================================================================= */

.search-stats {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 16px;
}

/* =============================================================================
   QUICK FILTERS STYLING
   ============================================================================= */

.search-filters {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
}

.filter-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    margin-bottom: 16px;
}

.filter-title i {
    color: #4900c2;
    font-size: 16px;
}

.filter-chips {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.chip:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
    transform: translateY(-1px);
}

.chip.active {
    background: linear-gradient(135deg, #4900c2, #6a1b9a);
    border-color: #4900c2;
    color: white;
    box-shadow: 0 4px 12px rgba(73, 0, 194, 0.3);
}

.chip i {
    font-size: 14px;
    opacity: 0.8;
}

.chip.active i {
    opacity: 1;
}
    margin-bottom: 20px;
}

.stats-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #ffffff;
    margin-bottom: 12px;
}

.stats-title i {
    color: #4900c2;
    font-size: 16px;
}

.stats-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stats-info span {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-time {
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Open Sans', sans-serif;
}

/* =============================================================================
   BUSINESS PROFILE SIDEBAR
   ============================================================================= */

.business-profile {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

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

.business-icon {
    width: 48px;
    height: 48px;
    background: rgba(73,0,194,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4900c2;
    font-size: 20px;
}

.business-info {
    flex: 1;
}

.business-name {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 4px;
}

.business-rating {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stars {
    color: #ffd700;
    font-size: 14px;
}

.rating-text {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
}

.business-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(255,255,255,0.7);
}

.detail-item i {
    color: #4900c2;
    width: 14px;
    text-align: center;
}

/* =============================================================================
   SEARCH STATUS INDICATORS
   ============================================================================= */

.search-status {
    margin-top: 16px;
    text-align: center;
    overflow: visible;
    /* Room for selected / searching badge glows so they are not squared off. */
    padding: 14px 16px 18px;
    box-sizing: border-box;
    /* No backdrop-filter: it forces Chromium to clip box-shadow / halos. */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.search-status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    margin-bottom: 12px;
}

.search-status-indicator i {
    color: #4900c2;
    /* Soft idle cue only. A hard opacity blink read as strip strobing. */
    animation: none;
    opacity: 0.9;
}

.search-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    position: relative;
    max-width: 100%;
    /* overflow-x:auto + overflow-y:visible computes to clip both axes, which
       squared off the badge glow as it grew. Keep visible and wrap on narrow
       widths instead of a clipped horizontal scroller. */
    overflow: visible;
    padding: 16px 12px 18px;
    margin: 0;
    box-sizing: border-box;
}

.search-sources .source-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    z-index: 1;
    height: 28px;
    min-height: 28px;
    max-height: 28px;
    box-sizing: border-box;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
}

.search-sources .source-badge.deselected {
    opacity: 0.35;
    filter: grayscale(0.55);
    box-shadow: none !important;
}

.search-sources .source-badge.selected:not(.success):not(.failed):not(.searching) {
    opacity: 1;
    filter: none;
}

/* Static brand glow for selected engines (idle home). Growing animated shadows
   were clipped by the Engines card and read as strobing on wide displays. */
.search-sources .source-badge.selected.google:not(.deselected):not(.searching):not(.failed) {
    box-shadow: 0 0 0 1px rgba(66, 133, 244, 0.35), 0 0 14px rgba(66, 133, 244, 0.55);
}
.search-sources .source-badge.selected.duckduckgo:not(.deselected):not(.searching):not(.failed) {
    box-shadow: 0 0 0 1px rgba(222, 88, 51, 0.35), 0 0 14px rgba(222, 88, 51, 0.55);
}
.search-sources .source-badge.selected.searxng:not(.deselected):not(.searching):not(.failed) {
    box-shadow: 0 0 0 1px rgba(51, 122, 183, 0.35), 0 0 14px rgba(51, 122, 183, 0.45);
}
.search-sources .source-badge.selected.yacy:not(.deselected):not(.searching):not(.failed) {
    box-shadow: 0 0 0 1px rgba(40, 167, 69, 0.35), 0 0 14px rgba(40, 167, 69, 0.45);
}
.search-sources .source-badge.selected.scrapers:not(.deselected):not(.searching):not(.failed) {
    box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.35), 0 0 14px rgba(123, 92, 255, 0.5);
}

.search-sources .source-badge img,
.search-sources .source-badge-icon {
    width: 14px;
    height: 14px;
    min-width: 14px;
    min-height: 14px;
    max-width: 14px;
    max-height: 14px;
    object-fit: contain;
    background: transparent;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    display: block;
    flex-shrink: 0;
}

.search-sources .source-badge.google {
    background: rgba(66,133,244,0.2);
    color: #4285f4;
    border: 1px solid rgba(66,133,244,0.3);
}

.search-sources .source-badge.duckduckgo {
    background: rgba(222,88,51,0.2);
    color: #de5833;
    border: 1px solid rgba(222,88,51,0.3);
}

.search-sources .source-badge.searxng {
    background: rgba(51,122,183,0.2);
    color: #337ab7;
    border: 1px solid rgba(51,122,183,0.3);
}

.search-sources .source-badge.yacy {
    background: rgba(40,167,69,0.2);
    color: #28a745;
    border: 1px solid rgba(40,167,69,0.3);
}

.search-sources .source-badge.scrapers {
    background: rgba(73, 0, 194, 0.22);
    color: #7b5cff;
    border: 1px solid rgba(73, 0, 194, 0.4);
}

.search-sources .source-badge:hover {
    transform: none;
    filter: brightness(1.12);
}

.search-sources .source-badge.deselected:hover {
    filter: grayscale(0.35) brightness(1.08);
}

/* Source badge status indicators */
.search-sources .source-badge.searching {
    animation: badge-glow-breathe 1.8s ease-in-out infinite;
    position: relative;
    z-index: 2;
    /* Shadow on the badge itself (not a z-index:-1 ::after). A negative-z halo
       painted under the Engines card fill and looked hard-clipped at the top. */
    box-shadow:
        0 0 0 1px rgba(139, 92, 246, 0.5),
        0 0 10px rgba(139, 92, 246, 0.55),
        0 0 22px rgba(139, 92, 246, 0.4);
}

.search-sources .source-badge.searching::after {
    content: none;
    display: none;
}

.search-sources .source-badge.success {
    background: rgba(16,185,129,0.3) !important;
    color: #10b981 !important;
    border-color: rgba(16,185,129,0.5) !important;
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.35), 0 0 10px rgba(16, 185, 129, 0.4);
}

.search-sources .source-badge.failed {
    background: rgba(239,68,68,0.3) !important;
    color: #ef4444 !important;
    border-color: rgba(239,68,68,0.5) !important;
    opacity: 1;
    pointer-events: auto !important;
    cursor: pointer !important;
}

.search-sources .source-badge.selected {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.search-sources .source-badge.deselected {
    pointer-events: auto !important;
    cursor: pointer !important;
}

@keyframes badge-glow-breathe {
    0%, 100% {
        box-shadow:
            0 0 0 1px rgba(139, 92, 246, 0.4),
            0 0 8px rgba(139, 92, 246, 0.4),
            0 0 16px rgba(139, 92, 246, 0.28);
    }
    50% {
        box-shadow:
            0 0 0 1px rgba(139, 92, 246, 0.55),
            0 0 14px rgba(139, 92, 246, 0.65),
            0 0 28px rgba(139, 92, 246, 0.45);
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(139, 92, 246, 0.3);
        filter: brightness(1);
    }
    50% {
        box-shadow: 0 0 15px rgba(139, 92, 246, 0.6);
        filter: brightness(1.15);
    }
}

/* =============================================================================
   PAGINATION CONTROLS
   ============================================================================= */

.pagination-controls {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.pagination-info {
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    text-align: center;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.page-btn {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.page-btn:hover {
    background: rgba(73,0,194,0.2);
    border-color: rgba(73,0,194,0.5);
    color: #ffffff;
    transform: translateY(-2px);
}

.page-btn:active {
    transform: translateY(0);
}

.page-btn.active {
    background: rgba(73,0,194,0.8);
    border-color: rgba(73,0,194,1);
    color: #ffffff;
}

.load-more-btn {
    background: linear-gradient(135deg, #4900c2 0%, #6a1b9a 100%);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(73,0,194,0.3);
}

.load-more-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(73,0,194,0.4);
}

.load-more-btn:active {
    transform: translateY(0) scale(1);
}

.load-more-btn i {
    font-size: 12px;
}

/* =============================================================================
   SEARCH LOADER ANIMATION
   ============================================================================= */

.search-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 60px 20px;
    text-align: center;
}

.search-loader-text {
    color: rgba(255,255,255,0.8);
    font-size: 16px;
    font-weight: 500;
}

.dank-ass-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dank-ass-loader .row {
    display: flex;
}

.arrow {
    width: 0; 
    height: 0;
    margin: 0 -6px; /* -$size / 2 where $size is 12px */
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 21.6px solid #8b5cf6; /* $size * 1.8 = 12px * 1.8 = 21.6px */
    animation: blink 1s infinite;
    filter: drop-shadow(0 0 18px #8b5cf6); /* $size * 1.5 = 12px * 1.5 = 18px */
}

.arrow.down {
    transform: rotate(180deg);
}

/* Outer arrow delays - EXACT formula from your code: -($time / 18) * $i where $time = 1 */
.arrow.outer-1 { animation-delay: -0.0556s; }  /* -(1/18) * 1 */
.arrow.outer-2 { animation-delay: -0.1111s; }  /* -(1/18) * 2 */
.arrow.outer-3 { animation-delay: -0.1667s; }  /* -(1/18) * 3 */
.arrow.outer-4 { animation-delay: -0.2222s; }  /* -(1/18) * 4 */
.arrow.outer-5 { animation-delay: -0.2778s; }  /* -(1/18) * 5 */
.arrow.outer-6 { animation-delay: -0.3333s; }  /* -(1/18) * 6 */
.arrow.outer-7 { animation-delay: -0.3889s; }  /* -(1/18) * 7 */
.arrow.outer-8 { animation-delay: -0.4444s; }  /* -(1/18) * 8 */
.arrow.outer-9 { animation-delay: -0.5s; }     /* -(1/18) * 9 */
.arrow.outer-10 { animation-delay: -0.5556s; } /* -(1/18) * 10 */
.arrow.outer-11 { animation-delay: -0.6111s; } /* -(1/18) * 11 */
.arrow.outer-12 { animation-delay: -0.6667s; } /* -(1/18) * 12 */
.arrow.outer-13 { animation-delay: -0.7222s; } /* -(1/18) * 13 */
.arrow.outer-14 { animation-delay: -0.7778s; } /* -(1/18) * 14 */
.arrow.outer-15 { animation-delay: -0.8333s; } /* -(1/18) * 15 */
.arrow.outer-16 { animation-delay: -0.8889s; } /* -(1/18) * 16 */
.arrow.outer-17 { animation-delay: -0.9444s; } /* -(1/18) * 17 */
.arrow.outer-18 { animation-delay: -1s; }      /* -(1/18) * 18 */

/* Inner arrow delays - EXACT formula from your code: -($time / 6) * $i where $time = 1 */
.arrow.inner-1 { animation-delay: -0.1667s; }  /* -(1/6) * 1 */
.arrow.inner-2 { animation-delay: -0.3333s; }  /* -(1/6) * 2 */
.arrow.inner-3 { animation-delay: -0.5s; }     /* -(1/6) * 3 */
.arrow.inner-4 { animation-delay: -0.6667s; }  /* -(1/6) * 4 */
.arrow.inner-5 { animation-delay: -0.8333s; }  /* -(1/6) * 5 */
.arrow.inner-6 { animation-delay: -1s; }       /* -(1/6) * 6 */

@keyframes blink {
    0% { opacity: 0.1; }
    30% { opacity: 1; }
    100% { opacity: 0.1; }
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 1200px) {
    .search-main-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .side-panel {
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .search-filter-tabs {
        flex-wrap: wrap;
        gap: 4px;
        border-bottom: none;
        padding: 8px 0;
    }
    
    .filter-tab {
        padding: 8px 12px;
        font-size: 13px;
        border-radius: 20px;
        border: 1px solid rgba(255,255,255,0.15);
    }
    
    .filter-tab.active {
        border-bottom: none;
        border-color: #4900c2;
    }
    
    .tab-divider {
        display: none;
    }
    
    .pagination-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .side-panel {
        grid-template-columns: 1fr;
    }
    
    .search-main-content {
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .search-filter-tabs {
        justify-content: center;
    }
    
    .filter-tab {
        flex: 1;
        justify-content: center;
        min-width: 0;
    }
    
    .filter-tab span {
        display: none;
    }
    
    .pagination-controls {
        margin-top: 24px;
    }
    
    .page-btn,
    .load-more-btn {
        width: 100%;
        justify-content: center;
    }
}