/* ==========================================================================
   OrderCity — Chat interno entre paineis (Admin <-> Lojista)
   Botao no cabecalho (ao lado esquerdo do usuario) + painel lateral.
   ========================================================================== */

/* ---- Botao no cabecalho ---- */
.occhat-fab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-right: 12px;
  border: 1px solid var(--border, #DFE6E9);
  border-radius: 50%;
  background: var(--surface, #fff);
  color: var(--primary, #6C5CE7);
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.occhat-fab:hover {
  background: var(--primary-soft, #EDE9FE);
  border-color: var(--primary, #6C5CE7);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}
.occhat-fab-ico { display: inline-flex; }
.occhat-fab .oc-ico { width: 20px; height: 20px; }
.occhat-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger, #E74C3C);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  line-height: 19px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}

/* ---- Painel lateral ---- */
.occhat-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 20, 26, .38);
  z-index: 3990;
  animation: occhatFade .16s ease;
}
@keyframes occhatFade { from { opacity: 0; } to { opacity: 1; } }

.occhat-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  background: var(--surface, #fff);
  box-shadow: -8px 0 32px rgba(14, 20, 26, .16);
  z-index: 4000;
  transform: translateX(104%);
  transition: transform .26s cubic-bezier(.22, .61, .36, 1);
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
.occhat-panel.is-open { transform: translateX(0); }

.occhat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 14px 14px 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary, #6C5CE7), var(--primary-dark, #5B4BD6));
  flex-shrink: 0;
}
.occhat-head-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.occhat-title {
  font-family: Sora, Inter, sans-serif;
  font-size: .98rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.occhat-sub { font-size: .73rem; opacity: .85; }
.occhat-ico-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s ease;
}
.occhat-ico-btn:hover { background: rgba(255, 255, 255, .26); }

.occhat-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* Lista de conversas (admin) */
.occhat-threads {
  max-height: 38%;
  overflow-y: auto;
  border-bottom: 1px solid var(--border, #DFE6E9);
  background: var(--light, #F8F9FA);
  flex-shrink: 0;
}
.occhat-threads-title {
  padding: 9px 16px 5px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gray, #95A5A6);
}
.occhat-thread {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}
.occhat-thread:hover { background: rgba(108, 92, 231, .07); }
.occhat-thread.is-active { background: var(--primary-soft, #EDE9FE); }
.occhat-thread-av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary, #6C5CE7);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  flex-shrink: 0;
}
.occhat-thread-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.occhat-thread-name {
  font-size: .84rem;
  font-weight: 600;
  color: var(--text, #2D3436);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.occhat-thread-prev {
  font-size: .74rem;
  color: var(--gray, #95A5A6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.occhat-thread-badge {
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger, #E74C3C);
  color: #fff;
  font-size: .66rem;
  font-weight: 700;
  line-height: 19px;
  text-align: center;
  flex-shrink: 0;
}

/* Mensagens */
.occhat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--light, #F8F9FA);
}
.occhat-day {
  align-self: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: #E9EDF0;
  color: var(--gray, #95A5A6);
  font-size: .68rem;
  font-weight: 600;
}
.occhat-row { display: flex; align-items: flex-end; gap: 7px; }
.occhat-row.mine { justify-content: flex-end; }
.occhat-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary, #6C5CE7);
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  flex-shrink: 0;
}
.occhat-bubble {
  position: relative;
  max-width: 78%;
  padding: 8px 11px 6px;
  border-radius: 12px 12px 12px 4px;
  background: #fff;
  border: 1px solid var(--border, #DFE6E9);
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 1px 2px rgba(14, 20, 26, .04);
}
.occhat-row.mine .occhat-bubble {
  border-radius: 12px 12px 4px 12px;
  background: var(--primary, #6C5CE7);
  border-color: var(--primary, #6C5CE7);
  color: #fff;
}
.occhat-who { font-size: .68rem; font-weight: 700; color: var(--primary, #6C5CE7); }
.occhat-text { font-size: .855rem; line-height: 1.4; word-break: break-word; }
.occhat-time { font-size: .64rem; opacity: .6; align-self: flex-end; }
.occhat-row.mine .occhat-time { opacity: .8; }

.occhat-empty {
  margin: auto;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  color: var(--gray, #95A5A6);
  font-size: .82rem;
}
.occhat-empty strong { color: var(--text, #2D3436); font-size: .9rem; }
.occhat-empty-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary-soft, #EDE9FE);
  color: var(--primary, #6C5CE7);
  margin-bottom: 4px;
}
.occhat-empty-ico .oc-ico { width: 26px; height: 26px; }

/* Caixa de envio */
.occhat-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border, #DFE6E9);
  background: var(--surface, #fff);
  flex-shrink: 0;
}
.occhat-compose[hidden] { display: none; }
.occhat-compose textarea {
  flex: 1;
  min-height: 38px;
  max-height: 120px;
  padding: 9px 12px;
  border: 1px solid var(--border, #DFE6E9);
  border-radius: 10px;
  font-family: inherit;
  font-size: .86rem;
  line-height: 1.35;
  resize: none;
  outline: none;
  color: var(--text, #2D3436);
  background: var(--light, #F8F9FA);
}
.occhat-compose textarea:focus { border-color: var(--primary, #6C5CE7); background: #fff; }
.occhat-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--primary, #6C5CE7);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s ease, transform .15s ease;
}
.occhat-send:hover { background: var(--primary-dark, #5B4BD6); transform: scale(1.05); }

body.occhat-lock { overflow: hidden; }

@media (max-width: 520px) {
  .occhat-panel { width: 100vw; }
  .occhat-fab { width: 38px; height: 38px; margin-right: 8px; }
}
