/* ================================================
   ROTAR – Buscador Público Fichas PDF | v3.2
   Con menú lateral de categorías
   ================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

.rbf-wrap * { box-sizing: border-box; font-family: 'Inter', sans-serif; }

/* ---- Ancho completo: escapa del contenedor de WordPress ---- */
.rbf-wrap {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    padding: 0 32px 48px;
    background: #f8f9fb;
    min-height: 100vh;
}

/* ---- Login screen ---- */
.rbf-login-screen {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}
.rbf-login-box {
    background: #fff;
    border-radius: 20px;
    padding: 48px 40px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.12);
    border: 1px solid #f3f4f6;
}
.rbf-login-icon { font-size: 48px; margin-bottom: 16px; }
.rbf-login-title { font-size: 22px; font-weight: 800; color: #1f2937; margin: 0 0 8px; }
.rbf-login-sub   { font-size: 14px; color: #6b7280; margin: 0 0 24px; }
.rbf-login-field { display: flex; gap: 10px; margin-bottom: 12px; }
.rbf-login-field input {
    flex: 1; padding: 12px 16px; border: 1.5px solid #e5e7eb;
    border-radius: 10px; font-size: 15px; outline: none; transition: border-color 0.2s;
}
.rbf-login-field input:focus { border-color: #C8102E; }
.rbf-btn-login {
    padding: 12px 20px;
    background: linear-gradient(135deg, #C8102E, #e8334a);
    color: #fff; border: none; border-radius: 10px;
    font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap;
    transition: transform 0.2s, box-shadow 0.2s;
}
.rbf-btn-login:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(200,16,46,0.3); }
.rbf-login-error { color: #C8102E; font-size: 13px; font-weight: 500; margin: 0; }

/* ---- Header ---- */
.rbf-header {
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
    border-radius: 0 0 18px 18px;
    padding: 28px 36px;
    margin-bottom: 28px;
    margin-top: 0;
}
.rbf-logo { max-height: 60px; max-width: 160px; object-fit: contain; }
.rbf-header-text h1 { font-size: 22px; font-weight: 800; color: #fff; margin: 0 0 6px; }
.rbf-header-text p { font-size: 14px; color: rgba(255,255,255,0.6); margin: 0; }

/* ---- Layout: sidebar + content ---- */
.rbf-body {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* ---- Sidebar ---- */
.rbf-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    overflow: hidden;
    position: sticky;
    top: 80px;
}
.rbf-sidebar-title {
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 16px 16px 10px;
    border-bottom: 1px solid #f3f4f6;
}
.rbf-cat-menu {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}
.rbf-cat-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
    user-select: none;
}
.rbf-cat-menu-item:hover {
    background: rgba(200,16,46,0.04);
    color: #C8102E;
    border-left-color: rgba(200,16,46,0.3);
}
.rbf-cat-menu-item.active {
    background: rgba(200,16,46,0.07);
    color: #C8102E;
    font-weight: 700;
    border-left-color: #C8102E;
}
.rbf-cat-menu-icon { font-size: 15px; flex-shrink: 0; }
.rbf-cat-menu-label { flex: 1; line-height: 1.3; }
.rbf-cat-menu-count {
    background: #f3f4f6;
    color: #9ca3af;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    flex-shrink: 0;
}
.rbf-cat-menu-item.active .rbf-cat-menu-count {
    background: rgba(200,16,46,0.12);
    color: #C8102E;
}

/* ---- Content area ---- */
.rbf-content { flex: 1; min-width: 0; }

/* ---- Search bar ---- */
.rbf-search-bar { margin-bottom: 20px; }
.rbf-search-wrap {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 6px 14px;
    gap: 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.rbf-search-wrap:focus-within {
    border-color: #C8102E;
    box-shadow: 0 4px 16px rgba(200,16,46,0.1);
}
.rbf-search-icon { font-size: 18px; flex-shrink: 0; }
#rbf-search-input {
    flex: 1; border: none; outline: none;
    font-size: 15px; font-weight: 500; color: #1f2937;
    padding: 9px 0; background: transparent;
}
#rbf-search-input::placeholder { color: #9ca3af; font-weight: 400; }
.rbf-btn-clear-search {
    background: none; border: none; font-size: 16px; color: #9ca3af;
    cursor: pointer; padding: 4px 6px; border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.rbf-btn-clear-search:hover { color: #C8102E; background: rgba(200,16,46,0.06); }

.rbf-active-cat {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 8px;
    padding-left: 4px;
}
.rbf-active-cat strong { color: #C8102E; }

/* ---- States ---- */
.rbf-state { text-align: center; padding: 60px 20px; color: #6b7280; font-size: 15px; }
.rbf-idle-icon { font-size: 48px; margin-bottom: 12px; }
.rbf-state p { margin: 0; line-height: 1.5; }
.rbf-state strong { color: #1f2937; }

.rbf-spinner {
    width: 40px; height: 40px;
    border: 4px solid #f3f4f6; border-top-color: #C8102E;
    border-radius: 50%; animation: rbf-spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes rbf-spin { to { transform: rotate(360deg); } }

/* ---- Results ---- */
.rbf-results { padding-bottom: 80px; }
.rbf-results-count { font-size: 12px; color: #6b7280; font-weight: 500; margin-bottom: 14px; }
.rbf-results-count strong { color: #C8102E; }

.rbf-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

/* ---- Product card ---- */
.rbf-card {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
}
.rbf-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.1);
    border-color: #C8102E;
}
.rbf-card-img {
    width: 100%; height: 150px;
    object-fit: contain; background: #f9fafb;
    padding: 10px; border-bottom: 1px solid #f3f4f6;
}
.rbf-card-img-placeholder {
    width: 100%; height: 150px;
    background: linear-gradient(135deg, #f9fafb, #f3f4f6);
    display: flex; align-items: center; justify-content: center;
    font-size: 44px; border-bottom: 1px solid #f3f4f6;
}
.rbf-card-body { padding: 14px; flex: 1; display: flex; flex-direction: column; }
.rbf-card-cat { font-size: 10px; font-weight: 700; color: #C8102E; text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: 5px; }
.rbf-card-name { font-size: 13px; font-weight: 700; color: #1f2937; line-height: 1.35; margin-bottom: 16px; flex: 1; }
.rbf-card-sku { font-size: 11px; color: #9ca3af; font-weight: 500; margin-bottom: 12px; font-family: monospace; }
.rbf-card-sku span { color: #6b7280; font-weight: 600; }

.rbf-btn-download {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    width: 100%; padding: 11px 14px;
    background: linear-gradient(135deg, #C8102E, #e8334a);
    color: #fff !important;
    border: none; border-radius: 9px;
    font-size: 14px; font-weight: 700;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 3px 10px rgba(200,16,46,0.22);
}
.rbf-btn-download:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(200,16,46,0.32);
    color: #fff !important;
    text-decoration: none !important;
}
.rbf-btn-download-icon { font-size: 14px; }

/* ---- Paginador (siempre al fondo) ---- */
.rbf-paginator {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 24px;
    flex-wrap: wrap;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
.rbf-page-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}
.rbf-page-btn:hover:not([disabled]) {
    border-color: #C8102E;
    color: #C8102E;
    background: rgba(200,16,46,0.04);
}
.rbf-page-btn.active {
    background: linear-gradient(135deg, #C8102E, #e8334a);
    color: #fff;
    border-color: #C8102E;
    box-shadow: 0 3px 10px rgba(200,16,46,0.3);
}
.rbf-page-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
}
.rbf-page-prev, .rbf-page-next {
    padding: 0 16px;
    font-size: 13px;
}
.rbf-page-ellipsis {
    font-size: 16px;
    color: #9ca3af;
    padding: 0 4px;
    line-height: 38px;
}

/* ---- Modal de Vista Previa ---- */
.rbf-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.rbf-modal-box {
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 860px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 32px 80px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: rbf-modal-in 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes rbf-modal-in {
    from { opacity: 0; transform: scale(0.92) translateY(16px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Header del modal */
.rbf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0;
    gap: 16px;
}
.rbf-modal-info {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.rbf-modal-thumb {
    width: 52px; height: 52px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    padding: 4px;
    flex-shrink: 0;
}
.rbf-modal-thumb-placeholder {
    width: 52px; height: 52px;
    background: #f3f4f6;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; flex-shrink: 0;
}
.rbf-modal-cat {
    font-size: 10px; font-weight: 700;
    color: #C8102E; text-transform: uppercase;
    letter-spacing: 0.7px; margin-bottom: 3px;
}
.rbf-modal-name {
    font-size: 15px; font-weight: 700;
    color: #1f2937; line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 560px;
}
.rbf-modal-close {
    width: 36px; height: 36px;
    border: none; background: #f3f4f6;
    border-radius: 50%; font-size: 18px;
    cursor: pointer; color: #6b7280;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; flex-shrink: 0;
    font-family: 'Inter', sans-serif;
}
.rbf-modal-close:hover { background: #C8102E; color: #fff; }

/* Cuerpo: iframe PDF */
.rbf-modal-body {
    flex: 1;
    position: relative;
    background: #f1f5f9;
    min-height: 520px;
}
.rbf-modal-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 14px;
    gap: 4px;
    background: #f1f5f9;
    z-index: 1;
}
.rbf-preview-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 2;
}
.rbf-modal-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: #f8f9fb;
    color: #6b7280;
    font-size: 14px;
    z-index: 3;
}

/* Footer: botones acción */
.rbf-modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #f3f4f6;
    flex-shrink: 0;
    justify-content: flex-end;
}
.rbf-modal-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 22px; border-radius: 10px;
    font-size: 14px; font-weight: 700;
    cursor: pointer; transition: all 0.18s;
    text-decoration: none !important;
    border: none; font-family: 'Inter', sans-serif;
}
.rbf-modal-btn-download {
    background: linear-gradient(135deg, #C8102E, #e8334a);
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(200,16,46,0.28);
}
.rbf-modal-btn-download:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(200,16,46,0.38);
    color: #fff !important;
}
.rbf-modal-btn-print {
    background: #f3f4f6;
    color: #374151;
}
.rbf-modal-btn-print:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

/* ---- Responsive ---- */
@media (max-width: 1100px) {
    .rbf-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 768px) {
    .rbf-body { flex-direction: column; }
    .rbf-sidebar {
        width: 100%;
        position: static;
    }
    .rbf-cat-menu {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        padding: 10px;
    }
    .rbf-cat-menu-item {
        border-left: none;
        border-radius: 8px;
        border: 1.5px solid #e5e7eb;
        padding: 6px 12px;
        font-size: 12px;
        flex-shrink: 0;
    }
    .rbf-cat-menu-item.active { border-color: #C8102E; }
    .rbf-header { flex-direction: column; text-align: center; padding: 22px 18px; }
    .rbf-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}
@media (max-width: 480px) {
    .rbf-grid { grid-template-columns: repeat(2, 1fr); }
}
