@import url("./local-fonts.css");

@keyframes supportPanelReveal {
  0% {
    opacity: 0;
    transform: translateY(-50%) translateX(18px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(-50%) translateX(0) scale(1);
  }
}

@keyframes supportBubblePulse {
  0% {
    transform: scale(1);
    box-shadow:
      0 18px 42px rgba(33, 20, 13, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.52);
  }
  100% {
    transform: scale(1.04);
    box-shadow:
      0 24px 50px rgba(33, 20, 13, 0.16),
      0 0 20px rgba(221, 192, 171, 0.22),
      inset 0 1px 0 rgba(255, 255, 255, 0.56);
  }
}

.support-widget {
  position: fixed;
  right: 18px;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: "Montserrat", "Segoe UI", Arial, sans-serif;
}

body.is-menu-open .support-widget {
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(-50% - 8px));
}

.support-bubble {
  width: 62px;
  min-width: 62px;
  height: 62px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 999px;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.16)),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.24), transparent 62%),
    rgba(255, 253, 251, 0.34);
  color: #171311;
  box-shadow:
    0 18px 42px rgba(33, 20, 13, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.52);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  cursor: pointer;
  position: relative;
  transition: transform 180ms ease, box-shadow 220ms ease, opacity 180ms ease;
}

.support-bubble-label {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(10px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 62px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.16)),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.2), transparent 62%),
    rgba(255, 253, 251, 0.26);
  color: #171311;
  box-shadow:
    0 18px 42px rgba(33, 20, 13, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(20px) saturate(145%);
  -webkit-backdrop-filter: blur(20px) saturate(145%);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.support-bubble-label::before {
  content: "";
  width: 18px;
  height: 18px;
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: block;
  background: url("../html_svg/chat.svg") center/contain no-repeat;
  filter: brightness(0) saturate(100%) opacity(0.68);
}

.support-widget:hover .support-bubble-label,
.support-bubble:focus-visible .support-bubble-label,
.support-bubble:hover .support-bubble-label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.support-bubble[aria-expanded="true"] .support-bubble-label,
.support-widget:hover .support-bubble[aria-expanded="true"] .support-bubble-label,
.support-bubble[aria-expanded="true"]:focus-visible .support-bubble-label,
.support-bubble[aria-expanded="true"]:hover .support-bubble-label {
  opacity: 0;
  transform: translateY(-50%) translateX(10px);
}

.support-bubble img {
  width: 28px;
  height: 28px;
  display: block;
  object-fit: contain;
  filter: brightness(0) saturate(100%) opacity(0.76);
}

.support-widget.is-open .support-bubble {
  animation: supportBubblePulse 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.support-bubble-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: #b64545;
  color: #fffdfb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(182, 69, 69, 0.28);
}

.support-panel {
  position: absolute;
  right: calc(100% + 14px);
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
  width: min(380px, calc(100vw - 28px));
  max-height: min(76vh, 700px);
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.24)),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.28), transparent 62%),
    rgba(255, 253, 251, 0.58);
  box-shadow:
    0 22px 44px rgba(35, 21, 13, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.54);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
  overflow: hidden;
  transform-origin: right center;
}

.support-panel[hidden] {
  display: none;
}

.support-widget.is-open .support-panel:not([hidden]) {
  animation: supportPanelReveal 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.support-chat-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(23, 19, 17, 0.08);
}

.support-chat-header-copy {
  display: grid;
  gap: 0;
  min-width: 0;
}

.support-chat-header-copy strong {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.support-chat-header-copy span {
  display: none;
}

.support-chat-header-copy:empty {
  display: none;
}

.support-chat-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(23, 19, 17, 0.08);
  color: #171311;
  font-size: 11px;
  font-weight: 700;
  text-transform: lowercase;
}

.support-chat-status-pill.is-resolved {
  background: rgba(125, 157, 138, 0.18);
  color: #425c4f;
}

.support-chat-status-pill.is-blocked {
  background: rgba(111, 98, 93, 0.14);
  color: #6f625d;
}

.support-close {
  border: 0;
  background: transparent;
  color: #6f625d;
  font-size: 0;
  padding: 0;
  width: 18px;
  height: 18px;
  position: relative;
}

.support-close::before,
.support-close::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 1px;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  border-radius: 999px;
}

.support-close::before {
  transform: rotate(45deg);
}

.support-close::after {
  transform: rotate(-45deg);
}

.support-status {
  margin: 14px 18px 0;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.45;
}

.support-status.is-error {
  color: #7a3535;
  background: rgba(167, 72, 72, 0.08);
  border: 1px solid rgba(167, 72, 72, 0.18);
}

.support-status.is-success {
  color: #425c4f;
  background: rgba(125, 157, 138, 0.12);
  border: 1px solid rgba(125, 157, 138, 0.18);
}

.support-conversation {
  padding: 14px 18px 18px;
  display: grid;
  gap: 12px;
}

.support-auth-gate {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(23, 19, 17, 0.08);
}

.support-auth-gate[hidden],
.support-form[hidden],
.support-grid[hidden],
[data-support-order-wrap][hidden] {
  display: none !important;
}

.support-auth-copy {
  margin: 0;
  color: #171311;
  font-size: 0.88rem;
  line-height: 1.55;
}

.support-auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.support-auth-button {
  flex: 1 1 132px;
  min-height: 42px;
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid rgba(23, 19, 17, 0.1);
  background: rgba(255, 255, 255, 0.92);
  color: #171311;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.support-auth-button.is-primary {
  background: #171311;
  color: #fffdfb;
}

.support-messages {
  display: grid;
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
  padding: 12px 10px 12px 4px;
  margin-bottom: 0;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.74), rgba(239, 226, 214, 0.5)),
    repeating-linear-gradient(45deg, rgba(199, 157, 127, 0.06), rgba(199, 157, 127, 0.06) 12px, transparent 12px, transparent 24px);
}

.support-messages[hidden] {
  display: none;
}

.support-empty {
  padding: 14px;
  border: 1px dashed rgba(23, 19, 17, 0.12);
  border-radius: 16px;
  color: #6f625d;
  font-size: 0.86rem;
  line-height: 1.55;
  background: rgba(255, 255, 255, 0.66);
}

.support-message {
  max-width: 86%;
  width: fit-content;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 24px rgba(35, 21, 13, 0.05);
}

.support-message.customer {
  justify-self: end;
  background: #dff4dc;
}

.support-message.admin {
  justify-self: start;
}

.support-message-body {
  font-size: 0.88rem;
  line-height: 1.55;
}

.support-message.customer .support-message-body {
  color: #171311;
}

.support-message.admin .support-message-body {
  color: #171311;
}

.support-message time {
  color: #8b7d77;
  font-size: 0.72rem;
  line-height: 1.3;
}

.support-message.customer time {
  text-align: right;
}

.support-form {
  display: grid;
  gap: 10px;
  padding-top: 4px;
  position: relative;
}

.support-form.is-thread-active {
  gap: 8px;
}

.support-panel.is-thread-active [data-support-guest-fields],
.support-panel.is-thread-active [data-support-order-wrap] {
  display: none !important;
}

.support-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.support-form label {
  display: grid;
  gap: 6px;
}

.support-form span {
  color: #6f625d;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

[data-support-message-label] {
  display: none !important;
}

.support-form input,
.support-form select,
.support-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(23, 19, 17, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  color: #171311;
  padding: 12px 14px;
  font: inherit;
}

.support-form span.is-required::after {
  content: " *";
  color: #b64545;
}

.support-form input.is-invalid,
.support-form textarea.is-invalid {
  border-color: rgba(182, 69, 69, 0.7);
  box-shadow: 0 0 0 1px rgba(182, 69, 69, 0.08);
}

.support-form textarea {
  min-height: 92px;
  max-height: 180px;
  resize: none;
  overflow-y: auto;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
}

.support-form input:focus,
.support-form select:focus,
.support-form textarea:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.92);
}

.support-form.is-thread-active textarea {
  min-height: 72px;
  max-height: 180px;
}

.support-form.is-readonly textarea,
.support-form.is-readonly input,
.support-form.is-readonly select {
  opacity: 0.72;
  cursor: not-allowed;
}

.support-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.support-panel.is-thread-active .support-conversation {
  grid-template-rows: minmax(0, 1fr) auto;
}

.support-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.support-send {
  border: 0;
  border-radius: 999px;
  background: #171311;
  color: #fffdfb;
  padding: 12px 18px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.support-send:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  body.is-menu-open .support-widget {
    opacity: 0;
    pointer-events: none;
    transform: translateY(calc(-50% - 8px));
  }

  .support-widget {
    top: 50%;
    right: 12px;
    bottom: auto;
    left: auto;
    align-items: flex-end;
    transform: translateY(-50%);
    transition: opacity 180ms ease, transform 180ms ease;
  }

  .support-bubble {
    min-width: 48px;
    width: 48px;
    height: 48px;
    padding: 0;
    gap: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .support-bubble-label {
    display: none;
  }

  .support-panel {
    width: min(340px, calc(100vw - 84px));
    right: calc(100% + 10px);
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    max-height: min(78vh, 640px);
  }

  .support-chat-header {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .support-chat-status-pill {
    display: none;
  }

  .support-bubble img {
    width: 24px;
    height: 24px;
  }

  .support-bubble-badge {
    top: -4px;
    right: -2px;
  }

  .support-grid {
    grid-template-columns: 1fr;
  }

  .support-message {
    max-width: 92%;
  }
}
