#hyd-tube-widget,
#hyd-tube-widget *,
#hyd-tube-widget *::before,
#hyd-tube-widget *::after {
  box-sizing: border-box;
}

#hyd-tube-widget {
  --hyd-tube-navy: #0b2f4a;
  --hyd-tube-navy-2: #12486e;
  --hyd-tube-cyan: #1aa6b7;
  --hyd-tube-orange: #f26b21;
  --hyd-tube-orange-d: #d85a14;
  --hyd-tube-grey: #eef2f5;
  --hyd-tube-line: #d5dde4;
  --hyd-tube-text: #1b2a37;
  --hyd-tube-muted: #5d6e7d;
  --hyd-tube-red: #c62828;
  --hyd-tube-green: #1f8f4e;

  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--hyd-tube-text);
}

/* ---------- Toggle tab (flush to the right wall) ---------- */

.hyd-tube-toggle {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 99998;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 9px;
  border: 0;
  border-radius: 10px 0 0 10px;
  background: var(--hyd-tube-navy);
  color: #fff;
  cursor: pointer;
  box-shadow: -3px 4px 16px rgba(11, 47, 74, 0.35);
  border-left: 3px solid var(--hyd-tube-orange);
  transition: padding 0.2s ease, background 0.2s ease, transform 0.25s ease, opacity 0.2s ease;
  font-family: inherit;
}

.hyd-tube-toggle:hover {
  background: var(--hyd-tube-navy-2);
  padding-right: 13px;
}

.hyd-tube-toggle:focus-visible,
.hyd-tube-close:focus-visible,
.hyd-tube-quick-btn:focus-visible,
.hyd-tube-send:focus-visible,
.hyd-tube-submit:focus-visible,
.hyd-tube-field input:focus-visible,
.hyd-tube-field select:focus-visible,
.hyd-tube-field textarea:focus-visible,
.hyd-tube-input:focus-visible {
  outline: 2px solid var(--hyd-tube-cyan);
  outline-offset: 2px;
}

.hyd-tube-toggle-icon {
  width: 24px;
  height: 24px;
  display: block;
}

.hyd-tube-toggle-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.hyd-tube-toggle-dot {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--hyd-tube-orange);
  box-shadow: 0 0 0 0 rgba(242, 107, 33, 0.6);
  animation: hyd-tube-pulse 2.4s ease-out 3;
}

@keyframes hyd-tube-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(242, 107, 33, 0.6); }
  100% { box-shadow: 0 0 0 12px rgba(242, 107, 33, 0); }
}

.hyd-tube-toggle-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(100%, -50%);
}

/* ---------- Chat window (docked to right wall) ---------- */

.hyd-tube-window {
  position: fixed;
  top: 50%;
  right: 0;
  z-index: 99999;
  width: 390px;
  max-width: 100vw;
  height: min(660px, calc(100vh - 32px));
  height: min(660px, calc(100dvh - 32px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px 0 0 14px;
  box-shadow: -6px 8px 40px rgba(11, 47, 74, 0.28);
  overflow: hidden;
  transform: translate(105%, -50%);
  visibility: hidden;
  transition: transform 0.3s ease, visibility 0s linear 0.3s;
}

.hyd-tube-window.hyd-tube-open {
  transform: translate(0, -50%);
  visibility: visible;
  transition: transform 0.3s ease, visibility 0s;
}

.hyd-tube-window:focus {
  outline: none;
}

/* ---------- Header ---------- */

.hyd-tube-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--hyd-tube-navy);
  border-bottom: 3px solid var(--hyd-tube-orange);
  color: #fff;
}

.hyd-tube-logo-wrap {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  height: 44px;
  padding: 4px 10px;

  border-radius: 8px;
}

.hyd-tube-logo {
  display: block;
  height: 100%;
  width: auto;
  max-width: 130px;
  object-fit: contain;
}

.hyd-tube-head-text {
  flex: 1 1 auto;
  min-width: 0;
}

.hyd-tube-head-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.hyd-tube-head-sub {
  margin: 2px 0 0;
  font-size: 10px;
  color: #b9d3e4;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hyd-tube-head-sub::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3ddc84;
}

.hyd-tube-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
}

.hyd-tube-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* ---------- Messages ---------- */

.hyd-tube-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 14px 8px;
  background: var(--hyd-tube-grey);
  scroll-behavior: smooth;
}

.hyd-tube-msg {
  display: flex;
  margin: 0 0 8px;
}

.hyd-tube-msg-bot { justify-content: flex-start; }
.hyd-tube-msg-user { justify-content: flex-end; }

.hyd-tube-bubble {
  max-width: 86%;
  padding: 9px 12px;
  border-radius: 12px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.hyd-tube-msg-bot .hyd-tube-bubble {
  background: #fff;
  border: 1px solid var(--hyd-tube-line);
  border-top-left-radius: 3px;
}

.hyd-tube-msg-user .hyd-tube-bubble {
  background: var(--hyd-tube-navy-2);
  color: #fff;
  border-top-right-radius: 3px;
}

.hyd-tube-bubble a {
  color: var(--hyd-tube-navy-2);
  font-weight: 600;
  text-decoration: underline;
}

.hyd-tube-bubble ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.hyd-tube-bubble li { margin: 2px 0; }

.hyd-tube-typing {
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
}

.hyd-tube-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hyd-tube-muted);
  animation: hyd-tube-bounce 1.1s infinite ease-in-out;
}

.hyd-tube-typing span:nth-child(2) { animation-delay: 0.15s; }
.hyd-tube-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes hyd-tube-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ---------- Quick replies ---------- */

.hyd-tube-quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 2px 0 10px;
}

.hyd-tube-quick-btn {
  display: inline-block;
  padding: 8px 12px;
  border: 1.5px solid var(--hyd-tube-navy-2);
  border-radius: 18px;
  background: #fff;
  color: var(--hyd-tube-navy-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.hyd-tube-quick-btn:hover {
  background: var(--hyd-tube-navy-2);
  color: #fff;
}

.hyd-tube-quick-primary {
  background: var(--hyd-tube-orange);
  border-color: var(--hyd-tube-orange);
  color: #fff;
}

.hyd-tube-quick-primary:hover {
  background: var(--hyd-tube-orange-d);
  border-color: var(--hyd-tube-orange-d);
}

.hyd-tube-quick-wa {
  border-color: #1f9d55;
  color: #1f9d55;
}

.hyd-tube-quick-wa:hover {
  background: #1f9d55;
  color: #fff;
}

/* ---------- Enquiry form ---------- */

.hyd-tube-form-wrap {
  margin: 4px 0 12px;
}

.hyd-tube-form {
  padding: 14px;
  background: #fff;
  border: 1px solid var(--hyd-tube-line);
  border-top: 3px solid var(--hyd-tube-cyan);
  border-radius: 10px;
}

.hyd-tube-form-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--hyd-tube-navy);
}

.hyd-tube-form-note {
  margin: 2px 0 12px;
  font-size: 12px;
  color: var(--hyd-tube-muted);
}

.hyd-tube-field { margin: 0 0 10px; }

.hyd-tube-field label {
  display: block;
  margin: 0 0 3px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--hyd-tube-navy);
}

.hyd-tube-req { color: var(--hyd-tube-red); }

.hyd-tube-field input,
.hyd-tube-field select,
.hyd-tube-field textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #b9c6d1;
  border-radius: 7px;
  background: #fff;
  color: var(--hyd-tube-text);
  font: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
}

.hyd-tube-field textarea { resize: vertical; min-height: 70px; }

.hyd-tube-field-invalid input,
.hyd-tube-field-invalid select,
.hyd-tube-field-invalid textarea,
.hyd-tube-turnstile-invalid {
  border-color: var(--hyd-tube-red);
}

.hyd-tube-error {
  margin: 3px 0 0;
  min-height: 0;
  font-size: 12px;
  color: var(--hyd-tube-red);
}

.hyd-tube-error:empty { display: none; }

.hyd-tube-honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.hyd-tube-submit {
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--hyd-tube-orange);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease;
}

.hyd-tube-submit:hover { background: var(--hyd-tube-orange-d); }

.hyd-tube-submit:disabled {
  background: #9fb0bd;
  cursor: not-allowed;
}

.hyd-tube-form-status {
  margin: 8px 0 0;
  font-size: 13px;
}

.hyd-tube-form-status-error { color: var(--hyd-tube-red); }

/* ---------- Composer ---------- */

.hyd-tube-composer {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid var(--hyd-tube-line);
}

.hyd-tube-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #b9c6d1;
  border-radius: 20px;
  font: inherit;
  font-size: 16px;
}

.hyd-tube-send {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--hyd-tube-navy-2);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.hyd-tube-send:hover { background: var(--hyd-tube-navy); }

.hyd-tube-send svg { width: 18px; height: 18px; }

.hyd-tube-footer-note {
  padding: 0 12px 8px;
  background: #fff;
  font-size: 11px;
  color: var(--hyd-tube-muted);
  text-align: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 520px) {
  .hyd-tube-window {
    top: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    transform: translateX(105%);
  }

  .hyd-tube-window.hyd-tube-open {
    transform: translateX(0);
  }

  .hyd-tube-toggle {
    padding: 11px 7px;
  }

  .hyd-tube-toggle-label { font-size: 12px; }

  .hyd-tube-bubble { max-width: 90%; }
}

@media (max-height: 480px) and (min-width: 521px) {
  .hyd-tube-window { height: calc(100vh - 12px); }
}

@media (prefers-reduced-motion: reduce) {
  #hyd-tube-widget * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
