/* ==========================================
   CUSTOM INTERNAL SEARCH ENGINE OVERLAY CSS
   ========================================== */

/* Search Trigger in Navbar */
.nav-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 50%;
    color: #333;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0, 0, 0, 0.03);
    margin-right: 5px;
}

.nav-search-btn:hover {
    color: #05AFEF;
    background: rgba(5, 175, 239, 0.1);
    transform: scale(1.1);
}

.nav-search-btn i {
    font-size: 16px;
}

/* Search Trigger in Mobile Navbar */
.mobile-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #333;
    background: rgba(0, 0, 0, 0.04);
    margin-right: 15px;
    transition: all 0.3s ease;
}

.mobile-search-btn:hover, .mobile-search-btn:active {
    color: #05AFEF;
    background: rgba(5, 175, 239, 0.08);
}

/* Search Overlay Container */
.hash-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    background: rgba(8, 12, 24, 0.88);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 60px 20px 20px 20px;
    box-sizing: border-box;
    font-family: 'Poppins', 'Inter', sans-serif;
}

.hash-search-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Modal Box */
.hash-search-modal {
    width: 100%;
    max-width: 780px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    transform: translateY(-30px) scale(0.96);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.hash-search-overlay.active .hash-search-modal {
    transform: translateY(0) scale(1);
}

/* Search Header */
.hash-search-header {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    background: rgba(255, 255, 255, 0.02);
}

.hash-search-icon-left {
    color: rgba(255, 255, 255, 0.4);
    font-size: 20px;
    margin-right: 15px;
    transition: color 0.3s;
    flex-shrink: 0; /* Prevents icon from shrinking on narrow screens */
}

.hash-search-input {
    flex: 1;
    min-width: 0; /* Allows input to shrink properly to avoid pushing controls off-screen */
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.5;
    padding: 0;
    margin: 0;
}

.hash-search-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

/* Glowing Input focus effect */
.hash-search-header:focus-within {
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 4px 20px rgba(5, 175, 239, 0.15);
}

.hash-search-header:focus-within .hash-search-icon-left {
    color: #05AFEF;
}

/* Controls (Esc and Close) */
.hash-search-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0; /* Prevents controls from shrinking/shifting off-screen */
}

.hash-search-key-pill {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: monospace;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    cursor: default;
}

.hash-search-close {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.hash-search-close:hover {
    background: rgba(244, 67, 54, 0.2);
    color: #ff5252;
    transform: rotate(90deg);
}

/* Search Body / Results area */
.hash-search-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    max-height: calc(85vh - 85px);
    scroll-behavior: smooth;
}

/* Scrollbar styling */
.hash-search-body::-webkit-scrollbar {
    width: 6px;
}

.hash-search-body::-webkit-scrollbar-track {
    background: transparent;
}

.hash-search-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.hash-search-body::-webkit-scrollbar-thumb:hover {
    background: rgba(5, 175, 239, 0.4);
}

/* Section Title */
.hash-search-section-title {
    color: rgba(255, 255, 255, 0.35);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 15px;
    font-weight: 600;
}

/* Default / Recommendation Links */
.hash-search-recommendations {
    margin-bottom: 25px;
}

.hash-rec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.hash-rec-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-sizing: border-box;
}

.hash-rec-item:hover {
    background: rgba(5, 175, 239, 0.06);
    border-color: rgba(5, 175, 239, 0.25);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(5, 175, 239, 0.1);
}

.hash-rec-item i {
    font-size: 16px;
    color: #05AFEF;
    background: rgba(5, 175, 239, 0.1);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.hash-rec-item:hover i {
    background: #05AFEF;
    color: #ffffff;
    transform: scale(1.1);
}

.hash-rec-text {
    font-size: 13px;
    font-weight: 500;
}

/* Search Result Items styling */
.hash-results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hash-search-result-item {
    display: flex;
    flex-direction: column;
    padding: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    color: #e2e8f0;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.hash-search-result-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: transparent;
    transition: background 0.3s;
}

.hash-search-result-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    color: #ffffff;
}

/* Hover highlights by category colors */
.hash-search-result-item.cat-services:hover::before { background: #05AFEF; }
.hash-search-result-item.cat-hire-developers:hover::before { background: #4caf50; }
.hash-search-result-item.cat-iot-products:hover::before { background: #F89D22; }
.hash-search-result-item.cat-events-news:hover::before { background: #9c27b0; }
.hash-search-result-item.cat-case-studies:hover::before { background: #e91e63; }

/* Keyboard navigation focus style */
.hash-search-result-item.focused {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(5, 175, 239, 0.3);
    outline: none;
}
.hash-search-result-item.focused::before {
    background: #05AFEF;
}

/* Result Title and Badges */
.hash-result-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.hash-result-title {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hash-result-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Badge colors corresponding to categories */
.badge-services {
    background: rgba(5, 175, 239, 0.12);
    color: #05AFEF;
}

.badge-hire-developers {
    background: rgba(76, 175, 80, 0.12);
    color: #4caf50;
}

.badge-iot-products {
    background: rgba(248, 149, 34, 0.12);
    color: #F89D22;
}

.badge-events-news {
    background: rgba(156, 39, 176, 0.12);
    color: #e040fb;
}

.badge-case-studies {
    background: rgba(233, 30, 99, 0.12);
    color: #ff4081;
}

/* Result Description snippet */
.hash-result-description {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.6;
    margin: 0 0 10px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Breadcrumb path */
.hash-result-path {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    gap: 4px;
}

.hash-result-path i {
    font-size: 8px;
}

/* Text Match Highlight mark */
.hash-search-overlay mark {
    background: rgba(248, 149, 34, 0.25);
    color: #F89D22;
    border-bottom: 1.5px solid #F89D22;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* States: Empty, Loading, No results */
.hash-search-empty-state, 
.hash-search-loading-state, 
.hash-search-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    text-align: center;
}

.hash-search-state-icon {
    font-size: 36px;
    color: rgba(255, 255, 255, 0.25);
    margin-bottom: 15px;
    animation: float 3s ease-in-out infinite;
}

.hash-search-loading-state .hash-search-state-icon {
    animation: spin 1.2s linear infinite;
    color: #05AFEF;
}

.hash-search-state-text {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    font-weight: 500;
}

/* Animations */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

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

/* Footer Instructions */
.hash-search-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
}

.hash-search-instructions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hash-search-instruction-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.hash-search-kbd {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 9px;
    font-family: monospace;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Body scroll lock helper */
body.search-active {
    overflow: hidden !important;
    height: 100vh !important;
    height: -webkit-fill-available !important;
}

/* Responsive adjustments for mobile and tablets */
@media (max-width: 768px) {
    .hash-search-overlay {
        padding: 0;
        align-items: stretch;
    }
    
    .hash-search-modal {
        height: 100%;
        max-height: 100vh;
        max-height: -webkit-fill-available;
        border-radius: 0;
        border: none;
    }
    
    .hash-search-body {
        padding: 15px 12px;
        max-height: calc(100vh - 75px);
        max-height: calc(-webkit-fill-available - 75px);
    }
    
    .hash-search-header {
        padding: 15px 12px;
    }
    
    .hash-rec-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .hash-search-footer {
        display: none; /* Hide desktop instructions on mobile */
    }

    .hash-search-key-pill {
        display: none !important; /* Hide keyboard shortcut on mobile */
    }
}
