/* Global search (header) — plain CSS, no Tailwind dependency. */

.gs-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 220px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

#global-search-input {
    width: 100%;
    height: 34px;
    padding: 6px 12px 6px 34px;
    font-size: 14px;
    color: #333;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
    background-size: 16px 16px;
    border: 1px solid #d2d6de;
    border-radius: 4px;
    outline: none;
}

#global-search-input:focus {
    border-color: #3c8dbc;
    box-shadow: 0 0 3px rgba(60, 141, 188, 0.4);
}

.gs-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 70vh;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d2d6de;
    border-radius: 4px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    z-index: 1045;
    text-align: left;
}

.gs-panel.hide {
    display: none;
}

.gs-state {
    padding: 14px 16px;
    font-size: 14px;
    color: #666;
}

.gs-state-hint {
    margin-top: 4px;
    font-size: 12px;
    color: #999;
}

.gs-group {
    border-bottom: 1px solid #f0f0f0;
}

.gs-group:last-child {
    border-bottom: none;
}

.gs-cat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    background: #3c8dbc;
}

.gs-cat i {
    font-size: 13px;
}

.gs-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f4f4f4;
}

.gs-row:last-child {
    border-bottom: none;
}

.gs-row:hover,
.gs-row.gs-active {
    background: #ecf5fb;
}

.gs-row-main {
    min-width: 0;
    flex: 1 1 auto;
}

.gs-title {
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gs-title mark {
    padding: 0 1px;
    color: inherit;
    background: #ffeb3b;
    border-radius: 2px;
}

.gs-subtitle {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gs-badge {
    flex: 0 0 auto;
    display: inline-block;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
    color: #555;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 999px;
    white-space: nowrap;
}

.gs-truncated {
    padding: 8px 12px;
    font-size: 12px;
    font-style: italic;
    color: #888;
    background: #fafafa;
    border-top: 1px solid #eee;
}

/* Right-to-left */
[dir="rtl"] #global-search-input,
.rtl #global-search-input {
    padding: 6px 34px 6px 12px;
    background-position: right 10px center;
}

[dir="rtl"] .gs-panel,
.rtl .gs-panel {
    text-align: right;
}

[dir="rtl"] .gs-cat,
.rtl .gs-cat {
    flex-direction: row-reverse;
}

[dir="rtl"] .gs-row,
.rtl .gs-row {
    flex-direction: row-reverse;
}

/* Small screens: collapse to an icon button, expand on tap/focus. */
@media (max-width: 767px) {
    .gs-wrap {
        flex: 0 0 auto;
        min-width: 0;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }

    #global-search-input {
        width: 38px;
        height: 38px;
        padding: 0;
        color: transparent;
        background-position: center center;
        background-size: 18px 18px;
        cursor: pointer;
    }

    #global-search-input::placeholder {
        color: transparent;
    }

    .gs-wrap:focus-within {
        position: static;
        flex: 1 1 auto;
    }

    .gs-wrap:focus-within #global-search-input {
        width: 100%;
        padding: 6px 12px 6px 34px;
        color: #333;
        background-position: 10px center;
        cursor: text;
    }

    .gs-wrap:focus-within #global-search-input::placeholder {
        color: #999;
    }

    [dir="rtl"] .gs-wrap:focus-within #global-search-input,
    .rtl .gs-wrap:focus-within #global-search-input {
        padding: 6px 34px 6px 12px;
        background-position: right 10px center;
    }

    .gs-panel {
        position: fixed;
        top: auto;
        left: 8px;
        right: 8px;
    }
}
