/* 
 * Global Search Component Styles
 * revizie-front | global-search.css
 */

/* =========================
   POPUP FIXED POSITIONING
   ========================= */
.search_area {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 9999 !important;
}

.search_area .search_box_inner {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 30px;
}

/* =========================
   SEARCH INPUT AREA
   ========================= */
.search_area .input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.search_area .input-group .form-control {
    flex: 1;
    padding-right: 80px;
}

/* Clear input button (X inside input) */
.search-clear-input-btn {
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.search-clear-input-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.search-clear-input-btn i {
    font-size: 14px;
}

/* Search submit button */
.search-submit-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    background: #ef4444;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    z-index: 10;
}

.search-submit-btn:hover {
    background: #dc2626;
}

.search-submit-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.search-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.search-submit-btn i {
    font-size: 14px;
}

/* Prevent body scroll when popup is open */
body.search-popup-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* Ensure Magnific Popup overlay stays in place */
.mfp-bg {
    position: fixed !important;
}

.mfp-wrap {
    position: fixed !important;
    overflow-y: hidden !important;
}

/* Hide Magnific Popup's default close button - we have our own */
.mfp-close {
    display: none !important;
}

button.mfp-close {
    display: none !important;
}

/* =========================
   SEARCH SUGGESTIONS HEADER
   ========================= */
.search-suggestions-header {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    padding: 8px 0 8px 0;
    margin-top: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

/* =========================
   SEARCH RESULTS LIST
   ========================= */
.search-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
    background: white;
    border-top: 1px solid #e0e0e0;
    position: relative;
    z-index: 1;
}

.list-items {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s ease;
    cursor: pointer;
}

.list-items:last-child {
    border-bottom: none;
}

.list-items:hover,
.list-items.active {
    background-color: #f9f9f9;
}

/* =========================
   SUGGESTION ITEMS
   ========================= */
.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.suggestion-icon {
    color: #999;
    font-size: 14px;
    flex-shrink: 0;
}

.suggestion-text {
    flex: 1;
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

.suggestion-text mark {
    background-color: transparent;
    color: #333;
    font-weight: 600;
}

.suggestion-arrow {
    color: #ccc;
    font-size: 12px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.suggestion-item:hover .suggestion-arrow,
.suggestion-item.active .suggestion-arrow {
    opacity: 1;
}

/* =========================
   VIEW ALL BUTTON
   ========================= */
.view-all-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: #ef4444;
    color: white !important;
    font-weight: 600;
    padding: 14px 16px;
    margin-top: 8px;
    border-radius: 4px;
    border-top: 1px solid #dc2626;
}

.view-all-item:hover,
.view-all-item.active {
    background-color: #dc2626;
}

.view-all-item i {
    font-size: 14px;
}

/* =========================
   NO RESULTS
   ========================= */
.no-results {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #999;
    padding: 20px;
    font-size: 14px;
}

/* =========================
   LOADING SPINNER
   ========================= */
.fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* =========================
   CLOSE BUTTON
   ========================= */
.search-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f5f5;
    color: #666;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    font-size: 16px;
}

.search-close-btn:hover {
    background: #ef4444;
    color: white;
    transform: rotate(90deg);
}

.search-close-btn:active {
    transform: rotate(90deg) scale(0.95);
}

.search-close-btn i {
    line-height: 1;
}

/* =========================
   MOBILE RESPONSIVE STYLES
   ========================= */
@media (max-width: 767px) {
    /* Full screen popup on mobile */
    .search_area {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        border-radius: 0;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .search_area .search_box_inner {
        padding: 20px 15px;
        border-radius: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .search_area .search_box_inner h3 {
        font-size: 18px;
        margin-bottom: 15px;
    }

    /* Larger close button on mobile for easier tapping */
    .search-close-btn {
        width: 42px;
        height: 42px;
        top: 12px;
        right: 12px;
        font-size: 18px;
    }

    .search-close-btn:hover {
        transform: none; /* Disable rotation on mobile */
    }

    .search-close-btn:active {
        transform: scale(0.9);
        background: #ef4444;
        color: white;
    }

            /* Adjust input and buttons for mobile */
            .search_area .input-group input {
                font-size: 16px;
                padding: 12px 90px 12px 12px;
                height: 48px;
            }

            .search-clear-input-btn {
                right: 56px;
                width: 32px;
                height: 32px;
            }

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

            .search-submit-btn {
                right: 10px;
                width: 40px;
                height: 40px;
            }

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

            /* Mobile-optimized results list */
            .search-results-list {
                max-height: calc(100vh - 200px);
                overflow-y: auto;
            }

            /* Larger tap targets for mobile */
            .list-items {
                padding: 14px 0;
            }

            /* Adjust suggestion items for mobile */
            .suggestion-item {
                gap: 10px;
            }

            .suggestion-text {
                font-size: 15px;
                line-height: 1.5;
            }

            .suggestion-icon {
                font-size: 15px;
            }

            .suggestion-arrow {
                opacity: 1;
                font-size: 14px;
            }

            /* View all button - larger and more prominent on mobile */
            .view-all-item {
                padding: 16px;
                font-size: 15px;
                font-weight: 600;
                margin-top: 12px;
            }
}

/* Small mobile devices */
@media (max-width: 375px) {
    .search_area .search_box_inner {
        padding: 15px 10px;
    }

    .search_area .search_box_inner h3 {
        font-size: 16px;
    }

    .suggestion-text {
        font-size: 14px;
    }

    .list-items {
        padding: 12px 0;
    }
}

/* Tablet landscape */
@media (min-width: 768px) and (max-width: 991px) {
    .search-results-list {
        max-height: 450px;
    }
}

