/* =============================================
   GLOBAL SEARCH & CATEGORY NAVIGATION SYSTEM
   Enhanced version with better UX and performance
   ============================================= */

/* === FLOATING SEARCH BUTTON === */
.floating-search-btn {
    position: fixed;
    bottom: 120px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    color: white;
}

.floating-search-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 32px rgba(37, 99, 235, 0.5);
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
}

.floating-search-btn i {
    font-size: 24px;
    transition: transform 0.3s ease;
}

.floating-search-btn:hover i {
    transform: rotate(90deg);
}

.floating-search-btn .search-tooltip {
    position: absolute;
    right: 75px;
    background: #1f2937;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.floating-search-btn:hover .search-tooltip {
    opacity: 1;
}

/* === SEARCH CONTAINER === */
.search-container {
    position: fixed;
    top: 80px;
    right: 30px;
    width: 450px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: none;
    flex-direction: column;
    max-height: calc(100vh - 120px);
    overflow: hidden;
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-container.active {
    display: flex;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* === SEARCH HEADER === */
.search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 2px solid #e5e7eb;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

.search-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-header h3 i {
    color: #2563eb;
}

.search-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.search-close:hover {
    color: #ef4444;
    background: #fee2e2;
    transform: rotate(90deg);
}

/* === SEARCH INPUT === */
.search-input-wrapper {
    position: relative;
    padding: 20px 24px;
    background: white;
}

.search-input {
    width: 100%;
    padding: 14px 48px 14px 48px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.search-input:focus {
    outline: none;
    border-color: #2563eb;
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.search-input-icon {
    position: absolute;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 18px;
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    background: #e5e7eb;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 12px;
    transition: all 0.2s ease;
}

.search-clear:hover {
    background: #ef4444;
    color: white;
}

.search-clear.active {
    display: flex;
}

/* === SEARCH RESULTS === */
.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    max-height: 500px;
}

.search-results::-webkit-scrollbar {
    width: 8px;
}

.search-results::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.search-result-item {
    padding: 14px 16px;
    margin-bottom: 8px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: fadeInUp 0.3s ease forwards;
}

.search-result-item:hover {
    background: #f0f9ff;
    border-color: #2563eb;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.search-result-title {
    font-weight: 700;
    color: #1e40af;
    font-size: 15px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-result-title mark {
    background: #fef08a;
    color: #854d0e;
    padding: 2px 4px;
    border-radius: 4px;
}

.search-result-category {
    font-size: 13px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-result-category i {
    font-size: 12px;
    color: #2563eb;
}

.search-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.search-no-results i {
    font-size: 64px;
    color: #e5e7eb;
    margin-bottom: 16px;
    display: block;
}

.search-no-results p {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.search-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.search-placeholder i {
    font-size: 64px;
    color: #e5e7eb;
    margin-bottom: 16px;
    display: block;
}

.search-placeholder p {
    font-size: 15px;
    margin: 0;
}

/* === FLOATING CATEGORY BUTTON === */
.floating-category-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    color: white;
}

.floating-category-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 32px rgba(16, 185, 129, 0.5);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.floating-category-btn i {
    font-size: 24px;
    transition: transform 0.3s ease;
}

.floating-category-btn:hover i {
    transform: scale(1.1);
}

.floating-category-btn .category-tooltip {
    position: absolute;
    right: 75px;
    background: #1f2937;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.floating-category-btn:hover .category-tooltip {
    opacity: 1;
}

/* === CATEGORY PANEL === */
.category-panel {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: none;
    flex-direction: column;
    max-height: calc(100vh - 140px);
    overflow: hidden;
    animation: slideInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-panel.active {
    display: flex;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === CATEGORY HEADER === */
.category-header-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 2px solid #e5e7eb;
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
}

.category-header-panel h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #047857;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-header-panel h3 i {
    color: #10b981;
}

.category-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.category-close:hover {
    color: #ef4444;
    background: #fee2e2;
    transform: rotate(90deg);
}

/* === CATEGORY LIST === */
.category-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.category-list::-webkit-scrollbar {
    width: 8px;
}

.category-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.category-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.category-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.category-item {
    padding: 14px 16px;
    margin-bottom: 8px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeInUp 0.3s ease forwards;
}

.category-item:hover {
    background: #f0fdf4;
    border-color: #10b981;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.category-item-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #047857;
    flex-shrink: 0;
}

.category-item-content {
    flex: 1;
}

.category-item-title {
    font-weight: 700;
    color: #047857;
    font-size: 15px;
    margin-bottom: 2px;
}

.category-item-count {
    font-size: 12px;
    color: #6b7280;
}

/* === KEYBOARD SHORTCUTS INFO === */
.shortcuts-info {
    padding: 12px 16px;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
    font-size: 12px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.shortcut-key {
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 2px 8px;
    font-weight: 600;
    color: #1e40af;
    font-size: 11px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* === ANIMATIONS === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === HIGHLIGHT ANIMATION === */
.highlight-section {
    animation: highlightPulse 1.5s ease-in-out;
    scroll-margin-top: 100px;
}

@keyframes highlightPulse {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(37, 99, 235, 0.1);
    }
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 768px) {
    .search-container,
    .category-panel {
        right: 15px;
        left: 15px;
        width: auto;
    }
    
    .floating-search-btn,
    .floating-category-btn {
        right: 15px;
        width: 50px;
        height: 50px;
    }
    
    .floating-search-btn i,
    .floating-category-btn i {
        font-size: 20px;
    }
    
    .floating-search-btn .search-tooltip,
    .floating-category-btn .category-tooltip {
        display: none;
    }
    
    .floating-search-btn {
        bottom: 90px;
    }
    
    .floating-category-btn {
        bottom: 20px;
    }
    
    .search-container {
        top: 70px;
        max-height: calc(100vh - 90px);
    }
    
    .category-panel {
        bottom: 80px;
        max-height: calc(100vh - 100px);
    }
    
    .search-results {
        max-height: 400px;
    }
}

@media (max-width: 480px) {
    .search-header h3,
    .category-header-panel h3 {
        font-size: 16px;
    }
    
    .search-input {
        padding: 12px 40px 12px 40px;
        font-size: 14px;
    }
    
    .shortcuts-info {
        font-size: 11px;
        padding: 10px 12px;
    }
}

/* === OVERLAY === */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9997;
    display: none;
    animation: fadeIn 0.3s ease;
}

.search-overlay.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
