/**
 * Multi WhatsApp — Frontend Styles
 */

/* ─── Variables ─────────────────────────────────── */
.mwa-widget {
  --mwa-color: #25d366;
  --mwa-color-hover: #128c7e;
  --mwa-text: #fff;
  --mwa-radius: 30px;
  --mwa-btn-size: 60px;
  --mwa-space: 20px;
  --mwa-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  position: fixed;
  z-index: 9999;
  right: var(--mwa-space);
  bottom: var(--mwa-space);
  font-family: var(--mwa-font);
  font-size: 15px;
  line-height: 1.5;
}

.mwa-widget--left {
  right: auto;
  left: var(--mwa-space);
}

.mwa-widget--dark {
  --mwa-color: #075e54;
  --mwa-color-hover: #054c44;
}

/* ─── Floating Button ──────────────────────────── */
.mwa-btn {
  width: var(--mwa-btn-size);
  height: var(--mwa-btn-size);
  border: none;
  border-radius: 50%;
  background: var(--mwa-color);
  color: var(--mwa-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  transition: transform .3s ease, background .2s, box-shadow .2s;
  position: relative;
  z-index: 2;
}

.mwa-btn:hover {
  background: var(--mwa-color-hover);
  transform: scale(1.06);
  box-shadow: 0 6px 28px rgba(0,0,0,.25);
}

.mwa-btn:active {
  transform: scale(.95);
}

.mwa-btn__icon {
  width: 32px;
  height: 32px;
}

/* ─── Chat Box ─────────────────────────────────── */
.mwa-box {
  position: absolute;
  bottom: calc(var(--mwa-btn-size) + 12px);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 2 * var(--mwa-space));
  max-height: 450px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(20px) scale(.95);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  overflow: hidden;
}

.mwa-widget--left .mwa-box {
  right: auto;
  left: 0;
}

.mwa-widget--open .mwa-box {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ─── Box Header ───────────────────────────────── */
.mwa-box__header {
  display: flex;
  align-items: center;
  background: var(--mwa-color);
  color: var(--mwa-text);
  padding: 14px 16px;
  gap: 10px;
  flex-shrink: 0;
}

.mwa-box__title {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
}

.mwa-box__close {
  background: none;
  border: none;
  color: inherit;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  opacity: .8;
  transition: opacity .15s;
}

.mwa-box__close:hover {
  opacity: 1;
}

/* ─── Box Body ─────────────────────────────────── */
.mwa-box__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mwa-box__cta {
  background: #f0f2f5;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  color: #444;
  line-height: 1.5;
  position: relative;
}

.mwa-box__cta::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: -7px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-bottom-color: #f0f2f5;
  border-left: none;
  transform: none;
}

/* ─── Agent Buttons ────────────────────────────── */
.mwa-agents {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mwa-agent-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e8e8e8;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color .2s, background .2s, transform .15s;
}

.mwa-agent-btn:hover {
  border-color: var(--mwa-color);
  background: #f5fff8;
  transform: translateX(3px);
}

.mwa-agent-btn:active {
  transform: scale(.98);
}

.mwa-agent-btn__img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.mwa-agent-btn__text {
  flex: 1;
  min-width: 0;
}

.mwa-agent-btn__name {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: #222;
}

.mwa-agent-btn__msg {
  display: block;
  font-size: 12px;
  color: #777;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mwa-agent-btn__arrow {
  width: 20px;
  height: 20px;
  color: var(--mwa-color);
  flex-shrink: 0;
  opacity: .5;
  transition: opacity .2s, transform .2s;
}

.mwa-agent-btn:hover .mwa-agent-btn__arrow {
  opacity: 1;
  transform: translateX(3px);
}

/* ─── Opt-in ───────────────────────────────────── */
.mwa-optin {
  padding-top: 4px;
}

.mwa-optin__label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #666;
  cursor: pointer;
}

.mwa-optin__check {
  margin-top: 2px;
  flex-shrink: 0;
}

/* ─── Animations ───────────────────────────────── */
@keyframes mwaFadeInUp {
  from { opacity: 0; transform: translateY(30px) scale(.8); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.mwa-widget--show .mwa-btn {
  animation: mwaFadeInUp .5s ease both;
}

.mwa-widget--noanim .mwa-btn {
  animation: none;
}

/* ─── Mobile ───────────────────────────────────── */
@media (max-width: 480px) {
  .mwa-widget {
    --mwa-space: 10px;
    --mwa-btn-size: 52px;
  }

  .mwa-box {
    width: calc(100vw - 20px);
    max-height: 60vh;
    right: 0;
  }

  .mwa-widget--left .mwa-box {
    left: 0;
  }

  .mwa-agent-btn:hover {
    transform: none;
  }
}

@media (hover: none) {
  .mwa-agent-btn:hover {
    transform: none;
  }
}
