/**
 * WP Static Architect - Estilos del Buscador Estático Instantáneo
 * Glassmorphism responsivo con soporte automático para modo oscuro y claro
 * Desarrollado por Xavier Cabello (juan.cabellosalirrosas.com)
 */

/* Botón Flotante Disparador */
.wpsa-search-trigger-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99990;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 10px 16px;
    border-radius: 9999px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(8px);
}

.wpsa-search-trigger-btn:hover {
    background: #1e293b;
    transform: translateY(-2px);
    box-shadow: 0 14px 28px -4px rgba(79, 70, 229, 0.35);
    border-color: #6366f1;
}

.wpsa-search-icon {
    display: flex;
    align-items: center;
    color: #38bdf8;
}

.wpsa-search-kbd {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #cbd5e1;
    font-size: 11px;
    font-family: inherit;
    padding: 2px 6px;
    border-radius: 6px;
    margin-left: 4px;
}

/* Modal Backdrop */
.wpsa-search-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 80px 20px 20px 20px;
    animation: wpsa-fade-in 0.2s ease;
}

@keyframes wpsa-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.wpsa-search-container {
    width: 100%;
    max-width: 620px;
}

.wpsa-search-box {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: wpsa-slide-down 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

@keyframes wpsa-slide-down {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Input Wrapper */
.wpsa-search-input-wrapper {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    gap: 12px;
}

.wpsa-search-input-icon {
    display: flex;
    align-items: center;
    color: #6366f1;
}

.wpsa-search-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    font-size: 16px !important;
    color: #0f172a !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.wpsa-search-input::placeholder {
    color: #94a3b8;
}

.wpsa-search-clear-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.wpsa-search-clear-btn:hover {
    color: #0f172a;
}

.wpsa-search-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.wpsa-search-close-btn kbd {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #64748b;
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 6px;
    font-weight: 600;
}

/* Resultados */
.wpsa-search-results {
    max-height: 420px;
    overflow-y: auto;
    padding: 10px;
}

.wpsa-search-empty-state {
    text-align: center;
    padding: 42px 20px;
    color: #64748b;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.wpsa-search-empty-state p {
    margin: 0;
    font-size: 14px;
    max-width: 320px;
    line-height: 1.5;
}

.wpsa-search-item {
    border-radius: 10px;
    transition: background 0.15s ease;
    margin-bottom: 4px;
}

.wpsa-search-item.selected,
.wpsa-search-item:hover {
    background: #f1f5f9;
}

.wpsa-search-item-link {
    display: block;
    padding: 12px 14px;
    text-decoration: none !important;
    color: inherit !important;
}

.wpsa-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.wpsa-item-title {
    font-size: 14.5px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.wpsa-item-badge {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 9999px;
    letter-spacing: 0.3px;
}

.wpsa-item-badge.badge-post {
    background: #eef2ff;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
}

.wpsa-item-badge.badge-page {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.wpsa-item-excerpt {
    font-size: 12.5px;
    color: #64748b;
    margin: 0 0 6px 0;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wpsa-item-url {
    font-size: 11px;
    font-family: monospace;
    color: #94a3b8;
}

/* Highlight */
.wpsa-highlight {
    background: #fef08a;
    color: #854d0e;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 600;
}

/* Footer del Buscador */
.wpsa-search-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 12px;
    color: #64748b;
}

.wpsa-search-tips {
    display: flex;
    gap: 12px;
}

.wpsa-search-tips kbd {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 4px;
}

.wpsa-search-brand {
    font-weight: 600;
    color: #6366f1;
    font-size: 11px;
}

/* ==================== MODO OSCURO (PREFERS-COLOR-SCHEME) ==================== */
@media (prefers-color-scheme: dark) {
    .wpsa-search-box {
        background: #0f172a;
        color: #f8fafc;
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    }

    .wpsa-search-input-wrapper {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }

    .wpsa-search-input {
        color: #f8fafc !important;
    }

    .wpsa-search-input::placeholder {
        color: #64748b;
    }

    .wpsa-search-close-btn kbd {
        background: #1e293b;
        border-color: rgba(255, 255, 255, 0.15);
        color: #94a3b8;
    }

    .wpsa-search-item.selected,
    .wpsa-search-item:hover {
        background: #1e293b;
    }

    .wpsa-item-title {
        color: #f8fafc;
    }

    .wpsa-item-excerpt {
        color: #94a3b8;
    }

    .wpsa-highlight {
        background: #854d0e;
        color: #fef08a;
    }

    .wpsa-search-footer {
        background: #090d16;
        border-top-color: rgba(255, 255, 255, 0.1);
        color: #64748b;
    }

    .wpsa-search-tips kbd {
        background: #1e293b;
        border-color: rgba(255, 255, 255, 0.15);
        color: #cbd5e1;
    }
}
