/* =====================================================
   Ensayando Search — Styles v1.0
   ===================================================== */

:root {
    --rbs-primary: #6366f1;
    --rbs-primary-dark: #4f46e5;
    --rbs-accent: #ef4444;
    --rbs-text: #1e293b;
    --rbs-text-muted: #64748b;
    --rbs-border: #e2e8f0;
    --rbs-bg: #ffffff;
    --rbs-bg-soft: #f8fafc;
    --rbs-radius: 14px;
    --rbs-shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
    --rbs-shadow-hover: 0 8px 30px rgba(0,0,0,.1);
    --rbs-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ====== SEARCH BAR ====== */
.rbs-search { font-family: var(--rbs-font); }

.rbs-search-form {
    display: flex;
    align-items: flex-end;
    gap: 0;
    background: var(--rbs-bg);
    border: 1.5px solid var(--rbs-border);
    border-radius: 60px;
    padding: 6px 6px 6px 24px;
    box-shadow: var(--rbs-shadow);
    transition: box-shadow .25s, border-color .25s;
}
.rbs-search-form:focus-within {
    box-shadow: 0 4px 20px rgba(99,102,241,.15);
    border-color: var(--rbs-primary);
}

.rbs-field {
    display: flex;
    flex-direction: column;
    padding: 8px 16px;
    position: relative;
}
.rbs-field + .rbs-field { border-left: 1.5px solid var(--rbs-border); }

.rbs-field-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--rbs-text-muted);
    margin-bottom: 3px;
    line-height: 1;
}

/* ====== CUSTOM DROPDOWN ====== */
.rbs-dropdown { position: relative; width: 100%; }

.rbs-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    padding: 4px 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: var(--rbs-font);
    font-size: 14px;
    font-weight: 500;
    color: var(--rbs-text);
    text-align: left;
    outline: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rbs-dropdown-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rbs-dropdown-arrow {
    flex-shrink: 0;
    color: #94a3b8;
    transition: transform .25s ease;
}
.rbs-dd-open > .rbs-dropdown-toggle .rbs-dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown menu */
.rbs-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: -16px;
    min-width: 220px;
    max-height: 280px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.05);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all .2s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.rbs-dd-open > .rbs-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Search input inside dropdown */
.rbs-dropdown-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #94a3b8;
    flex-shrink: 0;
}
.rbs-dropdown-search {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13px;
    font-family: var(--rbs-font);
    color: var(--rbs-text);
    background: transparent;
}
.rbs-dropdown-search::placeholder { color: #cbd5e1; }

/* Options list */
.rbs-dropdown-options {
    overflow-y: auto;
    max-height: 220px;
    padding: 6px;
    scroll-behavior: smooth;
}
.rbs-dropdown-options::-webkit-scrollbar { width: 5px; }
.rbs-dropdown-options::-webkit-scrollbar-track { background: transparent; }
.rbs-dropdown-options::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 3px; }
.rbs-dropdown-options::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

.rbs-dropdown-option {
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    transition: all .12s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rbs-dropdown-option:hover {
    background: #f1f5f9;
    color: var(--rbs-primary);
}
.rbs-dropdown-option.rbs-dd-selected {
    background: #eef2ff;
    color: var(--rbs-primary);
    font-weight: 600;
}

/* Remove old native select styles (keep sort select native) */
.rbs-sort {
    appearance: auto;
    -webkit-appearance: auto;
    border: 1.5px solid var(--rbs-border);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--rbs-text);
    font-family: var(--rbs-font);
    cursor: pointer;
}

/* Region & Comuna: fixed widths */
.rbs-field--region { flex: 0 0 auto; }
.rbs-field--region .rbs-dropdown-toggle { width: 160px; }
.rbs-field--comuna { flex: 0 0 auto; }
.rbs-field--comuna .rbs-dropdown-toggle { width: 150px; }
.rbs-field--type { flex: 0 0 auto; }
.rbs-field--type .rbs-dropdown-toggle { width: 200px; }

.rbs-field--submit { padding: 0; border-left: none !important; }
.rbs-btn-search {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--rbs-accent);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    font-family: var(--rbs-font);
    white-space: nowrap;
}
.rbs-btn-search:hover { background: #dc2626; transform: scale(1.03); box-shadow: 0 4px 16px rgba(239,68,68,.4); }
.rbs-btn-search svg { flex-shrink: 0; }

/* Compact style */
.rbs-search--compact .rbs-search-form { border-radius: 16px; padding: 4px 4px 4px 18px; }
.rbs-search--compact .rbs-btn-search { border-radius: 12px; padding: 12px 20px; }

/* Inline style */
.rbs-search--inline .rbs-search-form {
    border-radius: 12px; padding: 4px;
    flex-wrap: wrap;
}
.rbs-search--inline .rbs-field { padding: 6px 12px; }
.rbs-search--inline .rbs-field + .rbs-field { border-left: none; }
.rbs-search--inline .rbs-btn-search { border-radius: 10px; padding: 10px 18px; width: 100%; }

/* ====== ACTIVE FILTERS ====== */
.rbs-filters-active {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    font-family: var(--rbs-font);
}
.rbs-filters-label { font-size: 13px; color: var(--rbs-text-muted); font-weight: 600; }
.rbs-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: #eef2ff;
    color: var(--rbs-primary);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    transition: all .15s;
}
.rbs-filter-pill:hover { background: #e0e7ff; color: var(--rbs-primary-dark) !important; }
.rbs-filter-pill svg { opacity: .6; }
.rbs-filter-clear { font-size: 13px; color: var(--rbs-accent); text-decoration: none !important; font-weight: 500; margin-left: 4px; }
.rbs-filter-clear:hover { text-decoration: underline !important; }

/* ====== RESULTS ====== */
.rbs-results { font-family: var(--rbs-font); margin-top: 24px; }
.rbs-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.rbs-results-count { font-size: 15px; font-weight: 700; color: var(--rbs-text); }
.rbs-sort {
    border: 1.5px solid var(--rbs-border);
    border-radius: 10px;
    padding: 8px 32px 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--rbs-text);
    font-family: var(--rbs-font);
}

/* ====== CARDS GRID ====== */
.rbs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.rbs-card {
    display: flex;
    flex-direction: column;
    background: var(--rbs-bg);
    border: 1.5px solid var(--rbs-border);
    border-radius: var(--rbs-radius);
    overflow: hidden;
    text-decoration: none !important;
    color: var(--rbs-text) !important;
    transition: all .25s cubic-bezier(.4,0,.2,1);
}
.rbs-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--rbs-shadow-hover);
    border-color: #c7d2fe;
}

/* Card image */
.rbs-card-image {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: #f1f5f9;
}
.rbs-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}
.rbs-card:hover .rbs-card-image img { transform: scale(1.05); }
.rbs-card-noimg {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #cbd5e1;
}
.rbs-card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .02em;
    text-transform: uppercase;
}

/* Card body */
.rbs-card-body { padding: 14px 16px 16px; display:flex; flex-direction:column; gap:8px; flex:1; }
.rbs-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--rbs-text);
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rbs-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.rbs-card-location {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    color: var(--rbs-text-muted);
    font-weight: 500;
}
.rbs-card-location svg { color: var(--rbs-accent); flex-shrink:0; }
.rbs-card-type {
    font-size: 11px;
    font-weight: 600;
    color: var(--rbs-primary);
    background: #eef2ff;
    padding: 2px 8px;
    border-radius: 6px;
}

.rbs-card-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}
.rbs-card-price {
    font-size: 20px;
    font-weight: 800;
    color: var(--rbs-text);
    line-height: 1;
}
.rbs-card-price small { font-size: 13px; font-weight: 500; color: var(--rbs-text-muted); }
.rbs-card-quote-label { font-size: 14px; font-weight: 600; color: #f59e0b; }

.rbs-card-details {
    display: flex;
    align-items: center;
    gap: 10px;
}
.rbs-card-musicians, .rbs-card-size {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    font-weight: 600;
    color: var(--rbs-text-muted);
}
.rbs-card-musicians svg { color: var(--rbs-primary); }

/* ====== EMPTY STATE ====== */
.rbs-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--rbs-text-muted);
}
.rbs-empty-icon { margin-bottom: 16px; color: #cbd5e1; }
.rbs-empty h3 { font-size: 20px; color: var(--rbs-text); margin: 0 0 8px; }
.rbs-empty p { font-size: 15px; margin: 0 0 20px; }
.rbs-btn-clear {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    background: var(--rbs-primary);
    color: #fff !important;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none !important;
    transition: all .2s;
}
.rbs-btn-clear:hover { background: var(--rbs-primary-dark); transform: translateY(-1px); }

/* ====== RESPONSIVE ====== */

/* Tablet: stack vertically */
@media (max-width: 900px) {
    .rbs-search-form {
        flex-direction: column;
        border-radius: 18px;
        padding: 12px;
        gap: 0;
        align-items: stretch;
    }
    .rbs-field {
        padding: 10px 4px;
        width: 100%;
    }
    .rbs-field + .rbs-field {
        border-left: none;
        border-top: 1px solid var(--rbs-border);
    }

    /* Dropdowns: full width on tablet */
    .rbs-field--region .rbs-dropdown-toggle,
    .rbs-field--comuna .rbs-dropdown-toggle,
    .rbs-field--type .rbs-dropdown-toggle {
        width: 100%;
    }
    .rbs-dropdown-menu {
        left: 0;
        min-width: 100%;
    }

    .rbs-field--submit { padding: 8px 0 0; }
    .rbs-btn-search { width: 100%; border-radius: 12px; justify-content: center; }
    .rbs-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
}

/* Mobile: stack everything */
@media (max-width: 480px) {
    .rbs-grid { grid-template-columns: 1fr; }
    .rbs-card-price { font-size: 18px; }
    .rbs-results-header { flex-direction: column; align-items: flex-start; }
}

/* ====== ALERTS: Bell + Dropdown ====== */
.rbs-alerts-bell {
    position: relative;
    display: inline-flex;
    font-family: var(--rbs-font);
}
.rbs-bell-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1.5px solid var(--rbs-border);
    border-radius: 50%;
    background: var(--rbs-bg);
    color: #475569;
    cursor: pointer;
    transition: all .2s;
}
.rbs-bell-btn:hover {
    border-color: var(--rbs-primary);
    color: var(--rbs-primary);
    background: #eef2ff;
}
.rbs-alerts-open .rbs-bell-btn {
    border-color: var(--rbs-primary);
    color: var(--rbs-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.rbs-bell-count {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--rbs-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid var(--rbs-bg);
}

/* Dropdown panel */
.rbs-alerts-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 360px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--rbs-bg);
    border: 1px solid var(--rbs-border);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.12), 0 4px 16px rgba(0,0,0,.06);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(.97);
    transition: all .2s cubic-bezier(.4,0,.2,1);
}
.rbs-alerts-open .rbs-alerts-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.rbs-alerts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 16px 16px 0 0;
}
.rbs-alerts-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--rbs-text);
}
.rbs-alerts-count-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--rbs-primary);
    background: #eef2ff;
    padding: 3px 10px;
    border-radius: 12px;
}

/* Alert item (shared between dropdown and inline) */
.rbs-alert-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #f8fafc;
    transition: background .15s;
}
.rbs-alert-item:last-child { border-bottom: none; }
.rbs-alert-item:hover { background: #f8fafc; }

.rbs-alert-icon { flex-shrink: 0; }
.rbs-alert-icon img {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
}
.rbs-alert-icon-default {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: var(--rbs-primary);
}

.rbs-alert-body { flex: 1; min-width: 0; }
.rbs-alert-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--rbs-text);
    line-height: 1.3;
    margin-bottom: 2px;
}
.rbs-alert-desc {
    font-size: 13px;
    color: var(--rbs-text-muted);
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rbs-alert-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--rbs-primary) !important;
    text-decoration: none !important;
}
.rbs-alert-link:hover { text-decoration: underline !important; }

/* Inline style (visible list) */
.rbs-alerts-inline {
    border: 1.5px solid var(--rbs-border);
    border-radius: 14px;
    background: var(--rbs-bg);
    overflow: hidden;
    font-family: var(--rbs-font);
}

/* Alerts responsive */
@media (max-width: 480px) {
    .rbs-alerts-dropdown {
        width: 300px;
        right: -60px;
    }
}

/* ====== COLOR THEMES ====== */

/* WHITE: fondo blanco, texto negro */
.rbs-color-white .rbs-search-form {
    background: #ffffff;
    border-color: #e2e8f0;
}
.rbs-color-white .rbs-btn-search {
    background: #ffffff;
    color: #111827;
    border: 2px solid #111827;
}
.rbs-color-white .rbs-btn-search:hover {
    background: #f1f5f9;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.rbs-color-white .rbs-bell-btn {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #111827;
}
.rbs-color-white .rbs-bell-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}
.rbs-color-white .rbs-bell-count {
    background: #111827;
    color: #fff;
}

/* DARK: fondo negro, texto blanco */
.rbs-color-dark .rbs-search-form {
    background: #111827;
    border-color: #374151;
}
.rbs-color-dark .rbs-field-label {
    color: #9ca3af;
}
.rbs-color-dark .rbs-dropdown-toggle {
    color: #f1f5f9;
}
.rbs-color-dark .rbs-dropdown-arrow {
    color: #6b7280;
}
.rbs-color-dark .rbs-field + .rbs-field {
    border-left-color: #374151;
}
.rbs-color-dark .rbs-btn-search {
    background: #ffffff;
    color: #111827;
}
.rbs-color-dark .rbs-btn-search:hover {
    background: #f1f5f9;
    box-shadow: 0 4px 16px rgba(255,255,255,.15);
}
.rbs-color-dark .rbs-search-form:focus-within {
    border-color: #6366f1;
    box-shadow: 0 4px 20px rgba(99,102,241,.2);
}
.rbs-color-dark .rbs-bell-btn {
    background: #111827;
    border-color: #374151;
    color: #f1f5f9;
}
.rbs-color-dark .rbs-bell-btn:hover {
    background: #1e293b;
    border-color: #4b5563;
}
.rbs-color-dark .rbs-bell-count {
    background: #ffffff;
    color: #111827;
    border-color: #111827;
}

/* Dark responsive overrides */
@media (max-width: 900px) {
    .rbs-color-dark .rbs-field + .rbs-field {
        border-top-color: #374151;
    }
}

/* ====== LOADING STATE ====== */
.rbs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    font-family: var(--rbs-font);
    font-size: 15px;
    font-weight: 500;
    color: var(--rbs-text-muted);
}
.rbs-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--rbs-primary);
    border-radius: 50%;
    animation: rbs-spin .7s linear infinite;
}
@keyframes rbs-spin { to { transform: rotate(360deg); } }

.rbs-results-inner {
    transition: opacity .2s ease;
}

/* ====== FEED ====== */
.rbs-feed {
    font-family: var(--rbs-font);
}
.rbs-feed-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--rbs-text);
    margin: 0 0 18px;
}
.rbs-grid--3 { grid-template-columns: repeat(3, 1fr); }
.rbs-grid--2 { grid-template-columns: repeat(2, 1fr); }
.rbs-grid--4 { grid-template-columns: repeat(4, 1fr); }
.rbs-grid--1 { grid-template-columns: 1fr; }

@media (max-width: 900px) {
    .rbs-grid--3, .rbs-grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .rbs-grid--3, .rbs-grid--4, .rbs-grid--2 { grid-template-columns: 1fr; }
}

/* ====== EMPRESA ====== */
.rbs-card-empresa {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-top: -4px;
}
.rbs-card-empresa svg {
    color: #94a3b8;
    flex-shrink: 0;
}
