/**
 * Support Widget Styles
 * Professional chat widget matching dashboard design
 */

/* === Widget Container === */
.support-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: inherit;
}

/* === Floating Button === */
.support-widget__button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6576ff 0%, #8094ff 100%);
  border: none;
  box-shadow: 0 4px 16px rgba(101, 118, 255, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.support-widget__button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(101, 118, 255, 0.5);
}

.support-widget__button:active {
  transform: scale(0.95);
}

.support-widget__button-icon {
  width: 28px;
  height: 28px;
  color: #ffffff;
  transition: all 0.3s ease;
  position: absolute;
}

.support-widget__button-icon--chat {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.support-widget__button-icon--close {
  opacity: 0;
  transform: rotate(180deg) scale(0);
}

.support-widget.is-open .support-widget__button-icon--chat {
  opacity: 0;
  transform: rotate(-180deg) scale(0);
}

.support-widget.is-open .support-widget__button-icon--close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* === Chat Window === */
.support-widget__window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 550px;
  max-height: calc(100vh - 140px);
  background: var(--nk-body-bg, #ffffff);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: scale(0.8) translateY(20px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  overflow: hidden;
}

.support-widget.is-open .support-widget__window {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

/* === Header === */
.support-widget__header {
  background: linear-gradient(135deg, #6576ff 0%, #8094ff 100%);
  color: #ffffff;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.support-widget__header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.support-widget__header-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.support-widget__header-icon svg {
  width: 20px;
  height: 20px;
  color: #ffffff;
}

.support-widget__header-text {
  flex: 1;
}

.support-widget__header-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.support-widget__header-subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  opacity: 0.9;
  line-height: 1.3;
}

.support-widget__close {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.support-widget__close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.support-widget__close svg {
  width: 18px;
  height: 18px;
  color: #ffffff;
}

/* === Messages Area === */
.support-widget__messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--nk-body-bg, #f5f6fa);
  scrollbar-width: thin;
  scrollbar-color: rgba(101, 118, 255, 0.3) transparent;
}

.support-widget__messages::-webkit-scrollbar {
  width: 6px;
}

.support-widget__messages::-webkit-scrollbar-track {
  background: transparent;
}

.support-widget__messages::-webkit-scrollbar-thumb {
  background: rgba(101, 118, 255, 0.3);
  border-radius: 3px;
}

.support-widget__messages::-webkit-scrollbar-thumb:hover {
  background: rgba(101, 118, 255, 0.5);
}

/* === Message === */
.support-widget__message {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.support-widget__message--user {
  flex-direction: row-reverse;
}

.support-widget__message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #6576ff 0%, #8094ff 100%);
}

.support-widget__message--user .support-widget__message-avatar {
  background: linear-gradient(135deg, #3ecf8e 0%, #50e3a7 100%);
}

.support-widget__message-avatar svg {
  width: 18px;
  height: 18px;
  color: #ffffff;
}

.support-widget__message-content {
  flex: 1;
  max-width: 75%;
}

.support-widget__message-bubble {
  background: #ffffff;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--nk-text-base, #364a63);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  word-wrap: break-word;
}

.support-widget__message--user .support-widget__message-bubble {
  background: linear-gradient(135deg, #6576ff 0%, #8094ff 100%);
  color: #ffffff;
}

/* === Input Area === */
.support-widget__input-area {
  padding: 16px 20px;
  background: var(--nk-body-bg, #ffffff);
  border-top: 1px solid var(--nk-border-light, #e5e9f2);
  flex-shrink: 0;
}

.support-widget__form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.support-widget__input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--nk-border-light, #e5e9f2);
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
  background: var(--nk-body-bg, #ffffff);
  color: var(--nk-text-base, #364a63);
}

.support-widget__input:focus {
  border-color: #6576ff;
  box-shadow: 0 0 0 3px rgba(101, 118, 255, 0.1);
}

.support-widget__send-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6576ff 0%, #8094ff 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.support-widget__send-button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(101, 118, 255, 0.4);
}

.support-widget__send-button:active {
  transform: scale(0.95);
}

.support-widget__send-button svg {
  width: 20px;
  height: 20px;
  color: #ffffff;
}

.support-widget__send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* === Loading === */
.support-widget__loading {
  padding: 8px 0;
  text-align: center;
}

.support-widget__loading-dots {
  display: inline-flex;
  gap: 6px;
}

.support-widget__loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6576ff;
  animation: loadingDot 1.4s infinite;
}

.support-widget__loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.support-widget__loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loadingDot {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* === Dark Mode Support === */
.dark-mode .support-widget__window {
  background: #1c2b46;
}

.dark-mode .support-widget__messages {
  background: #1c2b46;
}

.dark-mode .support-widget__message-bubble {
  background: #283652;
  color: #c4cefe;
}

.dark-mode .support-widget__message--user .support-widget__message-bubble {
  background: linear-gradient(135deg, #6576ff 0%, #8094ff 100%);
  color: #ffffff;
}

.dark-mode .support-widget__input-area {
  background: #1c2b46;
  border-top-color: #2d3f5f;
}

.dark-mode .support-widget__input {
  background: #283652;
  border-color: #2d3f5f;
  color: #c4cefe;
}

.dark-mode .support-widget__input::placeholder {
  color: #6e7a91;
}

/* === Mobile Responsive === */
@media (max-width: 480px) {
  .support-widget {
    bottom: 16px;
    left: 16px;
    right: 16px;
  }

  .support-widget__window {
    width: 100%;
    max-width: none;
    left: auto;
    right: 0;
    bottom: 76px;
  }

  .support-widget__button {
    width: 56px;
    height: 56px;
  }

  .support-widget__button-icon {
    width: 24px;
    height: 24px;
  }
}
