.sw-chat-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2140;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: "Sora", "Segoe UI", Arial, sans-serif;
  color: #eef5ff;
}

.sw-chat-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 18px;
  border: 1px solid rgba(170, 222, 255, 0.28);
  border-radius: 999px;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.18), transparent 34%),
    linear-gradient(145deg, rgba(18, 35, 61, 0.96), rgba(7, 16, 29, 0.92));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
  color: #eef5ff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.sw-chat-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.42);
}

.sw-chat-toggle-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: linear-gradient(135deg, #84d4ff, #6de2ba);
  box-shadow: 0 0 18px rgba(109, 226, 186, 0.62);
  flex: 0 0 auto;
}

.sw-chat-toggle-badge {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ffb56d, #ff7e9b);
  color: #08101c;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(255, 126, 155, 0.35);
}

.sw-chat-toggle-badge[hidden] {
  display: none !important;
}

.sw-chat-panel {
  width: min(380px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  height: min(560px, calc(100vh - 110px));
  border-radius: 24px;
  border: 1px solid rgba(180, 226, 255, 0.22);
  background:
    radial-gradient(circle at 14% 10%, rgba(255, 255, 255, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(14, 26, 43, 0.98), rgba(8, 15, 27, 0.97));
  backdrop-filter: blur(16px);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  display: none;
}

.sw-chat-widget.is-open .sw-chat-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.sw-chat-header {
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(188, 228, 255, 0.12);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sw-chat-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.sw-chat-subtitle {
  margin: 6px 0 0;
  color: rgba(228, 239, 255, 0.7);
  font-size: 12px;
  line-height: 1.5;
}

.sw-chat-close {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(188, 228, 255, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #eef5ff;
  cursor: pointer;
  font-size: 16px;
}

.sw-chat-messages {
  padding: 16px 18px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sw-chat-empty {
  border: 1px dashed rgba(184, 224, 255, 0.2);
  border-radius: 18px;
  padding: 18px 16px;
  color: rgba(228, 239, 255, 0.76);
  font-size: 13px;
  line-height: 1.55;
  background: rgba(255, 255, 255, 0.03);
}

.sw-chat-bubble {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 18px;
  line-height: 1.45;
  font-size: 14px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.18);
}

.sw-chat-bubble.is-user {
  align-self: flex-end;
  border-top-right-radius: 6px;
  background: linear-gradient(135deg, rgba(120, 190, 255, 0.26), rgba(86, 151, 255, 0.18));
  border: 1px solid rgba(134, 198, 255, 0.26);
}

.sw-chat-bubble.is-admin {
  align-self: flex-start;
  border-top-left-radius: 6px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(123, 228, 205, 0.07));
  border: 1px solid rgba(186, 228, 255, 0.15);
}

.sw-chat-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: rgba(228, 239, 255, 0.58);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sw-chat-compose {
  border-top: 1px solid rgba(188, 228, 255, 0.12);
  padding: 14px 18px 18px;
  display: grid;
  gap: 10px;
}

.sw-chat-status {
  min-height: 18px;
  color: rgba(228, 239, 255, 0.7);
  font-size: 12px;
}

.sw-chat-status.is-error {
  color: #ffb1c1;
}

.sw-chat-textarea {
  width: 100%;
  min-height: 94px;
  resize: vertical;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(188, 228, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: #eef5ff;
  font: inherit;
}

.sw-chat-textarea::placeholder {
  color: rgba(228, 239, 255, 0.42);
}

.sw-chat-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sw-chat-hint {
  color: rgba(228, 239, 255, 0.56);
  font-size: 11px;
  line-height: 1.45;
}

.sw-chat-send {
  min-width: 118px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(188, 228, 255, 0.2);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(108, 194, 255, 0.24), rgba(92, 232, 188, 0.22));
  color: #eef5ff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.sw-chat-send:disabled,
.sw-chat-textarea:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.sw-legal-footer {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 2130;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 6px 14px;
  border: 1px solid rgba(176, 220, 255, 0.24);
  border-radius: 999px;
  background: rgba(7, 15, 28, 0.72);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
  font-family: "Sora", "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  line-height: 1.3;
  color: rgba(232, 242, 255, 0.92);
}

.sw-legal-link {
  color: rgba(220, 238, 255, 0.92);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.sw-legal-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

.sw-legal-sep {
  color: rgba(220, 238, 255, 0.46);
}

@media (max-width: 640px) {
  .sw-legal-footer {
    left: 10px;
    right: 10px;
    bottom: 82px;
    transform: none;
    justify-content: center;
    flex-wrap: wrap;
    text-align: center;
    border-radius: 14px;
    padding: 7px 10px;
  }

  .sw-legal-link {
    white-space: normal;
  }

  .sw-chat-widget {
    right: 10px;
    bottom: 10px;
    left: auto;
    align-items: flex-end;
    max-width: calc(100vw - 20px);
  }

  .sw-chat-toggle {
    width: auto;
    max-width: min(178px, calc(100vw - 20px));
    min-height: 42px;
    padding: 0 11px;
    gap: 7px;
    justify-content: flex-end;
    font-size: 12px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
  }

  .sw-chat-toggle-dot {
    width: 9px;
    height: 9px;
  }

  .sw-chat-toggle-badge {
    min-width: 21px;
    height: 21px;
    padding: 0 6px;
    font-size: 11px;
  }

  .sw-chat-toggle > span:not(.sw-chat-toggle-dot):not(.sw-chat-toggle-badge) {
    overflow: hidden;
    max-width: 104px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sw-chat-panel {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    height: min(76vh, 620px);
  }

  .sw-chat-widget.is-open {
    left: 10px;
    right: 10px;
    align-items: stretch;
    max-width: none;
  }

  .sw-chat-widget.is-open .sw-chat-toggle {
    align-self: flex-end;
  }
}
