/**
 * FPP Search v2 — Command Palette Styles
 */

/* Overlay */
.fpp-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s;
}

.fpp-search-overlay.fpp-search-open {
    opacity: 1;
    visibility: visible;
}

/* Palette */
.fpp-search-palette {
    width: 680px;
    max-width: calc(100vw - 32px);
    max-height: 75vh;
    background: #faf8f4;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.96) translateY(-10px);
    transition: transform 0.2s ease;
}

.fpp-search-open .fpp-search-palette {
    transform: scale(1) translateY(0);
}

/* Header */
.fpp-search-header {
    flex-shrink: 0;
    border-bottom: 1px solid #e8e4de;
}

.fpp-search-input-wrap {
    display: flex;
    align-items: center;
    padding: 4px 16px;
    gap: 12px;
}

.fpp-search-icon {
    flex-shrink: 0;
    color: #8a7e6e;
    display: flex;
    align-items: center;
}

.fpp-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 17px;
    font-family: 'Inter', -apple-system, sans-serif;
    color: #1a1a1a;
    padding: 14px 0;
    outline: none;
    -webkit-appearance: none;
}

.fpp-search-input::placeholder {
    color: #a09888;
}

.fpp-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.fpp-search-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.fpp-search-close kbd {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-family: inherit;
    color: #8a7e6e;
    background: #eee9e0;
    border: 1px solid #ddd6ca;
    border-radius: 5px;
    line-height: 1.3;
}

/* Facet bar */
.fpp-search-facets {
    display: flex;
    gap: 6px;
    padding: 8px 16px 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.fpp-search-facets::-webkit-scrollbar { display: none; }

.fpp-facet-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    font-size: 13px;
    font-family: inherit;
    color: #6b5d4d;
    background: transparent;
    border: 1px solid #ddd6ca;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.fpp-facet-btn:hover {
    background: #f0ebe3;
    border-color: #c8bfb0;
}

.fpp-facet-btn.fpp-facet-active {
    background: #2d5a3d;
    color: #fff;
    border-color: #2d5a3d;
}

.fpp-facet-count {
    font-size: 11px;
    background: rgba(0,0,0,0.1);
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 2px;
}

.fpp-facet-active .fpp-facet-count {
    background: rgba(255,255,255,0.25);
}

/* Results */
.fpp-search-results {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 0;
}

.fpp-search-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.1s;
    gap: 12px;
    border-left: 3px solid transparent;
}

.fpp-search-item:hover,
.fpp-search-selected {
    background: #f0ebe3;
    border-left-color: #7b2d26;
}

.fpp-search-item-main {
    flex: 1;
    min-width: 0;
}

.fpp-search-item-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.fpp-search-type {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.fpp-search-year {
    font-size: 12px;
    color: #8a7e6e;
    font-variant-numeric: tabular-nums;
}

.fpp-search-item-title {
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.fpp-search-item-title mark {
    background: rgba(123, 45, 38, 0.15);
    color: #7b2d26;
    padding: 0 1px;
    border-radius: 2px;
}

.fpp-search-item-snippet {
    font-size: 13px;
    color: #6b5d4d;
    line-height: 1.5;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.fpp-search-item-snippet mark {
    background: rgba(123, 45, 38, 0.12);
    color: #5a2520;
    padding: 0 1px;
    border-radius: 2px;
}

.fpp-search-item-arrow {
    flex-shrink: 0;
    color: #c8bfb0;
    font-size: 16px;
    transition: transform 0.15s;
}

.fpp-search-item:hover .fpp-search-item-arrow,
.fpp-search-selected .fpp-search-item-arrow {
    color: #7b2d26;
    transform: translateX(3px);
}

/* Empty state */
.fpp-search-empty {
    text-align: center;
    padding: 48px 20px;
    color: #8a7e6e;
}

.fpp-search-empty-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

.fpp-search-empty p {
    margin: 4px 0;
    font-size: 15px;
}

.fpp-search-empty-hint {
    font-size: 13px !important;
    color: #a09888;
}

/* Welcome state */
.fpp-search-welcome {
    text-align: center;
    padding: 48px 20px;
}

.fpp-search-welcome-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.fpp-search-welcome-title {
    font-size: 18px;
    font-weight: 600;
    color: #2d2a24;
    margin: 0 0 6px;
}

.fpp-search-welcome-sub {
    font-size: 14px;
    color: #8a7e6e;
    margin: 0 0 20px;
}

.fpp-search-shortcuts {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.fpp-search-shortcut-item {
    font-size: 13px;
    color: #a09888;
}

.fpp-search-shortcut-item kbd {
    display: inline-block;
    padding: 2px 7px;
    font-size: 11px;
    font-family: inherit;
    background: #eee9e0;
    border: 1px solid #ddd6ca;
    border-radius: 4px;
    margin: 0 2px;
}

/* Recent searches */
.fpp-search-recent-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #a09888;
    padding: 12px 20px 6px;
}

.fpp-search-recent-icon {
    flex-shrink: 0;
    font-size: 14px;
}

.fpp-search-recent-item .fpp-search-item-title {
    font-weight: 400;
    font-size: 14px;
}

/* Status bar */
.fpp-search-status {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    font-size: 12px;
    color: #8a7e6e;
    border-top: 1px solid #e8e4de;
    background: #f5f2ec;
}

.fpp-search-stat {
    font-variant-numeric: tabular-nums;
}

.fpp-search-keys {
    display: flex;
    gap: 8px;
    align-items: center;
}

.fpp-search-keys kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 10px;
    font-family: inherit;
    background: #eee9e0;
    border: 1px solid #ddd6ca;
    border-radius: 3px;
}

.fpp-search-hint {
    color: #a09888;
}

/* ── Mobile ── */
@media (max-width: 768px) {
    .fpp-search-overlay {
        padding-top: 0;
        align-items: stretch;
    }

    .fpp-search-palette {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }

    .fpp-search-input {
        font-size: 18px;
    }

    .fpp-search-facets {
        padding: 8px 12px;
    }

    .fpp-facet-btn {
        padding: 8px 14px;
        font-size: 14px;
    }

    .fpp-search-item {
        padding: 14px 16px;
        min-height: 52px;
    }

    .fpp-search-item-title {
        font-size: 16px;
    }

    .fpp-search-keys {
        display: none;
    }

    .fpp-search-results {
        flex: 1;
        -webkit-overflow-scrolling: touch;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .fpp-search-overlay,
    .fpp-search-palette,
    .fpp-search-item,
    .fpp-search-item-arrow {
        transition: none !important;
    }
}
