/* ==========================================================================
   Lao Ethnic Garden — Search Modal
   ========================================================================== */

.leg-search-modal {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 10vh 20px 20px;
}
.leg-search-modal.is-open {
    display: flex;
    animation: leg-search-fade 200ms ease;
}
@keyframes leg-search-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.leg-search-modal__backdrop {
    position: absolute;
    inset: 0;
    background: var(--leg-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.leg-search-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 640px;
    background: var(--leg-surface);
    border-radius: 10px;
    box-shadow: var(--leg-shadow-lg), 0 0 0 1px var(--leg-border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    animation: leg-search-pop 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes leg-search-pop {
    from { transform: translateY(-16px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* Header with input */
.leg-search-modal__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--leg-border);
    flex-shrink: 0;
}
.leg-search-modal__icon {
    width: 22px;
    height: 22px;
    color: var(--leg-text-muted);
    flex-shrink: 0;
}
.leg-search-modal__input {
    flex: 1 1 auto;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--leg-text);
    font-family: var(--leg-font-sans);
    font-size: 1.05rem;
    font-weight: 500;
    padding: 4px 0;
}
.leg-search-modal__input::placeholder {
    color: var(--leg-text-muted);
    font-weight: 400;
}
.leg-search-modal__input::-webkit-search-cancel-button { display: none; }

.leg-search-modal__kbd,
.leg-search-modal__footer kbd {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: var(--leg-surface-alt);
    border: 1px solid var(--leg-border-strong);
    border-bottom-width: 2px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--leg-text-muted);
    font-family: var(--leg-font-sans);
    line-height: 1.2;
    flex-shrink: 0;
}

.leg-search-modal__close {
    background: transparent;
    border: 0;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--leg-text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: all var(--leg-transition);
    display: none;
}
.leg-search-modal__close:hover {
    background: var(--leg-surface-alt);
    color: var(--leg-text);
}
@media (max-width: 575px) {
    .leg-search-modal__kbd { display: none; }
    .leg-search-modal__close { display: inline-flex; align-items: center; justify-content: center; }
}

/* Body with results */
.leg-search-modal__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--leg-border) transparent;
}
.leg-search-modal__body::-webkit-scrollbar { width: 8px; }
.leg-search-modal__body::-webkit-scrollbar-thumb {
    background: var(--leg-border);
    border-radius: 4px;
}

.leg-search-modal__section {
    margin-bottom: 16px;
}
.leg-search-modal__section:last-child { margin-bottom: 0; }

.leg-search-modal__section-title {
    font-family: var(--leg-font-heading);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--leg-text-muted);
    margin: 0 0 6px 8px;
}

.leg-search-modal__items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.leg-search-modal__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--leg-text);
    transition: all 150ms ease;
    border: 1px solid transparent;
}
.leg-search-modal__item:hover,
.leg-search-modal__item.is-active {
    background: rgba(22, 163, 74, 0.08);
    color: var(--leg-primary-dark);
    border-color: rgba(22, 163, 74, 0.12);
    transform: translateX(2px);
}
:root[data-theme="dark"] .leg-search-modal__item:hover,
:root[data-theme="dark"] .leg-search-modal__item.is-active {
    background: rgba(108, 178, 82, 0.15);
    color: #a7d88e;
    border-color: rgba(108, 178, 82, 0.25);
}

.leg-search-modal__item > span:first-child {
    font-size: 1.35rem;
    width: 32px;
    flex-shrink: 0;
    text-align: center;
}
.leg-search-modal__item > div {
    flex: 1 1 auto;
    min-width: 0;
}
.leg-search-modal__item strong {
    display: block;
    font-family: var(--leg-font-heading);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.leg-search-modal__item small {
    display: block;
    font-size: 0.78rem;
    color: var(--leg-text-muted);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.leg-search-modal__item:hover small,
.leg-search-modal__item.is-active small {
    color: var(--leg-text-muted);
}

.leg-search-modal__empty {
    text-align: center;
    padding: 36px 20px;
    color: var(--leg-text-muted);
}
.leg-search-modal__empty-icon {
    font-size: 2.4rem;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* Footer with keyboard hints */
.leg-search-modal__footer {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    padding: 10px 16px;
    border-top: 1px solid var(--leg-border);
    background: var(--leg-surface-alt);
    font-size: 0.72rem;
    color: var(--leg-text-muted);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.leg-search-modal__footer span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.leg-search-modal__footer kbd {
    padding: 1px 6px;
    font-size: 0.68rem;
}

/* Mobile */
@media (max-width: 575px) {
    .leg-search-modal { padding: 0; }
    .leg-search-modal__dialog {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        height: 100vh;
    }
    .leg-search-modal__footer { display: none; }
}

/* Highlighted match text */
.leg-search-highlight {
    background: rgba(22, 163, 74, 0.2);
    color: var(--leg-primary-dark);
    border-radius: 3px;
    padding: 0 2px;
    font-weight: 700;
}
:root[data-theme="dark"] .leg-search-highlight {
    background: rgba(108, 178, 82, 0.28);
    color: #a7d88e;
}
