/* VPN4ALL support chat widget styles. Loaded alongside support-chat.js. */

.vpn4all-chat-launcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  background: #1f6feb;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.vpn4all-chat-launcher-label {
  font-weight: 600;
  font-size: 14px;
}
.vpn4all-chat-launcher-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: #cfe0ff;
}
.vpn4all-chat-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #35d07f;
  box-shadow: 0 0 0 2px rgba(53, 208, 127, 0.25);
  flex-shrink: 0;
}
.vpn4all-chat-launcher:hover {
  background: #1a5fd1;
}

.vpn4all-chat-popup {
  position: fixed;
  bottom: 92px;
  right: 20px;
  z-index: 9998;
  max-width: 260px;
  background: #fff;
  color: #222;
  padding: 12px 32px 12px 14px;
  border-radius: 12px;
  border-bottom-right-radius: 2px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  animation: vpn4all-chat-popup-in 0.25s ease-out;
}
.vpn4all-chat-popup-close {
  position: absolute;
  top: 4px;
  right: 6px;
  background: none;
  border: none;
  color: #9aa0ab;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}
@keyframes vpn4all-chat-popup-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.vpn4all-chat-panel {
  position: fixed;
  bottom: 88px;
  right: 20px;
  z-index: 9999;
  width: 340px;
  max-width: calc(100vw - 40px);
  height: 460px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.vpn4all-chat-hidden {
  /* !important is deliberate here, not laziness: this class is applied
     alongside other classes that set their own `display` (e.g.
     .vpn4all-chat-form { display: flex }), and without !important a
     later same-specificity rule in this file wins over .vpn4all-chat-hidden
     regardless of which class was added last in JS - which is exactly
     the bug that let the message box stay visible/usable before the
     name+email gate was completed, and made "Start chat" appear to do
     nothing (the gate form never actually disappeared). Keep this
     !important; don't "clean it up" without re-testing the gate flow. */
  display: none !important;
}

.vpn4all-chat-header {
  background: #1f6feb;
  color: #fff;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.vpn4all-chat-header-titles {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.vpn4all-chat-header-title {
  font-weight: 600;
  font-size: 14px;
}
.vpn4all-chat-header-subtitle {
  font-weight: 500;
  font-size: 11px;
  color: #cfe0ff;
}
.vpn4all-chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.vpn4all-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f7f8fa;
}

.vpn4all-chat-bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.vpn4all-chat-assistant {
  align-self: flex-start;
  background: #e9edf3;
  color: #222;
  border-bottom-left-radius: 2px;
}
.vpn4all-chat-assistant a {
  color: #1f6feb;
  font-weight: 600;
  text-decoration: underline;
  word-break: break-all;
}
.vpn4all-chat-user {
  align-self: flex-end;
  background: #1f6feb;
  color: #fff;
  border-bottom-right-radius: 2px;
}

.vpn4all-chat-form {
  display: flex;
  border-top: 1px solid #e2e5ea;
  padding: 8px;
  gap: 8px;
  background: #fff;
}

.vpn4all-chat-gate {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid #e2e5ea;
  background: #fff;
}
.vpn4all-chat-gate .vpn4all-chat-input {
  width: 100%;
  box-sizing: border-box;
}
.vpn4all-chat-gate .vpn4all-chat-send {
  width: 100%;
}
.vpn4all-chat-gate-note {
  margin: 0;
  font-size: 11px;
  color: #8a8f99;
  line-height: 1.4;
}
.vpn4all-chat-input {
  flex: 1;
  border: 1px solid #d7dbe2;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}
.vpn4all-chat-send {
  border: none;
  border-radius: 8px;
  background: #1f6feb;
  color: #fff;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
}
.vpn4all-chat-send:hover {
  background: #1a5fd1;
}

@media (prefers-color-scheme: dark) {
  .vpn4all-chat-panel {
    background: #1b1f27;
  }
  .vpn4all-chat-messages {
    background: #12151b;
  }
  .vpn4all-chat-assistant {
    background: #262c38;
    color: #e6e8eb;
  }
  .vpn4all-chat-assistant a {
    color: #7aa9ff;
  }
  .vpn4all-chat-gate,
  .vpn4all-chat-form {
    background: #1b1f27;
    border-top-color: #2b3140;
  }
  .vpn4all-chat-gate .vpn4all-chat-input,
  .vpn4all-chat-form .vpn4all-chat-input {
    background: #12151b;
    border-color: #2b3140;
    color: #e9ebf1;
  }
  .vpn4all-chat-popup {
    background: #1b1f27;
    color: #e9ebf1;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  }
}

/* Mobile: full-screen panel instead of a floating card - a 340px box
   either overflows small screens or leaves barely any room to type. */
@media (max-width: 480px) {
  .vpn4all-chat-launcher {
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    right: 16px;
    padding: 12px 18px;
  }
  .vpn4all-chat-panel {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  .vpn4all-chat-header {
    padding-top: max(12px, env(safe-area-inset-top, 0px));
  }
  .vpn4all-chat-form {
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  }
  .vpn4all-chat-input {
    font-size: 16px; /* prevents iOS Safari auto-zoom on focus */
  }
  .vpn4all-chat-bubble {
    max-width: 90%;
  }
  .vpn4all-chat-popup {
    bottom: max(84px, calc(env(safe-area-inset-bottom, 0px) + 76px));
    right: 12px;
    left: 12px;
    max-width: none;
  }
}
