/* =========================================================
 * Hostel Chat Widget v2 — стили
 * Префикс всех классов: hcw-
 * Палитра:
 *   primary blue   #2186ff
 *   primary light  #4a9efb
 *   gradient head  linear-gradient(135deg, #2186ff 0%, #4a9efb 100%)
 *   text dark      #222
 *   text mid       #555
 *   text light     #999
 *   border         #d4d9e0
 *   bg operator    #f5f7fa
 *   welcome panel  #e8f5ff
 *   error          #c62828
 *   success/tel    #25a85a
 * Шрифт:
 *   -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif
 * ========================================================= */


/* === ROOT & RESET ============================================ */
.hcw-root,
.hcw-root *,
.hcw-root *::before,
.hcw-root *::after {
  box-sizing: border-box;
}

.hcw-root {
  position: fixed;
  z-index: 2147483000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: #222;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hcw-root button {
  font-family: inherit;
  cursor: pointer;
}

.hcw-icon {
  display: block;
  pointer-events: none;
  user-select: none;
}

.hcw-hidden,
.hcw-hidden-input {
  display: none !important;
}

.hcw-honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

body.hcw-fullscreen {
  overflow: hidden;
}


/* === FLOATING ACTION BUTTON (FAB) ============================ */
.hcw-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #fff url('/assets/images/fab.gif') center / 90% 90% no-repeat;
  border: 2px solid #2186ff;
  box-shadow: 0 4px 16px rgba(33, 134, 255, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background-clip: padding-box;
  z-index: 2147483001;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  animation: hcw-pulse 2.2s infinite;
}

.hcw-fab > .hcw-icon {
  display: none;
}

.hcw-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 22px rgba(33, 134, 255, 0.42);
}

.hcw-fab:active {
  transform: scale(0.97);
}

.hcw-fab--hidden {
  display: none !important;
}

@keyframes hcw-pulse {
  0% {
    box-shadow: 0 4px 18px rgba(33, 134, 255, 0.40),
                0 0 0 0 rgba(33, 134, 255, 0.75);
  }
  70% {
    box-shadow: 0 4px 18px rgba(33, 134, 255, 0.40),
                0 0 0 32px rgba(33, 134, 255, 0);
  }
  100% {
    box-shadow: 0 4px 18px rgba(33, 134, 255, 0.40),
                0 0 0 0 rgba(33, 134, 255, 0);
  }
}


/* === POPUP CONTAINER ========================================= */
.hcw-popup {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: hcw-slidein 250ms cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 2147483002;
}

.hcw-popup--hidden {
  display: none !important;
}

@keyframes hcw-slidein {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}


/* === HEADER ================================================== */
.hcw-header {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #2186ff 0%, #4a9efb 100%);
  color: #fff;
  min-height: 56px;
}

.hcw-header__back,
.hcw-header__close,
.hcw-header__menu-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  transition: background 0.15s ease;
}

.hcw-header__back:hover,
.hcw-header__close:hover,
.hcw-header__menu-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.hcw-header__back:active,
.hcw-header__close:active,
.hcw-header__menu-btn:active {
  background: rgba(255, 255, 255, 0.28);
}

.hcw-header__back--hidden {
  visibility: hidden;
}

.hcw-header__back .hcw-icon,
.hcw-header__close .hcw-icon {
  filter: brightness(0) invert(1);
}

.hcw-header__title {
  flex: 1 1 auto;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hcw-header__status {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.92;
}

.hcw-header__menu {
  position: relative;
  flex: 0 0 auto;
}


/* === MENU DROPDOWN =========================================== */
.hcw-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 180px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: 6px;
  z-index: 10;
  animation: hcw-menu-in 140ms ease;
}

.hcw-menu--hidden {
  display: none !important;
}

@keyframes hcw-menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hcw-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  font-size: 14px;
  color: #222;
  transition: background 0.12s ease;
}

.hcw-menu__item:hover {
  background: #f5f7fa;
}

.hcw-menu__item--danger {
  color: #c62828;
}

.hcw-menu__item--danger:hover {
  background: #ffeaea;
}


/* === BODY ==================================================== */
.hcw-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  padding: 18px;
  min-height: 0;
}

.hcw-body--chat {
  padding: 0;
}


/* === CHOICE SCREEN =========================================== */
.hcw-choice {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 6px 0;
}

.hcw-choice__btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 80px;
  padding: 14px 18px;
  border: 1px solid #d4d9e0;
  border-radius: 14px;
  background: #fff;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.12s ease,
              box-shadow 0.15s ease, background 0.15s ease;
}

.hcw-choice__btn:hover {
  border-color: #2186ff;
  background: #e8f5ff;
  box-shadow: 0 4px 14px rgba(33, 134, 255, 0.12);
}

.hcw-choice__btn:active {
  transform: scale(0.98);
}

.hcw-choice__icon {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hcw-choice__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hcw-choice__txt {
  flex: 1 1 auto;
  min-width: 0;
}

.hcw-choice__title {
  font-size: 16px;
  font-weight: 600;
  color: #222;
  margin-bottom: 2px;
}

.hcw-choice__sub {
  font-size: 13px;
  color: #777;
}


/* === FORMS =================================================== */
.hcw-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hcw-form__intro {
  font-size: 14px;
  color: #555;
  margin-bottom: 4px;
}

.hcw-input,
.hcw-textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 16px;
  font-family: inherit;
  line-height: 1.4;
  color: #222;
  background: #fff;
  border: 1px solid #d4d9e0;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.hcw-input::placeholder,
.hcw-textarea::placeholder {
  color: #999;
}

.hcw-input:focus,
.hcw-textarea:focus {
  border-color: #2186ff;
  box-shadow: inset 0 0 0 2px rgba(33, 134, 255, 0.18);
}

.hcw-textarea {
  resize: vertical;
  min-height: 78px;
  max-height: 200px;
}

.hcw-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: #222;
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.92);
  padding: 10px 12px;
  border-radius: 8px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.hcw-consent input[type="checkbox"] {
  flex: 0 0 auto;
  margin-top: 2px;
  width: 16px;
  height: 16px;
  accent-color: #2186ff;
  cursor: pointer;
}

.hcw-consent__label {
  flex: 1 1 auto;
  cursor: pointer;
}

.hcw-consent__label a {
  color: #2186ff;
  text-decoration: underline;
}

.hcw-consent__label a:hover {
  color: #4a9efb;
}


/* === BUTTONS ================================================= */
.hcw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: 0;
  border-radius: 10px;
  transition: transform 0.12s ease, box-shadow 0.15s ease,
              background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  cursor: pointer;
}

.hcw-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.hcw-btn--primary {
  background: linear-gradient(135deg, #2186ff 0%, #4a9efb 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(33, 134, 255, 0.28);
}

.hcw-btn--primary:hover:not(:disabled) {
  box-shadow: 0 5px 16px rgba(33, 134, 255, 0.4);
  transform: translateY(-1px);
}

.hcw-btn--primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(33, 134, 255, 0.3);
}

.hcw-btn--ghost {
  background: transparent;
  color: #555;
  border: 1px solid #d4d9e0;
}

.hcw-btn--ghost:hover:not(:disabled) {
  background: #f5f7fa;
  color: #222;
}

.hcw-btn--tel {
  background: linear-gradient(135deg, #25a85a 0%, #34c768 100%);
  color: #fff;
  font-size: 18px;
  padding: 14px 16px;
  box-shadow: 0 3px 10px rgba(37, 168, 90, 0.32);
}

.hcw-btn--tel:hover {
  box-shadow: 0 5px 16px rgba(37, 168, 90, 0.45);
  transform: translateY(-1px);
}


/* === COUNTDOWN =============================================== */
.hcw-countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 6px 0;
}

.hcw-countdown__ring {
  position: relative;
  width: 220px;
  height: 220px;
  max-width: 100%;
  margin: 4px auto 0;
}

.hcw-countdown__svg {
  width: 100%;
  height: 100%;
  display: block;
  transform: rotate(0deg);
}

.hcw-countdown__track {
  fill: none;
  stroke: #e8f5ff;
  stroke-width: 8;
}

.hcw-countdown__progress {
  fill: none;
  stroke: url(#hcw-cd-gradient), #2186ff;
  stroke: #2186ff;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.25s linear;
}

.hcw-countdown__label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  font-weight: 700;
  color: #2186ff;
  letter-spacing: -1px;
}

.hcw-countdown__info {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hcw-countdown__name {
  font-size: 16px;
  font-weight: 600;
  color: #222;
}

.hcw-countdown__phone {
  font-size: 15px;
  color: #555;
  font-variant-numeric: tabular-nums;
}

.hcw-countdown__retry {
  font-size: 13px;
  color: #999;
  margin-top: 2px;
}


/* === RETRY / GIVEUP / CLOSED ================================= */
.hcw-retry,
.hcw-giveup,
.hcw-closed {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 12px 6px;
}

.hcw-retry__icon,
.hcw-giveup__icon,
.hcw-closed__icon {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 4px;
}

.hcw-retry__title,
.hcw-giveup__title,
.hcw-closed__title {
  font-size: 18px;
  font-weight: 600;
  color: #222;
  line-height: 1.3;
}

.hcw-retry__counter {
  font-size: 13px;
  color: #999;
  margin-bottom: 6px;
}

.hcw-giveup__text,
.hcw-closed__text {
  font-size: 14px;
  color: #555;
  margin-bottom: 6px;
  line-height: 1.45;
}


/* === CHAT FEED =============================================== */
.hcw-popup[data-state="CALLBACK_FORM"] .hcw-body {
  background: url('/assets/images/callback-bg.webp') center / cover no-repeat #fff;
}
.hcw-popup[data-state="COUNTDOWN"] .hcw-body,
.hcw-popup[data-state="RETRY"] .hcw-body {
  background: url('/assets/images/countdown-bg.webp') center / cover no-repeat #2186ff;
}
.hcw-popup[data-state="COUNTDOWN"] .hcw-countdown__track,
.hcw-popup[data-state="RETRY"] .hcw-countdown__track {
  stroke: rgba(255, 255, 255, 0.35);
}
.hcw-popup[data-state="COUNTDOWN"] .hcw-countdown__progress,
.hcw-popup[data-state="RETRY"] .hcw-countdown__progress {
  stroke: #fff;
}
.hcw-popup[data-state="COUNTDOWN"] .hcw-countdown__label,
.hcw-popup[data-state="RETRY"] .hcw-countdown__label {
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  border-radius: 50%;
  width: 130px;
  height: 130px;
  inset: auto;
  margin: auto;
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
}
.hcw-popup[data-state="COUNTDOWN"] .hcw-countdown__info,
.hcw-popup[data-state="RETRY"] .hcw-countdown__info {
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  padding: 10px 18px;
  border-radius: 12px;
  display: inline-flex;
  align-self: center;
}
.hcw-popup[data-state="COUNTDOWN"] .hcw-countdown__name,
.hcw-popup[data-state="RETRY"] .hcw-countdown__name {
  color: #fff;
  font-size: 18px;
}
.hcw-popup[data-state="COUNTDOWN"] .hcw-countdown__phone,
.hcw-popup[data-state="RETRY"] .hcw-countdown__phone {
  color: #eaf5ff;
}
.hcw-popup[data-state="COUNTDOWN"] .hcw-countdown .hcw-btn--ghost,
.hcw-popup[data-state="RETRY"] .hcw-countdown .hcw-btn--ghost {
  background: rgba(255, 255, 255, 0.94);
  color: #1f3a5f;
  border: 1px solid rgba(255, 255, 255, 0.94);
  font-weight: 600;
}
.hcw-popup[data-state="COUNTDOWN"] .hcw-countdown .hcw-btn--ghost:hover,
.hcw-popup[data-state="RETRY"] .hcw-countdown .hcw-btn--ghost:hover {
  background: #fff;
}


.hcw-feed {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  background: url('/assets/images/chat-bg.webp') center / cover no-repeat #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.hcw-feed::-webkit-scrollbar {
  width: 6px;
}

.hcw-feed::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.16);
  border-radius: 3px;
}

.hcw-feed::-webkit-scrollbar-track {
  background: transparent;
}


/* === MESSAGE BUBBLES ========================================= */
.hcw-msg {
  display: flex;
  width: 100%;
  margin-bottom: 2px;
  animation: hcw-msg-in 200ms ease;
}

@keyframes hcw-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hcw-msg__content {
  max-width: 75%;
  border-radius: 18px;
  padding: 9px 13px;
  position: relative;
  word-wrap: break-word;
  overflow-wrap: break-word;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 2px 10px rgba(15, 40, 80, 0.12);
}

.hcw-msg--client {
  justify-content: flex-end;
}

.hcw-msg--client .hcw-msg__content {
  background: linear-gradient(135deg, #2f8cff 0%, #1d6ee3 100%);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 3px 12px rgba(33, 134, 255, 0.34);
}

.hcw-msg--operator {
  justify-content: flex-start;
}

.hcw-msg--operator .hcw-msg__content {
  background: #ffffff;
  color: #1f2d3d;
  border-bottom-left-radius: 6px;
  box-shadow: 0 2px 10px rgba(15, 40, 80, 0.14);
}

.hcw-msg--system {
  justify-content: center;
}

.hcw-msg--system .hcw-msg__text {
  font-size: 12px;
  color: #999;
  text-align: center;
  padding: 4px 12px;
  max-width: 80%;
}

.hcw-msg__text {
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.hcw-msg__text a {
  color: inherit;
  text-decoration: underline;
}

.hcw-msg--operator .hcw-msg__text a {
  color: #2186ff;
}

.hcw-msg__caption {
  font-size: 13px;
  line-height: 1.4;
}

.hcw-msg__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 11px;
  line-height: 1;
  margin-top: 2px;
  opacity: 0.85;
}

.hcw-msg--client .hcw-msg__meta {
  color: rgba(255, 255, 255, 0.92);
}

.hcw-msg--operator .hcw-msg__meta {
  color: #999;
}

.hcw-msg__time {
  font-variant-numeric: tabular-nums;
}

.hcw-msg__status {
  font-size: 12px;
  line-height: 1;
  letter-spacing: -1px;
}

.hcw-msg--client.hcw-msg--read .hcw-msg__status {
  color: #4a9efb;
}

.hcw-msg--failed .hcw-msg__content {
  background: #fbe9e9;
  color: #c62828;
}

.hcw-msg--failed .hcw-msg__status {
  color: #c62828;
}


/* === MESSAGE CONTENT: PHOTO / VOICE ========================== */
.hcw-msg__photo {
  display: block;
  max-width: 220px;
  width: 100%;
  height: auto;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.hcw-msg__photo:hover {
  opacity: 0.92;
}

.hcw-voice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
  max-width: 260px;
}

.hcw-voice audio {
  display: none;
}

.hcw-voice__btn {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.hcw-msg--client .hcw-voice__btn {
  background: rgba(255, 255, 255, 0.95);
  color: #1d6ee3;
}
.hcw-msg--operator .hcw-voice__btn {
  background: #2186ff;
  color: #fff;
  box-shadow: 0 2px 6px rgba(33, 134, 255, 0.35);
}

.hcw-voice__btn:active { transform: scale(0.94); }
.hcw-voice--playing .hcw-voice__btn { transform: scale(1.05); }

.hcw-voice__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.hcw-voice__bar {
  height: 4px;
  border-radius: 2px;
  cursor: pointer;
  overflow: hidden;
}

.hcw-msg--client .hcw-voice__bar { background: rgba(255, 255, 255, 0.32); }
.hcw-msg--operator .hcw-voice__bar { background: rgba(33, 134, 255, 0.18); }

.hcw-voice__fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  transition: width 0.1s linear;
}

.hcw-msg--client .hcw-voice__fill { background: #fff; }
.hcw-msg--operator .hcw-voice__fill { background: #2186ff; }

.hcw-voice__time {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
  line-height: 1;
}


/* === QUICK REPLIES (CHIPS) =================================== */
.hcw-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 4px 8px;
  justify-content: flex-start;
}

.hcw-quick__chip {
  padding: 7px 12px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #2186ff;
  border: 1px solid #2186ff;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.hcw-quick__chip:hover {
  background: #e8f5ff;
}

.hcw-quick__chip:active {
  transform: scale(0.96);
}


/* === TYPING INDICATOR ======================================== */
.hcw-typing {
  font-size: 12px;
  color: #555;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.86);
  border-radius: 12px;
  align-self: flex-start;
  align-self: flex-start;
}

.hcw-typing::after {
  content: "";
  display: inline-block;
  width: 24px;
  height: 6px;
  background-image:
    radial-gradient(circle, #999 2px, transparent 2.5px),
    radial-gradient(circle, #999 2px, transparent 2.5px),
    radial-gradient(circle, #999 2px, transparent 2.5px);
  background-size: 8px 6px;
  background-repeat: no-repeat;
  background-position: 0 50%, 8px 50%, 16px 50%;
  animation: hcw-dots 1.2s infinite;
}

@keyframes hcw-dots {
  0%, 100% { opacity: 0.3; }
  33%      { opacity: 0.7; }
  66%      { opacity: 1; }
}

.hcw-typing--hidden {
  display: none !important;
}


/* === INPUT BAR =============================================== */
.hcw-inputbar {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid #d4d9e0;
  background: #fff;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

.hcw-inputbar__btn,
.hcw-inputbar__send {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #555;
  transition: background 0.15s ease, transform 0.12s ease;
}

.hcw-inputbar__btn:hover {
  background: #f5f7fa;
}

.hcw-inputbar__send {
  background: linear-gradient(135deg, #2186ff 0%, #4a9efb 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(33, 134, 255, 0.28);
}

.hcw-inputbar__send .hcw-icon {
  filter: brightness(0) invert(1);
}

.hcw-inputbar__send:hover {
  box-shadow: 0 4px 12px rgba(33, 134, 255, 0.42);
  transform: scale(1.05);
}

.hcw-inputbar__send:active {
  transform: scale(0.95);
}

.hcw-inputbar__text {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 12px;
  font-size: 16px;
  font-family: inherit;
  line-height: 1.4;
  color: #222;
  background: #f5f7fa;
  border: 1px solid transparent;
  border-radius: 18px;
  outline: none;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.hcw-inputbar__text::placeholder {
  color: #999;
}

.hcw-inputbar__text:focus {
  background: #fff;
  border-color: #2186ff;
}


/* === PHOTO PREVIEWS (перед отправкой) ======================== */
.hcw-previews {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px 0;
  background: #fff;
  border-top: 1px solid #d4d9e0;
}

.hcw-previews--empty {
  display: none;
}

.hcw-preview {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f7fa;
  border: 1px solid #d4d9e0;
}

.hcw-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hcw-preview__del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s ease;
}

.hcw-preview__del:hover {
  background: #c62828;
}


/* === VOICE RECORDING BAR ===================================== */
.hcw-recordbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid #d4d9e0;
  background: #fff;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

.hcw-recordbar__dot {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1;
  animation: hcw-rec-pulse 1s infinite;
}

@keyframes hcw-rec-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.85); }
}

.hcw-recordbar__time {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 600;
  color: #c62828;
  font-variant-numeric: tabular-nums;
  min-width: 36px;
}

.hcw-recordbar__wave {
  flex: 1 1 auto;
  color: #999;
  letter-spacing: 2px;
  font-size: 14px;
  text-align: center;
  user-select: none;
  overflow: hidden;
  white-space: nowrap;
}

.hcw-recordbar__cancel,
.hcw-recordbar__send {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s ease, transform 0.12s ease;
}

.hcw-recordbar__cancel {
  background: #f5f7fa;
  color: #c62828;
  font-size: 16px;
  line-height: 1;
}

.hcw-recordbar__cancel:hover {
  background: #ffeaea;
}

.hcw-recordbar__send {
  background: linear-gradient(135deg, #2186ff 0%, #4a9efb 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(33, 134, 255, 0.28);
}

.hcw-recordbar__send .hcw-icon {
  filter: brightness(0) invert(1);
}

.hcw-recordbar__send:hover {
  box-shadow: 0 4px 12px rgba(33, 134, 255, 0.42);
  transform: scale(1.05);
}


/* === LIGHTBOX (фото в полный экран) ========================== */
.hcw-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2147483005;
  cursor: zoom-out;
  padding: 20px;
  animation: hcw-fade-in 180ms ease;
}

@keyframes hcw-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.hcw-lightbox img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.5);
}

.hcw-lightbox::after {
  content: "✕";
  position: absolute;
  top: 14px;
  right: 18px;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}


/* === TOAST =================================================== */
.hcw-toast {
  position: absolute;
  left: 50%;
  bottom: 80px;
  transform: translate(-50%, 24px);
  background: #222;
  color: #fff;
  padding: 10px 16px;
  border-radius: 22px;
  font-size: 13px;
  line-height: 1.3;
  max-width: 80%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 2147483004;
  text-align: center;
}

.hcw-toast--error {
  background: #c62828;
}

.hcw-toast--show {
  opacity: 1;
  transform: translate(-50%, 0);
}


/* === MOBILE ADAPTIVE ========================================= */
@media (max-width: 768px) {
  .hcw-popup {
    right: 0;
    bottom: 0;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }


  .hcw-fab {
    right: 26px;
    bottom: 96px;
    width: 56px;
    height: 56px;
  }

  .hcw-body {
    padding: 16px;
  }

  .hcw-body--chat {
    padding: 0;
  }

  .hcw-countdown__ring {
    width: 200px;
    height: 200px;
  }

  .hcw-countdown__label {
    font-size: 50px;
  }

  .hcw-toast {
    bottom: 88px;
  }
}

@media (max-width: 380px) {
  .hcw-body {
    padding: 12px;
  }

  .hcw-choice__btn {
    padding: 12px 14px;
    gap: 10px;
  }

  .hcw-choice__icon {
    width: 42px;
    height: 42px;
  }

  .hcw-choice__title {
    font-size: 15px;
  }

  .hcw-choice__sub {
    font-size: 12px;
  }

  .hcw-countdown__ring {
    width: 170px;
    height: 170px;
  }

  .hcw-countdown__label {
    font-size: 42px;
  }

  .hcw-inputbar {
    gap: 4px;
    padding: 6px 8px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  }

  .hcw-inputbar__btn,
  .hcw-inputbar__send {
    width: 34px;
    height: 34px;
  }

  .hcw-header {
    padding: 10px 10px;
    min-height: 52px;
  }

  .hcw-header__title {
    font-size: 15px;
  }
}


/* === PRINT (на всякий случай скрыть) ========================= */
@media print {
  .hcw-root { display: none !important; }
}
