/* =====================================================
   Global Search - Dropdown Styles
   ===================================================== */

/* Wrapper for positioning */
#globalSearchWrapper {
    position: relative;
    flex: 0 0 320px;
    max-width: 400px;
}

/* Search input container */
.gs-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.gs-input-group .gs-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #a1acb8;
    font-size: 1.125rem;
    pointer-events: none;
    z-index: 2;
}

#globalSearchInput {
    padding-left: 2.25rem;
    padding-right: 2.25rem;
    border-radius: 0.375rem;
    border: 1px solid #d9dee3;
    background: #f5f5f9;
    height: 38px;
    font-size: 0.875rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, background-color 0.15s ease-in-out;
    width: 100%;
}

#globalSearchInput:focus {
    border-color: #696cff;
    background: #fff;
    box-shadow: 0 0 0 0.15rem rgba(105, 108, 255, 0.1);
    outline: none;
}

#globalSearchInput::placeholder {
    color: #a1acb8;
    font-weight: 400;
}

#globalSearchClear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #a1acb8;
    cursor: pointer;
    border-radius: 50%;
    padding: 0;
    font-size: 1.125rem;
    z-index: 2;
    transition: color 0.15s, background 0.15s;
}

#globalSearchClear:hover {
    color: #566a7f;
    background: rgba(0, 0, 0, 0.06);
}

/* Dropdown container */
#globalSearchDropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    min-width: 100%;
    max-height: 420px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d9dee3;
    border-radius: 0.5rem;
    box-shadow: 0 0.25rem 1rem rgba(161, 172, 184, 0.45);
    z-index: 1050;
    scrollbar-width: thin;
}

#globalSearchDropdown.show {
    display: block;
}

#globalSearchDropdown::-webkit-scrollbar {
    width: 5px;
}

#globalSearchDropdown::-webkit-scrollbar-thumb {
    background: #d9dee3;
    border-radius: 3px;
}

/* Group label */
.gs-group {
    padding: 0.25rem 0;
}

.gs-group + .gs-group {
    border-top: 1px solid #f0f2f4;
}

.gs-group-label {
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #a1acb8;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.gs-group-label i {
    font-size: 0.875rem;
}

/* Result item */
.gs-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
    cursor: pointer;
}

.gs-item:hover,
.gs-item.gs-item-active {
    background: #f5f5f9;
    text-decoration: none;
    color: inherit;
}

.gs-item-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.gs-item-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.gs-item-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #566a7f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gs-item-subtitle {
    font-size: 0.7rem;
    color: #a1acb8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

/* Highlight matched text */
.gs-highlight {
    background: rgba(105, 108, 255, 0.22);
    color: #696cff;
    padding: 0.05em 0.15em;
    border-radius: 2px;
    font-weight: 600;
}

/* Loading state */
.gs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.25rem;
    color: #a1acb8;
    font-size: 0.8125rem;
}

/* Empty state */
.gs-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 1.5rem 1rem;
    color: #a1acb8;
    font-size: 0.8125rem;
    text-align: center;
}

.gs-empty i {
    font-size: 1.5rem;
}

/* Keyboard shortcut badge */
.gs-kbd {
    display: none;
    font-size: 0.65rem;
    padding: 0.125rem 0.375rem;
    background: #e7e7ff;
    color: #696cff;
    border-radius: 0.25rem;
    font-weight: 500;
    position: absolute;
    right: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

#globalSearchInput:not(:focus) + .gs-kbd,
#globalSearchInput[value=""] + .gs-kbd {
    display: inline-block;
}

/* Mobile search trigger — hidden on md+ */
#globalSearchMobileTrigger {
    display: none !important;
}

/* Responsive */
@media (max-width: 1399.98px) {
    #globalSearchWrapper {
        flex: 0 1 280px;
    }
}

@media (max-width: 1199.98px) {
    #globalSearchWrapper {
        flex: 0 1 220px;
    }

    #globalSearchInput::placeholder {
        font-size: 0.8rem;
    }
}

@media (max-width: 991.98px) {
    #globalSearchWrapper {
        flex: 0 1 180px;
    }

    #globalSearchInput {
        font-size: 0.8125rem;
        height: 34px;
    }

    #globalSearchInput::placeholder {
        font-size: 0.75rem;
    }
}

@media (max-width: 767.98px) {
    /* Hide inline search, show icon trigger */
    #globalSearchWrapper {
        display: none !important;
    }

    #globalSearchMobileTrigger {
        display: inline-flex !important;
    }

    /* Full-screen overlay when search is open on mobile */
    #globalSearchWrapper.gs-mobile-open {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1080;
        background: #fff;
        padding: 0.5rem 0.75rem;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
        flex: none;
        max-width: none;
        flex-direction: column;
    }

    #globalSearchWrapper.gs-mobile-open .gs-input-group {
        width: 100%;
    }

    #globalSearchWrapper.gs-mobile-open #globalSearchInput {
        font-size: 1rem;
        height: 44px;
        border-radius: 0.5rem;
        background: #f5f5f9;
    }

    #globalSearchWrapper.gs-mobile-open #globalSearchDropdown {
        position: relative;
        top: 0;
        max-height: calc(100vh - 60px);
        max-height: calc(100dvh - 60px);
        border: none;
        border-top: 1px solid #eee;
        border-radius: 0;
        box-shadow: none;
    }

    }
