/* ============================================================
   Ronin Global Search — style.css
   ============================================================ */

/* ── Contenedor del widget ─────────────────────────────────── */
.rgs-widget {
    width: 100%;
}

/* ── Formulario base ───────────────────────────────────────── */
.rgs-form {
    display: flex;
    flex-direction: row;   /* Elementor sobreescribe con inline style */
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    width: 100%;
}

/* ── Fila de input + botón: crece para ocupar espacio libre ── */
.rgs-search-row {
    display: flex;
    flex: 1 1 200px;
    align-items: stretch;
    gap: 0;
    min-width: 200px;
}

/* ── Input de búsqueda ─────────────────────────────────────── */
.rgs-search-input {
    flex: 1 1 auto;
    padding: 10px 14px;
    font-size: 1rem;
    line-height: 1.5;
    border: 1px solid #ccc;
    border-radius: 4px 0 0 4px;
    background-color: #fff;
    color: #333;
    outline: none;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.rgs-search-input:focus {
    border-color: #0073aa;
}

.rgs-search-input::placeholder {
    color: #999;
}

/* Sin botón: border-radius completo */
.rgs-form:not(:has(.rgs-search-btn)) .rgs-search-input {
    border-radius: 4px;
}

/* ── Botón submit ──────────────────────────────────────────── */
.rgs-search-btn {
    flex: 0 0 auto;
    padding: 10px 20px;
    font-size: 1rem;
    line-height: 1.5;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 0 4px 4px 0;
    background-color: #0073aa;
    color: #fff;
    transition: background-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.rgs-search-btn:hover {
    background-color: #005a87;
}

/* ── Selector de post type ─────────────────────────────────── */
.rgs-field-post-type {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 0 0 auto;
}

.rgs-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* ── Custom checkbox ───────────────────────────────────────── */
.rgs-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
}

/* Ocultar el checkbox nativo */
.rgs-pt-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Caja visual del checkbox */
.rgs-checkbox-custom {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border: 2px solid #aaa;
    border-radius: 3px;
    background-color: #fff;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    position: relative;
}

/* Checkmark */
.rgs-checkbox-custom::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translateY(-1px);
    opacity: 0;
    transition: opacity 0.1s ease;
}

/* Estado marcado */
.rgs-pt-checkbox:checked + .rgs-checkbox-custom {
    background-color: #0073aa;
    border-color: #0073aa;
}

.rgs-pt-checkbox:checked + .rgs-checkbox-custom::after {
    opacity: 1;
}

/* Focus accesible */
.rgs-pt-checkbox:focus-visible + .rgs-checkbox-custom {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.rgs-checkbox-label:hover .rgs-checkbox-custom {
    border-color: #0073aa;
}

/* ── Filtros de taxonomía ──────────────────────────────────── */
.rgs-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    flex: 0 0 auto;   /* NO width:100% — en horizontal fluye en fila */
}

.rgs-filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 130px;
    width:100%;
}

.rgs-filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    display: block;
}

.rgs-filter-select {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.9rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    color: #333;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

.rgs-filter-select:focus {
    border-color: #0073aa;
}

/* ── Modo vertical ─────────────────────────────────────────── */
.rgs-form.rgs-direction-column {
    flex-direction: column;
    align-items: stretch;
}

.rgs-form.rgs-direction-column .rgs-search-row,
.rgs-form.rgs-direction-column .rgs-filters,
.rgs-form.rgs-direction-column .rgs-field-post-type {
    width: 100%;
    flex: none;
}

/* ── Responsive ────────────────────────────────────────────── */
@media ( max-width: 600px ) {
    .rgs-form {
        flex-direction: column !important;
        align-items: stretch;
    }

    .rgs-search-row,
    .rgs-filters,
    .rgs-field-post-type {
        width: 100%;
        flex: none;
    }

    .rgs-filter-item {
        flex: 1 1 100%;
    }
}

/* ============================================================
   Live Search Dropdown
   ============================================================ */

/* ── Wrapper del input: necesario para posicionar el dropdown ─ */
.rgs-search-row {
    position: relative;
}

/* ── Dropdown ──────────────────────────────────────────────── */
.rgs-live-dropdown {
    position: absolute;
    top: calc( 100% + 4px );
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    max-height: 400px;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 0;
}

.rgs-live-dropdown[hidden] {
    display: none;
}

/* ── Ítem ──────────────────────────────────────────────────── */
.rgs-live-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.rgs-live-item:last-child {
    border-bottom: none;
}

.rgs-live-item:hover,
.rgs-live-item.rgs-live-active {
    background-color: #f5f5f5;
}

/* ── Thumbnail ─────────────────────────────────────────────── */
.rgs-live-thumb {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 4px;
    overflow: hidden;
    background: #eee;
}

.rgs-live-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rgs-live-thumb-placeholder {
    background-color: #e8e8e8;
}

/* ── Meta (título + post type) ─────────────────────────────── */
.rgs-live-meta {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.rgs-live-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.rgs-live-posttype {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: block;
}

/* ── Sin resultados ────────────────────────────────────────── */
.rgs-live-no-results {
    padding: 14px;
    color: #999;
    font-size: 0.9rem;
    text-align: center;
}

/* ── Loading (3 dots) ──────────────────────────────────────── */
.rgs-live-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 16px;
}

.rgs-live-loading span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #aaa;
    animation: rgs-bounce 1s infinite ease-in-out;
}

.rgs-live-loading span:nth-child(1) { animation-delay: 0s; }
.rgs-live-loading span:nth-child(2) { animation-delay: 0.15s; }
.rgs-live-loading span:nth-child(3) { animation-delay: 0.30s; }

@keyframes rgs-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%           { transform: scale(1);   opacity: 1; }
}
