/**
 * Camp Easy Support — floating chat widget.
 */

.ce-support {
  --ce-s-charcoal: #1f2a36;
  --ce-s-fog: #e9ede7;
  --ce-s-orange: #ff9900;
  --ce-s-orange-deep: #e07e00;
  --ce-s-green: #2a4937;
  --ce-s-white: #ffffff;
  --ce-s-line: rgba(31, 42, 54, 0.14);
  --ce-s-shadow: 0 18px 40px rgba(31, 42, 54, 0.18);
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 99990;
  font-family: Karla, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ce-s-charcoal);
}

.ce-support .screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

.ce-support__launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--ce-s-orange);
  color: var(--ce-s-charcoal);
  box-shadow: var(--ce-s-shadow);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.ce-support__launcher:hover,
.ce-support__launcher:focus-visible {
  background: var(--ce-s-orange-deep);
  transform: translateY(-2px);
  outline: none;
}

.ce-support__launcher-icon {
  display: flex;
}

.ce-support__badge {
  position: absolute;
  top: -0.15rem;
  right: -0.1rem;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: #d01414;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
  box-shadow: 0 2px 6px rgba(31, 42, 54, 0.25);
  animation: ce-support-badge-pulse 1.6s ease-in-out infinite;
}

.ce-support__badge[hidden] {
  display: none !important;
}

@keyframes ce-support-badge-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

.ce-support__panel {
  position: absolute;
  right: 0;
  bottom: calc(3.5rem + 0.75rem);
  display: flex;
  flex-direction: column;
  width: min(100vw - 2rem, 22.5rem);
  height: min(70vh, 32rem);
  background: var(--ce-s-white);
  border: 1px solid var(--ce-s-line);
  border-radius: 16px;
  box-shadow: var(--ce-s-shadow);
  overflow: hidden;
  animation: ce-support-in 0.22s ease;
  transition: width 0.2s ease, height 0.2s ease, right 0.2s ease, bottom 0.2s ease, border-radius 0.2s ease;
}

.ce-support.is-maximized {
  right: 0;
  bottom: 0;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.ce-support.is-maximized .ce-support__launcher {
  display: none;
}

.ce-support.is-maximized .ce-support__panel {
  position: fixed;
  inset: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  border-radius: 0;
  border: 0;
}

.ce-support__panel[hidden] {
  display: none !important;
}

@keyframes ce-support-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ce-support__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, var(--ce-s-green), #1a3226);
  color: var(--ce-s-fog);
  flex-shrink: 0;
}

.ce-support__title {
  margin: 0;
  font-family: Anton, Karla, sans-serif;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.ce-support__subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  opacity: 0.85;
}

.ce-support__actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.ce-support__icon-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  opacity: 0.85;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.ce-support__icon-btn:hover,
.ce-support__icon-btn:focus-visible {
  opacity: 1;
  outline: none;
  background: rgba(255, 255, 255, 0.1);
}

.ce-support__close {
  font-size: 1.5rem;
}

.ce-support__messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: linear-gradient(180deg, #f4f6f2 0%, var(--ce-s-white) 40%);
}

.ce-support.is-maximized .ce-support__messages {
  max-width: 48rem;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.ce-support__bubble {
  max-width: 92%;
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  word-break: break-word;
}

.ce-support.is-maximized .ce-support__bubble {
  max-width: 70%;
}

.ce-support__bubble--assistant {
  margin-right: auto;
  background: var(--ce-s-fog);
  color: var(--ce-s-charcoal);
  border-bottom-left-radius: 4px;
}

.ce-support__bubble--user {
  margin-left: auto;
  background: var(--ce-s-charcoal);
  color: var(--ce-s-white);
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}

.ce-support__bubble--typing {
  opacity: 0.7;
  font-style: italic;
  white-space: pre-wrap;
}

.ce-support__bubble p {
  margin: 0 0 0.55em;
}

.ce-support__bubble p:last-child {
  margin-bottom: 0;
}

.ce-support__bubble ul,
.ce-support__bubble ol {
  margin: 0.35em 0 0.55em;
  padding-left: 1.25em;
}

.ce-support__bubble li {
  margin: 0.2em 0;
}

.ce-support__bubble strong {
  font-weight: 700;
}

.ce-support__heading {
  display: block;
  margin: 0.35em 0 0.45em;
  font-weight: 700;
  font-size: 1.02em;
}

.ce-support__img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0.45rem 0;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(31, 42, 54, 0.06);
}

.ce-support__bubble em {
  font-style: italic;
}

.ce-support__bubble a {
  color: var(--ce-s-green);
  text-decoration: underline;
  word-break: break-all;
}

.ce-support__bubble--user a {
  color: #ffe0a8;
}

.ce-support__bubble code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(31, 42, 54, 0.08);
  padding: 0.1em 0.3em;
  border-radius: 4px;
}

.ce-support__form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  padding: 0.75rem 0.75rem 0.35rem;
  border-top: 1px solid var(--ce-s-line);
  background: var(--ce-s-white);
  flex-shrink: 0;
}

.ce-support.is-maximized .ce-support__form,
.ce-support.is-maximized .ce-support__note {
  max-width: 48rem;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.ce-support__input {
  width: 100%;
  min-height: 4.5rem;
  max-height: 10rem;
  resize: none;
  border: 1px solid var(--ce-s-line);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  font: inherit;
  font-size: 1rem;
  line-height: 1.45;
  color: inherit;
  background: #fafbf9;
}

.ce-support__input:focus {
  outline: 2px solid rgba(255, 153, 0, 0.45);
  outline-offset: 1px;
  border-color: var(--ce-s-orange);
}

.ce-support__send {
  align-self: end;
  border: 0;
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  background: var(--ce-s-orange);
  color: var(--ce-s-charcoal);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.ce-support__send:hover,
.ce-support__send:focus-visible {
  background: var(--ce-s-orange-deep);
  outline: none;
}

.ce-support__send:disabled,
.ce-support__input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ce-support__note {
  margin: 0;
  padding: 0 0.9rem 0.85rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: rgba(31, 42, 54, 0.72);
  background: var(--ce-s-white);
  flex-shrink: 0;
}

.ce-support__callback {
  padding: 0.75rem 0.9rem 0.85rem;
  border-top: 1px solid var(--ce-s-line);
  background: #f7f9f5;
  flex-shrink: 0;
}

.ce-support__callback[hidden] {
  display: none !important;
}

.ce-support__callback-title {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ce-s-charcoal);
}

.ce-support__callback-form {
  display: grid;
  gap: 0.5rem;
}

.ce-support__callback-form label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(31, 42, 54, 0.8);
}

.ce-support__callback-form input {
  width: 100%;
  border: 1px solid var(--ce-s-line);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  font: inherit;
  font-size: 0.95rem;
  background: var(--ce-s-white);
  color: var(--ce-s-charcoal);
}

.ce-support__callback-form input:focus {
  outline: 2px solid rgba(255, 153, 0, 0.45);
  outline-offset: 1px;
  border-color: var(--ce-s-orange);
}

.ce-support__callback-hint {
  margin: 0;
  font-size: 0.72rem;
  color: rgba(31, 42, 54, 0.65);
}

.ce-support__callback-error {
  margin: 0;
  font-size: 0.78rem;
  color: #b42318;
}

.ce-support__callback-error[hidden] {
  display: none !important;
}

.ce-support__callback-actions {
  display: grid;
  gap: 0.45rem;
}

.ce-support__callback-submit,
.ce-support__callback-cancel {
  border: 0;
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.ce-support__callback-submit {
  background: var(--ce-s-orange);
  color: var(--ce-s-charcoal);
}

.ce-support__callback-submit:hover,
.ce-support__callback-submit:focus-visible {
  background: var(--ce-s-orange-deep);
  outline: none;
}

.ce-support__callback-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ce-support__callback-cancel {
  background: transparent;
  color: var(--ce-s-charcoal);
  border: 1px solid var(--ce-s-line);
}

.ce-support__callback-cancel:hover,
.ce-support__callback-cancel:focus-visible {
  background: rgba(31, 42, 54, 0.06);
  outline: none;
}

.ce-support.is-maximized .ce-support__callback {
  max-width: 48rem;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: 1rem 1.5rem 1.15rem;
}

.ce-support.is-maximized .ce-support__callback-form {
  grid-template-columns: 1fr 1fr;
}

.ce-support.is-maximized .ce-support__callback-title,
.ce-support.is-maximized .ce-support__callback-form label:first-of-type,
.ce-support.is-maximized .ce-support__callback-hint,
.ce-support.is-maximized .ce-support__callback-error,
.ce-support.is-maximized .ce-support__callback-actions {
  grid-column: 1 / -1;
}

.ce-support.is-maximized .ce-support__callback-actions {
  grid-template-columns: 1fr auto;
}

.ce-support.is-maximized .ce-support__callback-form input {
  padding: 0.7rem 0.8rem;
  font-size: 1rem;
}

.ce-support__note-mail {
  color: var(--ce-s-green);
  font-weight: 600;
  text-decoration: underline;
  word-break: break-all;
}

@media (max-width: 480px) {
  .ce-support {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .ce-support:not(.is-maximized) .ce-support__panel {
    width: calc(100vw - 1.5rem);
    height: min(75vh, 30rem);
  }

  .ce-support.is-maximized .ce-support__bubble {
    max-width: 92%;
  }
}
