/* ExpandBar - right bottom collapsible quick actions (match site UI) */

:root{
  --xbar-primary: var(--primary, #3b82f6);
  --xbar-primary-hover: var(--primary-hover, #2563eb);
  --xbar-card: var(--card, #ffffff);
  --xbar-border: var(--border, #e5e7eb);
  --xbar-shadow: var(--shadow, 0 10px 30px rgba(0,0,0,.08));
  --xbar-radius: calc(var(--radius, 8px) + 6px);
  --xbar-text: var(--text, #111827);
  --xbar-muted: var(--muted, #6b7280);
}

.rw-xbar{
  position: fixed;
  right: 14px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 9999;
  font-size: 14px;
}

@media (max-width: 640px){
  .rw-xbar{
    right: 12px;
    bottom: calc(86px + env(safe-area-inset-bottom));
  }
}

.rw-xbar-toggle{
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--xbar-border);
  background: var(--xbar-card);
  color: var(--xbar-primary);
  box-shadow: var(--xbar-shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.rw-xbar-toggle:hover{
  border-color: rgba(59,130,246,.35);
  box-shadow: 0 12px 28px rgba(0,0,0,.10);
}

.rw-xbar-toggle:active{ transform: translateY(1px); }

.rw-xbar-toggle-ico{
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.rw-xbar-toggle svg{
  width: 20px;
  height: 20px;
  position: absolute;
  inset: 0;
  transition: opacity .16s ease, transform .16s ease;
}

.rw-xbar-ico-close{ opacity: 0; transform: scale(.92) rotate(-10deg); }

.rw-xbar[data-open="1"] .rw-xbar-ico-grid{ opacity: 0; transform: scale(.92) rotate(10deg); }
.rw-xbar[data-open="1"] .rw-xbar-ico-close{ opacity: 1; transform: scale(1) rotate(0); }

.rw-xbar-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,.20);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  backdrop-filter: blur(4px);
  z-index: 9998;
}

.rw-xbar-panel{
  position: fixed;
  right: 14px;
  bottom: calc(64px + env(safe-area-inset-bottom));
  width: min(280px, calc(100vw - 24px));
  background: var(--xbar-card);
  border: 1px solid var(--xbar-border);
  border-radius: var(--xbar-radius);
  box-shadow: var(--xbar-shadow);
  overflow: hidden;
  transform: translateY(8px) scale(.98);
  opacity: 0;
  pointer-events: none;
  transition: transform .18s ease, opacity .18s ease;
  z-index: 9999;
}

@media (max-width: 640px){
  .rw-xbar-panel{
    right: 12px;
    bottom: calc(136px + env(safe-area-inset-bottom));
  }
}

.rw-xbar-panel-head{
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--xbar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rw-xbar-title{
  font-weight: 800;
  color: var(--xbar-text);
  font-size: 13px;
  letter-spacing: .2px;
}

.rw-xbar-close{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--xbar-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rw-xbar-close:hover{
  background: rgba(59,130,246,.10);
  color: var(--xbar-primary);
}

.rw-xbar-items{
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rw-xbar-item{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--xbar-text);
  border: 1px solid transparent;
  background: transparent;
}

.rw-xbar-item:hover{
  background: rgba(59,130,246,.08);
  border-color: rgba(59,130,246,.18);
}

.rw-xbar-ico{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(59,130,246,.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--xbar-primary);
  flex: 0 0 auto;
}

.rw-xbar-label{
  font-weight: 700;
  font-size: 13px;
  flex: 1;
}

.rw-xbar-badge{
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(239,68,68,.12);
  color: #ef4444;
  border: 1px solid rgba(239,68,68,.22);
}

.rw-xbar[data-open="1"] .rw-xbar-backdrop{
  opacity: 1;
  pointer-events: auto;
}

.rw-xbar[data-open="1"] .rw-xbar-panel{
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

html[data-theme="dark"] .rw-xbar-backdrop{ background: rgba(0,0,0,.35); }
html[data-theme="dark"] .rw-xbar-item:hover{ background: rgba(59,130,246,.12); }
html[data-theme="dark"] .rw-xbar-ico{ background: rgba(59,130,246,.16); }
