/* Hydromac Hydraulics chatbot — every class / id / keyframe starts with mac-chat */

.mac-chat-root,
.mac-chat-root * { box-sizing: border-box; }

.mac-chat-root {
  --mac-chat-navy: #0b2a4a;
  --mac-chat-blue: #1565c0;
  --mac-chat-orange: #f58220;
  --mac-chat-bg: #f3f6fa;
  --mac-chat-text: #1d2b3a;
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
.mac-chat-root svg { width: 1em; height: 1em; fill: currentColor; display: block; }


/* =========================================================
   RIGHT WALL STICKY BUTTONS (desktop / tablet)
   ========================================================= */
.mac-chat-dock-btn {
  position: fixed;
  right: 0;
  width: 52px;
  height: 52px;
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  text-decoration: none;
  cursor: pointer;
  border-radius: 14px 0 0 14px;
  box-shadow: -4px 5px 18px rgba(0, 0, 0, .22);
  z-index: 999990;
  transition: transform .3s ease, box-shadow .3s ease;
  animation: mac-chat-pulse 2.6s infinite;
}
.mac-chat-dock-btn:hover { transform: translateX(-7px); color: #fff; box-shadow: -8px 8px 25px rgba(0, 0, 0, .3); }
.mac-chat-dock-call { bottom: 235px; background: #0d6efd; }
.mac-chat-dock-wa   { bottom: 175px; background: #25d366; }
.mac-chat-dock-chat { bottom: 115px; background: var(--mac-chat-orange); }
.mac-chat-dock-btn svg { animation: mac-chat-bounce 1.8s infinite; }

.mac-chat-tip {
  position: absolute;
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--mac-chat-navy);
  color: #fff;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.mac-chat-dock-btn:hover .mac-chat-tip { opacity: 1; }

.mac-chat-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #e53935;
  border: 2px solid #fff;
}


/* =========================================================
   MOBILE BOTTOM NAVBAR (hidden on desktop)
   ========================================================= */
.mac-chat-navbar { display: none; }


/* =========================================================
   CHAT WINDOW
   ========================================================= */
.mac-chat-window {
  position: fixed;
  right: 66px;
  bottom: 24px;
  width: 380px;
  max-width: calc(100vw - 80px);
  height: 600px;
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 14px 50px rgba(11, 42, 74, .35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999995;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(.97);
  transform-origin: bottom right;
  transition: opacity .25s, transform .25s, visibility .25s;
}
.mac-chat-window.mac-chat-open { opacity: 1; visibility: visible; transform: none; }

.mac-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--mac-chat-navy), var(--mac-chat-blue));
  color: #fff;
}
.mac-chat-logo {  height: 48px; border-radius: 10px; background: #fff; object-fit: contain; padding: 3px; flex: none; }
.mac-chat-spacer { flex: 1; }
.mac-chat-close,
.mac-chat-refresh {
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .18); color: #fff; font-size: 20px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none;
}
.mac-chat-close:hover,
.mac-chat-refresh:hover { background: rgba(255, 255, 255, .3); }

.mac-chat-refresh svg { transition: transform .5s; }
.mac-chat-refresh:hover svg { transform: rotate(180deg); }

.mac-chat-quick { display: flex; gap: 8px; padding: 8px 12px; background: #fff; border-bottom: 1px solid #e3e9f0; }
.mac-chat-quick a {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 8px; border-radius: 8px; color: #fff; text-decoration: none; font-size: 13px; font-weight: 600;
}
.mac-chat-quick-call { background: #0d6efd; }
.mac-chat-quick-wa { background: #25d366; }

.mac-chat-body { flex: 1; overflow-y: auto; padding: 14px 12px; background: var(--mac-chat-bg); scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }

.mac-chat-msg { display: flex; margin-bottom: 10px; }
.mac-chat-msg-user { justify-content: flex-end; }
.mac-chat-bubble { max-width: 88%; padding: 10px 12px; border-radius: 14px; word-wrap: break-word; overflow-wrap: anywhere; color: var(--mac-chat-text); }
.mac-chat-msg-bot .mac-chat-bubble { background: #fff; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.mac-chat-msg-user .mac-chat-bubble { background: var(--mac-chat-blue); color: #fff; border-bottom-right-radius: 4px; }
.mac-chat-bubble a { color: var(--mac-chat-blue); font-weight: 600; }
.mac-chat-bubble ul { margin: 6px 0 4px; padding-left: 18px; }
.mac-chat-bubble li { margin: 3px 0; }

.mac-chat-typing i { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: #9aa9ba; animation: mac-chat-dot 1.1s infinite; }
.mac-chat-typing i:nth-child(2) { animation-delay: .18s; }
.mac-chat-typing i:nth-child(3) { animation-delay: .36s; }

.mac-chat-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 2px 0 12px; }
.mac-chat-chip {
  border: 1.5px solid var(--mac-chat-blue); background: #fff; color: var(--mac-chat-blue);
  padding: 7px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all .2s;
}
.mac-chat-chip:hover { background: var(--mac-chat-blue); color: #fff; }
.mac-chat-chip-hot { background: var(--mac-chat-orange); border-color: var(--mac-chat-orange); color: #fff; }
.mac-chat-chip-hot:hover { background: #d96d0f; border-color: #d96d0f; }

.mac-chat-inputbar { display: flex; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid #e3e9f0; }
.mac-chat-input { flex: 1; min-width: 0; border: 1.5px solid #d3dce6; border-radius: 22px; padding: 10px 14px; font-size: 14px; font-family: inherit; outline: 0; }
.mac-chat-input:focus { border-color: var(--mac-chat-blue); }
.mac-chat-send {
  width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--mac-chat-orange); color: #fff;
  font-size: 18px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none;
}
.mac-chat-foot { padding: 6px; text-align: center; font-size: 11px; color: #7b8a9a; background: #fff; }


/* =========================================================
   ENQUIRY FORM (end of chat)
   ========================================================= */
.mac-chat-form { background: #fff; border-radius: 14px; padding: 14px; margin: 4px 0 12px; box-shadow: 0 1px 4px rgba(0, 0, 0, .1); border-top: 4px solid var(--mac-chat-orange); }
.mac-chat-form h4 { margin: 0 0 2px; font-size: 16px; color: var(--mac-chat-navy); }
.mac-chat-form p { margin: 0 0 10px; font-size: 12px; color: #6b7a8a; }
.mac-chat-field { margin-bottom: 10px; }
.mac-chat-field label { display: block; font-size: 12px; font-weight: 600; color: var(--mac-chat-navy); margin-bottom: 3px; }
.mac-chat-field input,
.mac-chat-field select,
.mac-chat-field textarea {
  width: 100%; border: 1.5px solid #d3dce6; border-radius: 8px; padding: 9px 10px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--mac-chat-text); outline: 0;
}
.mac-chat-field textarea { min-height: 64px; resize: vertical; }
.mac-chat-field input:focus,
.mac-chat-field select:focus,
.mac-chat-field textarea:focus { border-color: var(--mac-chat-blue); }
.mac-chat-err { display: none; color: #d32f2f; font-size: 11.5px; margin-top: 3px; }
.mac-chat-invalid input,
.mac-chat-invalid select { border-color: #d32f2f; }
.mac-chat-invalid .mac-chat-err { display: block; }
.mac-chat-hp { position: absolute !important; left: -9999px !important; opacity: 0 !important; height: 0 !important; }

/* Cloudflare Turnstile box */
.mac-chat-turnstile { margin: 4px 0 10px; min-height: 0; max-width: 100%; overflow: hidden; }
.mac-chat-turnstile iframe { max-width: 100%; }

.mac-chat-submit {
  width: 100%; border: 0; border-radius: 8px; padding: 11px;
  background: linear-gradient(135deg, var(--mac-chat-navy), var(--mac-chat-blue));
  color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.mac-chat-submit:disabled { opacity: .6; cursor: not-allowed; }
.mac-chat-status { margin-top: 8px; font-size: 12.5px; }
.mac-chat-bad { color: #d32f2f; }


/* =========================================================
   ANIMATIONS
   ========================================================= */
@keyframes mac-chat-pulse {
  0%, 100% { box-shadow: -4px 5px 18px rgba(0, 0, 0, .22); }
  50% { box-shadow: -4px 5px 24px rgba(245, 130, 32, .45); }
}
@keyframes mac-chat-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes mac-chat-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }


/* =========================================================
   TABLET
   ========================================================= */
@media (max-width: 991px) {
  .mac-chat-window { width: 360px; }
}


/* =========================================================
   MOBILE: dock hides, bottom navbar shows, window near full-screen
   ========================================================= */
@media (max-width: 767px) {
  .mac-chat-dock-btn { display: none !important; }
  body { padding-bottom: 64px !important; }

  .mac-chat-navbar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: 62px;
    background: #fff;
    border-top: 1px solid #dbe3ec;
    box-shadow: 0 -4px 18px rgba(11, 42, 74, .15);
    z-index: 999996;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .mac-chat-nav-item {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border: 0; background: none; color: var(--mac-chat-navy);
    text-decoration: none; font-size: 11px; font-weight: 600; font-family: inherit;
    cursor: pointer; padding: 0; position: relative;
  }
  .mac-chat-nav-item svg { font-size: 21px; }
  .mac-chat-nav-call { color: #0d6efd; }
  .mac-chat-nav-wa { color: #1fa855; }
  .mac-chat-nav-chat { color: var(--mac-chat-orange); }
  .mac-chat-nav-chat .mac-chat-nav-ico {
    width: 50px; height: 50px; border-radius: 50%; background: var(--mac-chat-orange); color: #fff;
    display: flex; align-items: center; justify-content: center; margin-top: -22px;
    box-shadow: 0 4px 14px rgba(245, 130, 32, .55); border: 4px solid #fff;
  }
  .mac-chat-nav-chat .mac-chat-nav-ico svg { font-size: 22px; }

  .mac-chat-window {
    left: 8px; right: 8px; bottom: 70px;
    width: auto; max-width: none;
    height: calc(100vh - 90px);
    height: calc(100dvh - 90px);
    max-height: 640px;
    border-radius: 14px;
  }
  .mac-chat-quick { display: none; }
}

@media (max-width: 360px) {
  .mac-chat-nav-item { font-size: 10px; }
  .mac-chat-chip { font-size: 12px; padding: 6px 10px; }
  .mac-chat-bubble { max-width: 94%; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .mac-chat-window { height: calc(100vh - 80px); }
  .mac-chat-quick { display: none; }
}