/* R308D-UX1 — compact header + live search */

/*
 * Authenticated header:
 * preserve the search affordance while reclaiming horizontal space.
 */
.r308d-global-search-link.r308d-search-trigger-compact {
    width: 48px !important;
    min-width: 48px !important;
    height: 48px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    border-radius: 16px !important;
}

.r308d-global-search-link.r308d-search-trigger-compact > span {
    display: none !important;
}

.r308d-global-search-link.r308d-search-trigger-compact svg {
    width: 21px !important;
    height: 21px !important;
}

body.r308d-live-search-open {
    overflow: hidden !important;
}


/*
 * Command-palette backdrop.
 */
.r308d-live-search-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 10vh 18px 24px;
    background:
        rgba(3, 10, 24, .56);
    backdrop-filter:
        blur(12px);
    -webkit-backdrop-filter:
        blur(12px);
}

.r308d-live-search-backdrop[hidden] {
    display: none !important;
}


/*
 * Main palette.
 */
.r308d-live-search-dialog {
    direction: rtl;
    width: min(720px, 100%);
    max-height: min(720px, 82vh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 28px;
    background:
        linear-gradient(
            180deg,
            rgba(255,255,255,.99),
            rgba(248,251,255,.99)
        );
    box-shadow:
        0 36px 100px rgba(2, 6, 23, .34),
        0 4px 20px rgba(2, 6, 23, .12);
    animation:
        r308d-live-search-in
        150ms ease-out;
}


@keyframes r308d-live-search-in {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/*
 * Search input.
 */
.r308d-live-search-header {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 40px;
    align-items: center;
    gap: 9px;
    padding: 14px;
    border-bottom: 1px solid #e6edf6;
    background:
        rgba(255,255,255,.98);
}

.r308d-live-search-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #0f6da8;
    background:
        linear-gradient(
            135deg,
            #cffafe,
            #dbeafe
        );
    font-size: 25px;
    font-weight: 1000;
}

.r308d-live-search-input {
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 0 4px;
    border: 0;
    outline: none;
    color: #0f172a;
    background: transparent;
    font: inherit;
    font-size: 15px;
    font-weight: 750;
}

.r308d-live-search-input::placeholder {
    color: #94a3b8;
    font-weight: 600;
}

.r308d-live-search-close {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 13px;
    color: #475569;
    background: #f1f5f9;
    font: inherit;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.r308d-live-search-close:hover {
    color: #0f172a;
    background: #e2e8f0;
}


/*
 * Status.
 */
.r308d-live-search-status {
    min-height: 36px;
    padding: 10px 18px 5px;
    color: #64748b;
    font-size: 11.5px;
    font-weight: 850;
}


/*
 * Results area.
 */
.r308d-live-search-content {
    min-height: 170px;
    overflow-y: auto;
    padding: 5px 10px 12px;
    overscroll-behavior: contain;
}

.r308d-live-search-group + .r308d-live-search-group {
    margin-top: 7px;
}

.r308d-live-search-section-title {
    padding: 8px 9px 6px;
    color: #64748b;
    font-size: 10.5px;
    font-weight: 950;
}


/*
 * Result item.
 */
.r308d-live-search-result {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 24px;
    align-items: center;
    gap: 11px;
    min-height: 67px;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 17px;
    color: #0f172a;
    text-decoration: none;
    transition:
        background 120ms ease,
        border-color 120ms ease,
        transform 120ms ease;
}

.r308d-live-search-result:hover,
.r308d-live-search-result.is-active {
    border-color: #dbeafe;
    background:
        linear-gradient(
            135deg,
            #eff6ff,
            #f0fdfa
        );
    transform: translateY(-1px);
}

.r308d-live-search-result-badge {
    min-width: 68px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 9px;
    border-radius: 999px;
    color: #1d4ed8;
    background: #eff6ff;
    font-size: 9.8px;
    font-weight: 950;
    white-space: nowrap;
}

.r308d-live-search-result-body {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.r308d-live-search-result-body strong {
    overflow: hidden;
    color: #0f172a;
    font-size: 13.5px;
    line-height: 1.7;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.r308d-live-search-result-body small {
    overflow: hidden;
    color: #64748b;
    font-size: 10.8px;
    line-height: 1.6;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.r308d-live-search-result-description {
    overflow: hidden;
    color: #94a3b8;
    font-size: 10.5px;
    line-height: 1.6;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.r308d-live-search-result-arrow {
    color: #94a3b8;
    font-size: 15px;
    font-weight: 900;
}


/*
 * Quick queries.
 */
.r308d-live-search-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 2px 8px 10px;
}

.r308d-live-search-chip {
    min-height: 34px;
    padding: 5px 11px;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    color: #1e40af;
    background: #eff6ff;
    font: inherit;
    font-size: 11px;
    font-weight: 850;
    cursor: pointer;
}

.r308d-live-search-chip:hover {
    color: #075985;
    border-color: #bae6fd;
    background: #ecfeff;
}

.r308d-live-search-quick-links {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 6px 8px 12px;
}

.r308d-live-search-quick-link {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    color: #334155;
    background: #fff;
    font-size: 11px;
    font-weight: 850;
    text-decoration: none;
}

.r308d-live-search-quick-link:hover {
    border-color: #bfdbfe;
    color: #1d4ed8;
    background: #f8fbff;
}


/*
 * Loading.
 */
.r308d-live-search-skeleton {
    display: grid;
    gap: 8px;
    padding: 13px;
    margin: 4px;
    border-radius: 16px;
    background: #f8fafc;
}

.r308d-live-search-skeleton-title,
.r308d-live-search-skeleton-line {
    display: block;
    height: 10px;
    border-radius: 999px;
    background:
        linear-gradient(
            90deg,
            #e2e8f0,
            #f8fafc,
            #e2e8f0
        );
    background-size: 220% 100%;
    animation:
        r308d-search-shimmer
        1.1s linear infinite;
}

.r308d-live-search-skeleton-title {
    width: 44%;
}

.r308d-live-search-skeleton-line {
    width: 72%;
}


@keyframes r308d-search-shimmer {
    to {
        background-position: -220% 0;
    }
}


/*
 * Empty / error / min length.
 */
.r308d-live-search-empty,
.r308d-live-search-error,
.r308d-live-search-minimum {
    margin: 8px;
    padding: 24px 18px;
    border: 1px dashed #cbd5e1;
    border-radius: 18px;
    color: #64748b;
    background: #f8fafc;
    text-align: center;
}

.r308d-live-search-empty strong,
.r308d-live-search-error strong {
    display: block;
    margin-bottom: 5px;
    color: #334155;
}

.r308d-live-search-empty p,
.r308d-live-search-error p {
    margin: 0;
    font-size: 11.5px;
    line-height: 1.9;
}


/*
 * Footer.
 */
.r308d-live-search-footer {
    min-height: 55px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 15px;
    border-top: 1px solid #e6edf6;
    background: #f8fafc;
}

.r308d-live-search-hint {
    color: #94a3b8;
    font-size: 9.8px;
    font-weight: 700;
}

.r308d-live-search-advanced {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    border-radius: 11px;
    color: #075985;
    background: #cffafe;
    font-size: 10.8px;
    font-weight: 950;
    text-decoration: none;
}


/*
 * Mobile = full search sheet.
 */
@media (max-width: 800px) {

    .r308d-live-search-backdrop {
        align-items: stretch;
        padding: 0;
        background: rgba(2, 6, 23, .66);
    }

    .r308d-live-search-dialog {
        width: 100%;
        max-width: none;
        height: 100%;
        max-height: none;
        border: 0;
        border-radius: 0;
        background: #f8fbff;
    }

    .r308d-live-search-header {
        grid-template-columns: 32px minmax(0, 1fr) 40px;
        padding:
            calc(9px + env(safe-area-inset-top, 0px))
            12px
            10px;
        background:
            linear-gradient(
                145deg,
                #071225,
                #10274c
            );
        border-bottom-color:
            rgba(255,255,255,.10);
    }

    .r308d-live-search-icon {
        width: 32px;
        height: 32px;
        color: #cffafe;
        background: rgba(255,255,255,.10);
    }

    .r308d-live-search-input {
        height: 47px;
        color: #fff;
        font-size: 14px;
    }

    .r308d-live-search-input::placeholder {
        color: rgba(226,232,240,.64);
    }

    .r308d-live-search-close {
        color: #e2e8f0;
        background: rgba(255,255,255,.10);
    }

    .r308d-live-search-status {
        padding-inline: 14px;
    }

    .r308d-live-search-content {
        flex: 1;
        padding: 5px 8px 14px;
    }

    .r308d-live-search-result {
        min-height: 72px;
        grid-template-columns:
            auto minmax(0, 1fr) 20px;
        gap: 8px;
        padding: 10px 8px;
    }

    .r308d-live-search-result-badge {
        min-width: 58px;
        padding-inline: 7px;
        font-size: 9px;
    }

    .r308d-live-search-result-description {
        display: none;
    }

    .r308d-live-search-quick-links {
        grid-template-columns: 1fr;
    }

    .r308d-live-search-footer {
        padding-bottom:
            calc(
                10px
                + env(
                    safe-area-inset-bottom,
                    0px
                )
            );
    }

    .r308d-live-search-hint {
        display: none;
    }

    .r308d-live-search-advanced {
        width: 100%;
        min-height: 43px;
    }
}
