/*
 * global-search.css
 * Styles for the Global Search Bar component.
 * Uses gs-* prefix to avoid conflicts with XAF / DevExpress / existing ll-* styles.
 */

/* ── Container ────────────────────────────────────────────────────────────── */
#global-search-root {
    position: absolute;
    top: 0;
    left: 0;
    right: 50px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    pointer-events: none;
}

#global-search-root .gs-container {
    pointer-events: all;
}

.gs-container {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 340px;
    margin: 0 auto;
}

/* ── Input wrapper ────────────────────────────────────────────────────────── */
.gs-input-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 10px;
    transition: all 0.2s ease;
    cursor: text;
}

.gs-input-wrapper:focus-within {
    background: #ffffff;
    border-color: #0265a3;
    box-shadow: 0 0 0 3px rgba(2, 101, 163, 0.1);
}

.gs-icon {
    color: #94a3b8;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.gs-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.8rem;
    color: #1e293b;
    padding: 3px 6px;
    min-width: 0;
}

.gs-input::placeholder {
    color: #64748b;
    font-size: 0.8rem;
}

.gs-clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    background: #e2e8f0;
    border-radius: 50%;
    cursor: pointer;
    color: #64748b;
    font-size: 0.65rem;
    flex-shrink: 0;
    transition: all 0.15s;
}

.gs-clear-btn:hover {
    background: #cbd5e1;
    color: #1e293b;
}

.gs-shortcut-hint {
    font-size: 0.7rem;
    color: #475569;
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    font-family: monospace;
    letter-spacing: 0.03em;
}

.gs-input-wrapper:focus-within .gs-shortcut-hint {
    display: none;
}

/* ── Dropdown ─────────────────────────────────────────────────────────────── */
.gs-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.06);
    max-height: 420px;
    overflow-y: auto;
    overflow-x: hidden;
    animation: gsSlideDown 0.15s ease-out;
}

@keyframes gsSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Loading ──────────────────────────────────────────────────────────────── */
.gs-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 14px;
    color: #64748b;
    font-size: 0.825rem;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.gs-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 14px;
    color: #64748b;
    font-size: 0.825rem;
    justify-content: center;
}

.gs-empty i {
    font-size: 1rem;
}

/* ── Groups ───────────────────────────────────────────────────────────────── */
.gs-group {
    padding: 4px 0;
}

.gs-group + .gs-group {
    border-top: 1px solid #f1f5f9;
}

.gs-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.gs-group-count {
    background: #f1f5f9;
    color: #475569;
    padding: 1px 6px;
    border-radius: 99px;
    font-size: 0.65rem;
    font-weight: 700;
}

/* ── Result items ─────────────────────────────────────────────────────────── */
.gs-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.1s;
    border-radius: 6px;
    margin: 0 4px;
}

.gs-item:hover,
.gs-item-active {
    background: #f1f5f9;
}

.gs-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.gs-item-active .gs-item-icon,
.gs-item:hover .gs-item-icon {
    background: #e2e8f0;
}

.gs-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.gs-item-title {
    font-size: 0.825rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gs-item-subtitle {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Status badges ────────────────────────────────────────────────────────── */
.gs-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.gs-badge-amber  { background: #fef3c7; color: #92400e; }
.gs-badge-red    { background: #fee2e2; color: #991b1b; }
.gs-badge-blue   { background: #dbeafe; color: #1e40af; }
.gs-badge-purple { background: #ede9fe; color: #5b21b6; }
.gs-badge-pink   { background: #fce7f3; color: #9d174d; }
.gs-badge-cyan   { background: #cffafe; color: #155e75; }
.gs-badge-green  { background: #dcfce7; color: #166534; }
.gs-badge-gray   { background: #f1f5f9; color: #475569; }

/* ── Footer (keyboard hints) ──────────────────────────────────────────────── */
.gs-footer {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 14px;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
    border-radius: 0 0 10px 10px;
    font-size: 0.7rem;
    color: #64748b;
}

.gs-footer kbd {
    display: inline-flex;
    align-items: center;
    padding: 1px 4px;
    background: #e2e8f0;
    border-radius: 3px;
    font-size: 0.65rem;
    font-family: monospace;
    color: #475569;
    margin-right: 3px;
}

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
.gs-dropdown::-webkit-scrollbar {
    width: 6px;
}
.gs-dropdown::-webkit-scrollbar-track {
    background: transparent;
}
.gs-dropdown::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 3px;
}
.gs-dropdown::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 992px) {
    .gs-container {
        max-width: 280px;
    }

    .gs-shortcut-hint {
        display: none;
    }
}

@media (max-width: 575.98px) {
    #global-search-root {
        display: none !important;
    }
}

/* ── Search term highlight ────────────────────────────────────────────────── */
.gs-highlight {
    background: #fef08a;
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}
