/**
 * motobucho chat.css — ver03
 * Floating chat widget (mobile) + typing animation
 */

/* ===== Floating button ===== */
.fab-wrap {
  position: fixed;
  bottom: 22px;
  right: 50%;
  transform: translateX(calc(215px + 16px));
  z-index: 200;
}
@media (max-width: 460px) {
  .fab-wrap { right: 16px; transform: none; }
}

.fab-bubble {
  background: #fff;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 12px; font-weight: 700; color: var(--deep);
  max-width: 160px; line-height: 1.6;
  position: relative; margin-bottom: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
}
.fab-bubble::after {
  content: '';
  position: absolute; bottom: -7px; right: 18px;
  border: 7px solid transparent;
  border-top-color: #fff; border-bottom: none;
}
.fab-close {
  position: absolute; top: 4px; right: 8px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 11px;
}
.fab {
  width: 54px; height: 54px;
  border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--ocean), var(--deep));
  box-shadow: 0 4px 20px rgba(2,62,138,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; transition: transform .2s;
}
.fab:hover { transform: scale(1.08); }

/* ===== Chat panel ===== */
.cp {
  position: fixed;
  bottom: 84px;
  right: 50%;
  transform: translateX(calc(215px + 16px)) scale(.85) translateY(20px);
  z-index: 199;
  width: 300px;
  max-height: 400px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; pointer-events: none;
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
  transform-origin: bottom right;
}
.cp.open {
  opacity: 1; pointer-events: all;
  transform: translateX(calc(215px + 16px)) scale(1) translateY(0);
}
@media (max-width: 460px) {
  .cp {
    right: 12px;
    transform: scale(.85) translateY(20px);
    transform-origin: bottom right;
  }
  .cp.open { transform: scale(1) translateY(0); }
}

/* Chat header */
.cp-hdr {
  background: linear-gradient(135deg, var(--deep), var(--ocean));
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.cp-av {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #FFD166, #EF8C4B);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.cp-nm     { color: #fff; font-size: 13px; font-weight: 700; flex: 1; }
.cp-status { font-size: 10px; color: var(--sky); }
.cp-x      { background: none; border: none; color: rgba(255,255,255,.7); cursor: pointer; font-size: 17px; }

/* Chat body */
.cp-body {
  flex: 1; overflow-y: auto;
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.cm   { display: flex; gap: 7px; }
.cm.u { flex-direction: row-reverse; }
.cav {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, #FFD166, #EF8C4B);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; flex-shrink: 0; align-self: flex-end;
}
.cm.u .cav { background: var(--deep); color: #fff; font-size: 8px; font-weight: 700; }
.cb {
  max-width: 82%;
  background: #f0f4f8;
  border-radius: 14px; border-bottom-left-radius: 3px;
  padding: 9px 12px; font-size: 12px; line-height: 1.7; color: var(--text);
}
.cm.u .cb { background: var(--deep); color: #fff; border-bottom-left-radius: 14px; border-bottom-right-radius: 3px; }

/* Quick choice buttons */
.ccs { display: flex; flex-direction: column; gap: 5px; margin-top: 7px; }
.cc {
  background: #fff; border: 1.5px solid var(--ocean); color: var(--ocean);
  border-radius: 12px; padding: 6px 12px;
  font-size: 11px; font-weight: 700; cursor: pointer;
  font-family: inherit; transition: all .15s; text-align: left;
}
.cc:hover { background: var(--ocean); color: #fff; }

/* Input */
.cp-in { display: flex; gap: 7px; padding: 9px 12px; border-top: 1px solid #eee; flex-shrink: 0; }
.cp-inp {
  flex: 1; border: 1.5px solid #dde3ee; border-radius: 15px;
  padding: 7px 12px; font-size: 12px; outline: none; font-family: inherit;
}
.cp-inp:focus { border-color: var(--ocean); }
.cp-s { width: 30px; height: 30px; border-radius: 50%; background: var(--ocean); border: none; color: #fff; cursor: pointer; font-size: 13px; }

/* Typing indicator (shared) */
.td, .pc-typing { display: flex; gap: 3px; padding: 3px 0; }
.td span, .pc-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
  animation: bn 1.1s infinite;
}
.td span:nth-child(2), .pc-typing span:nth-child(2) { animation-delay: .18s; }
.td span:nth-child(3), .pc-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes bn {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-5px); }
}

/* Links inside chat bubbles */
.cb a, .pc-bubble a { color: var(--sky); }
.cm.u .cb a { color: #fff; text-decoration: underline; }
