.chat-widget-root {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 9999;
  font-family: var(--font-bn-ui, 'Noto Sans Bengali', sans-serif), system-ui, sans-serif;
}

.chat-widget-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #0fa996, #0d8a7a);
  color: #fff;
  box-shadow: 0 8px 28px rgba(15, 169, 150, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
}

.chat-widget-toggle-icon {
  width: 30px;
  height: 30px;
  display: block;
}

.chat-widget-toggle-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  padding: 2px 5px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  color: #0d8a7a;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.chat-widget-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 32px rgba(15, 169, 150, 0.55);
}

.chat-widget-panel {
  display: none;
  position: absolute;
  bottom: 68px;
  right: 0;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 100px));
  background: #0f1820;
  border: 1px solid rgba(15, 169, 150, 0.35);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  flex-direction: column;
  overflow: hidden;
}

.chat-widget-panel.is-open {
  display: flex;
}

.chat-widget-header {
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(15, 169, 150, 0.25), transparent);
  border-bottom: 1px solid rgba(15, 169, 150, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.chat-widget-header strong {
  font-size: 0.95rem;
  color: #e8f0ee;
}

.chat-widget-close {
  background: none;
  border: none;
  color: #8aa8a3;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}

.chat-widget-user-bar {
  padding: 10px 14px;
  background: rgba(15, 169, 150, 0.12);
  border-bottom: 1px solid rgba(15, 169, 150, 0.2);
  font-size: 0.82rem;
  color: #c5ddd8;
  flex-shrink: 0;
}

.chat-widget-user-bar strong {
  color: #e8f0ee;
  display: block;
  margin-bottom: 2px;
}

.chat-widget-user-bar span {
  color: #8aa8a3;
  font-size: 0.78rem;
}

.chat-widget-guest-form {
  padding: 16px;
  flex: 1;
  overflow-y: auto;
}

.chat-widget-guest-lead {
  margin: 0 0 14px;
  font-size: 0.88rem;
  color: #8aa8a3;
  line-height: 1.5;
}

.chat-widget-field {
  display: block;
  margin-bottom: 12px;
}

.chat-widget-field span {
  display: block;
  font-size: 0.75rem;
  color: #8aa8a3;
  margin-bottom: 4px;
}

.chat-widget-field input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(15, 169, 150, 0.3);
  border-radius: 10px;
  padding: 10px 12px;
  background: #0c1218;
  color: #e8f0ee;
  font-size: 0.9rem;
  font-family: inherit;
}

.chat-widget-field input:focus {
  outline: none;
  border-color: #0fa996;
}

.chat-widget-chat-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.chat-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bubble--user {
  align-self: flex-end;
  background: #0fa996;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble--assistant,
.chat-bubble--admin {
  align-self: flex-start;
  background: #1a2832;
  color: #e8f0ee;
  border: 1px solid rgba(15, 169, 150, 0.15);
  border-bottom-left-radius: 4px;
}

.chat-bubble--admin {
  border-color: rgba(245, 158, 11, 0.35);
}

.chat-bubble__label {
  font-size: 0.65rem;
  opacity: 0.75;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chat-bubble__link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.chat-bubble__link:hover {
  opacity: 0.9;
}

.chat-bubble--user .chat-bubble__link {
  color: #fff;
}

.chat-bubble--assistant .chat-bubble__link,
.chat-bubble--admin .chat-bubble__link {
  color: #5eead4;
}

.chat-widget-typing {
  font-size: 0.8rem;
  color: #8aa8a3;
  padding: 0 14px 4px;
  display: none;
  flex-shrink: 0;
}

.chat-widget-typing.is-visible {
  display: block;
}

.chat-widget-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(15, 169, 150, 0.2);
  background: #0c1218;
  flex-shrink: 0;
}

.chat-widget-input {
  flex: 1;
  border: 1px solid rgba(15, 169, 150, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  background: #0f1820;
  color: #e8f0ee;
  font-size: 0.88rem;
  resize: none;
  min-height: 42px;
  max-height: 100px;
  font-family: inherit;
}

.chat-widget-input::placeholder {
  color: #6d8a84;
  opacity: 1;
}

.chat-widget-input:focus {
  outline: none;
  border-color: #0fa996;
}

.chat-widget-input:focus::placeholder {
  color: #5a7570;
}

.chat-widget-send {
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  background: #0fa996;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.chat-widget-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-widget-guest-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 20px;
  padding: 14px 20px;
  min-height: 52px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, #12b8a4 0%, #0fa996 45%, #0d8a7a 100%);
  box-shadow:
    0 4px 14px rgba(15, 169, 150, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    opacity 0.2s ease;
}

.chat-widget-guest-submit__icon,
.chat-widget-guest-submit__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-widget-guest-submit__icon svg {
  width: 20px;
  height: 20px;
  opacity: 0.95;
}

.chat-widget-guest-submit__arrow svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.chat-widget-guest-submit__label {
  flex: 1;
  text-align: center;
}

.chat-widget-guest-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #14c9b3 0%, #11b5a3 45%, #0e9585 100%);
  box-shadow:
    0 8px 22px rgba(15, 169, 150, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.chat-widget-guest-submit:hover:not(:disabled) .chat-widget-guest-submit__arrow svg {
  transform: translateX(3px);
}

.chat-widget-guest-submit:active:not(:disabled) {
  transform: translateY(0);
  box-shadow:
    0 2px 8px rgba(15, 169, 150, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.chat-widget-guest-submit:focus-visible {
  outline: 2px solid #5eead4;
  outline-offset: 3px;
}

.chat-widget-guest-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
