/* CLEMiC WhatsApp Widget */
#cwap-root {
  position: fixed;
  bottom: 90px; /* por encima del reproductor de radio */
  right: 20px;
  z-index: 999998;
  font-family: -apple-system, 'Helvetica Neue', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

/* ── Botón flotante ── */
.cwap-fab {
  width: 60px; height: 60px;
  border-radius: 50%; border: none;
  background: #25D366;
  box-shadow: 0 4px 20px rgba(37,211,102,.5);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: transform .2s, box-shadow .2s;
  flex-shrink: 0;
}
.cwap-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(37,211,102,.65);
}
.cwap-fab:active { transform: scale(.95); }

/* Íconos del FAB — alternar entre WA y ✕ */
.cwap-fab-icon {
  position: absolute;
  transition: opacity .2s, transform .2s;
  line-height: 1; display: flex; align-items: center; justify-content: center;
}
.cwap-fab-icon--wa   { opacity: 1;  transform: rotate(0deg) scale(1); }
.cwap-fab-icon--close {
  opacity: 0; transform: rotate(-90deg) scale(.6);
  color: #fff; font-size: 1.4rem; font-weight: 700;
}
.cwap-open .cwap-fab-icon--wa    { opacity: 0;  transform: rotate(90deg) scale(.6); }
.cwap-open .cwap-fab-icon--close { opacity: 1;  transform: rotate(0deg) scale(1); }

/* Pulso animado */
.cwap-pulse {
  position: absolute; inset: -4px;
  border-radius: 50%;
  background: rgba(37,211,102,.35);
  animation: cwap-pulse 2.2s ease-out infinite;
  pointer-events: none;
}
.cwap-open .cwap-pulse { display: none; }
@keyframes cwap-pulse {
  0%   { transform: scale(1);   opacity: .7; }
  70%  { transform: scale(1.45); opacity: 0; }
  100% { transform: scale(1.45); opacity: 0; }
}

/* ── Menú ── */
.cwap-menu {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.08);
  width: 320px;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(.85) translateY(10px);
  opacity: 0;
  pointer-events: none;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s ease;
}
.cwap-open .cwap-menu {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Header */
.cwap-header {
  background: #075E54;
  padding: 16px 14px;
  display: flex; align-items: center; gap: 10px;
}
.cwap-header-icon {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cwap-header-text { flex: 1; min-width: 0; }
.cwap-header-title {
  font-size: .95rem; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cwap-header-sub { font-size: .72rem; color: rgba(255,255,255,.7); margin-top: 1px; }
.cwap-close {
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.15); color: #fff;
  font-size: .9rem; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.cwap-close:hover { background: rgba(255,255,255,.3); }

/* Lista de contactos */
.cwap-list {
  padding: 8px 0;
  max-height: 380px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: #ddd transparent;
}
.cwap-list::-webkit-scrollbar { width: 4px; }
.cwap-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

.cwap-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px;
  text-decoration: none;
  transition: background .15s;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
}
.cwap-item:last-child { border-bottom: none; }
.cwap-item:hover { background: #f0fdf4; }

.cwap-item-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 1.1rem;
  background: #e8f5e9;
}
.cwap-item--wa   .cwap-item-icon { background: #25D366; }
.cwap-item--channel .cwap-item-icon { background: #128C7E; }

.cwap-item-body { flex: 1; min-width: 0; }
.cwap-item-label {
  font-size: .85rem; font-weight: 700; color: #111;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block;
}
.cwap-item-num {
  font-size: .75rem; color: #666; margin-top: 1px;
  display: block;
}

.cwap-wa-badge {
  font-size: .62rem; font-weight: 700; letter-spacing: .5px;
  background: #dcf8c6; color: #075E54;
  padding: 2px 7px; border-radius: 20px; flex-shrink: 0;
}
.cwap-wa-badge--channel { background: #128C7E; color: #fff; }
.cwap-wa-badge--call    { background: #1565C0; color: #fff; }

/* Ítem de llamada (0800) */
.cwap-item--call { background: #f0f7ff; }
.cwap-item--call:hover { background: #dbeafe; }
.cwap-item-icon--call { background: #1565C0 !important; }

/* Footer */
.cwap-footer {
  text-align: center; padding: 10px;
  font-size: .7rem; color: #aaa;
  background: #fafafa; border-top: 1px solid #f0f0f0;
}

/* Mobile adjustments */
@media (max-width: 400px) {
  .cwap-menu { width: calc(100vw - 24px); }
  #cwap-root { right: 12px; bottom: 82px; }
}
