:root {
  --bg: linear-gradient(160deg, #eef4ff 0%, #f9fbff 42%, #e9f7f2 100%);
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: #ffffff;
  --border: rgba(24, 51, 79, 0.1);
  --text: #15324b;
  --muted: #66819b;
  --accent: #127369;
  --accent-strong: #0d5c54;
  --client: #127369;
  --admin: #edf4ff;
  --danger: #c0392b;
  --shadow: 0 24px 60px rgba(27, 65, 96, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

.layout,
.admin-layout {
  height: 100vh;
  padding: 32px;
}

.layout {
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.admin-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
}

.chat-shell,
.chat-list-panel {
  background: var(--panel);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.chat-shell {
  width: min(100%, 760px);
  height: min(78vh, 860px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.chat-shell-client {
  background: rgba(255, 255, 255, 0.76);
  border-color: rgba(255, 255, 255, 0.32);
  backdrop-filter: blur(22px);
  margin-top: 110px;
  overflow: visible;
}

.chat-monster {
  position: absolute;
  left: 24px;
  bottom: -26px;
  z-index: 4;
  width: 52px;
  height: 52px;
  pointer-events: none;
  animation: monsterRun 12s linear infinite;
}

.chat-monster-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) scale(0.8);
  min-width: 34px;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #7f42ff;
  font-size: 18px;
  line-height: 1;
  text-align: center;
  box-shadow: 0 10px 24px rgba(43, 28, 78, 0.16);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.chat-monster-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% - 2px);
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.9);
  transform: translateX(-50%) rotate(45deg);
}

.chat-monster-body {
  position: absolute;
  inset: 0;
  border-radius: 18px 18px 16px 16px;
  background: linear-gradient(160deg, #a35cff 0%, #7f42ff 52%, #4dd4c6 100%);
  box-shadow:
    0 10px 22px rgba(78, 43, 138, 0.28),
    0 0 18px rgba(163, 92, 255, 0.35);
  transform-origin: center bottom;
  animation: monsterBounce 0.7s ease-in-out infinite;
}

.chat-monster-body::before,
.chat-monster-body::after {
  content: "";
  position: absolute;
  top: -6px;
  width: 10px;
  height: 12px;
  border-radius: 10px 10px 2px 2px;
  background: #8d4eff;
}

.chat-monster-body::before {
  left: 10px;
  transform: rotate(-18deg);
}

.chat-monster-body::after {
  right: 10px;
  transform: rotate(18deg);
}

.chat-monster-eye {
  position: absolute;
  top: 16px;
  width: 9px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
}

.chat-monster-eye::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 4px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #15324b;
}

.chat-monster-eye-left {
  left: 14px;
}

.chat-monster-eye-right {
  right: 14px;
}

.chat-monster-mouth {
  position: absolute;
  left: 50%;
  bottom: 10px;
  width: 16px;
  height: 8px;
  transform: translateX(-50%);
  border-bottom: 3px solid rgba(255, 255, 255, 0.95);
  border-radius: 0 0 12px 12px;
}

.chat-monster[data-mood="excited"] .chat-monster-body {
  box-shadow:
    0 12px 26px rgba(78, 43, 138, 0.34),
    0 0 26px rgba(180, 118, 255, 0.65);
}

.chat-monster[data-mood="excited"] .chat-monster-bubble,
.chat-monster[data-mood="typing"] .chat-monster-bubble,
.chat-monster[data-mood="happy"] .chat-monster-bubble {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.chat-monster[data-mood="typing"] .chat-monster-body {
  animation-duration: 0.45s;
}

.chat-monster[data-mood="typing"] .chat-monster-eye::after {
  animation: monsterLook 0.8s ease-in-out infinite alternate;
}

.chat-monster[data-mood="happy"] .chat-monster-mouth {
  width: 20px;
  height: 10px;
  border-bottom-width: 4px;
}

.chat-monster-leg {
  position: absolute;
  bottom: -8px;
  width: 4px;
  height: 14px;
  border-radius: 999px;
  background: #5d2bc5;
  transform-origin: top center;
}

.chat-monster-leg-1 {
  left: 10px;
  animation: monsterLegLeft 0.35s ease-in-out infinite;
}

.chat-monster-leg-2 {
  left: 19px;
  animation: monsterLegRight 0.35s ease-in-out infinite;
}

.chat-monster-leg-3 {
  right: 19px;
  animation: monsterLegLeft 0.35s ease-in-out infinite 0.1s;
}

.chat-monster-leg-4 {
  right: 10px;
  animation: monsterLegRight 0.35s ease-in-out infinite 0.1s;
}

.support-hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.support-hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.52), transparent 32%),
    linear-gradient(145deg, rgba(7, 42, 34, 0.42), rgba(18, 115, 105, 0.14) 52%, rgba(238, 244, 255, 0.4));
}

.support-hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.28;
  transform: scale(1.06);
  filter: saturate(1.1) blur(1px);
}

.support-hero-glow {
  position: absolute;
  width: 36vw;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(120, 255, 198, 0.34), rgba(120, 255, 198, 0));
  filter: blur(18px);
  animation: heroGlow 11s ease-in-out infinite;
}

.support-hero-glow-left {
  left: -8vw;
  bottom: -10vh;
}

.support-hero-glow-right {
  right: -6vw;
  top: -8vh;
  animation-delay: -5s;
}

.support-floating-text {
  position: absolute;
  left: 50%;
  top: 24px;
  margin: 0;
  padding: 16px 28px;
  z-index: 3;
  font-size: clamp(26px, 4vw, 58px);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fffaff;
  background: linear-gradient(135deg, rgba(126, 87, 194, 0.44), rgba(255, 255, 255, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  box-shadow:
    0 0 0 1px rgba(178, 137, 255, 0.18) inset,
    0 0 26px rgba(168, 111, 255, 0.42),
    0 10px 40px rgba(58, 31, 94, 0.28);
  backdrop-filter: blur(14px);
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.55),
    0 0 24px rgba(186, 128, 255, 0.55);
  animation: topBannerDrift 16s ease-in-out infinite, neonPulse 2.8s ease-in-out infinite;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100% - 48px);
  text-align: center;
}

.admin-chat-shell {
  width: 100%;
}

.chat-list-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: calc(100vh - 64px);
  overflow: hidden;
}

.chat-header,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--border);
}

.panel-header {
  flex-direction: column;
  align-items: flex-start;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

h1,
h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 32px);
}

.messages {
  padding: 24px;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {
  max-width: min(80%, 520px);
  padding: 14px 16px;
  border-radius: 18px;
  line-height: 1.45;
  box-shadow: 0 8px 18px rgba(21, 50, 75, 0.07);
}

.message-client {
  align-self: flex-end;
  background: var(--client);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.message-admin {
  align-self: flex-start;
  background: var(--admin);
  color: var(--text);
  border-bottom-left-radius: 6px;
}

.message-meta {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  opacity: 0.72;
}

.attachment-link {
  display: inline-block;
  margin-top: 10px;
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  word-break: break-word;
}

.attachment-image-link {
  display: block;
  margin-top: 10px;
}

.attachment-image {
  display: block;
  max-width: min(100%, 280px);
  max-height: 240px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 8px 20px rgba(21, 50, 75, 0.16);
  object-fit: cover;
  cursor: zoom-in;
}

.contact-card {
  display: grid;
  gap: 10px;
}

.contact-card p {
  margin: 0;
}

.contact-form {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.contact-form-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(21, 50, 75, 0.14);
  background: rgba(255, 255, 255, 0.92);
  font: inherit;
  color: inherit;
}

.contact-form-success {
  color: var(--accent-strong);
  font-weight: 600;
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(11, 17, 26, 0.82);
  backdrop-filter: blur(10px);
}

.image-preview-content {
  max-width: min(92vw, 1200px);
  max-height: 88vh;
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
  object-fit: contain;
  background: rgba(255, 255, 255, 0.08);
}

.image-preview-nav,
.image-preview-close {
  position: absolute;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.image-preview-close {
  top: 20px;
  right: 20px;
}

.image-preview-nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 40px;
}

.image-preview-prev {
  left: 20px;
}

.image-preview-next {
  right: 20px;
}

.image-preview-nav:hover,
.image-preview-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.image-preview-nav.hidden {
  display: none;
}

.chat-footer {
  border-top: 1px solid var(--border);
  padding: 18px 24px 24px;
  background: rgba(255, 255, 255, 0.78);
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.composer-input {
  width: 100%;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(18, 115, 105, 0.18);
  background: var(--panel-strong);
  font-size: 15px;
  outline: none;
}

.composer-input:focus {
  border-color: rgba(18, 115, 105, 0.6);
  box-shadow: 0 0 0 4px rgba(18, 115, 105, 0.08);
}

.composer-button {
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  padding: 0 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.composer-button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.composer-button:disabled,
.composer-input:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.status-online {
  background: rgba(18, 115, 105, 0.12);
  color: var(--accent-strong);
}

.status-connecting {
  background: rgba(217, 148, 0, 0.12);
  color: #8b5e00;
}

.status-offline {
  background: rgba(192, 57, 43, 0.12);
  color: var(--danger);
}

.typing-indicator,
.error-box,
.empty-state {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
}

.error-box {
  color: var(--danger);
}

.hidden {
  display: none;
}

.chat-list {
  overflow-y: auto;
  padding: 12px;
}

.chat-list-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 16px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.chat-list-item:hover,
.chat-list-item.active {
  background: rgba(255, 255, 255, 0.74);
  border-color: rgba(18, 115, 105, 0.14);
  transform: translateY(-1px);
}

.chat-list-top,
.chat-list-bottom {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.chat-list-top strong {
  font-size: 15px;
}

.chat-list-bottom {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.unread-badge {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

@keyframes topBannerDrift {
  0% {
    left: 50%;
    top: 24px;
    transform: translate3d(-50%, 0, 0) rotate(-2deg);
  }

  30% {
    left: 56%;
    top: 40px;
    transform: translate3d(-50%, -6px, 0) rotate(1deg);
  }

  65% {
    left: 44%;
    top: 32px;
    transform: translate3d(-50%, -10px, 0) rotate(-1deg);
  }

  100% {
    left: 50%;
    top: 24px;
    transform: translate3d(-50%, 0, 0) rotate(-2deg);
  }
}

@keyframes heroGlow {
  0%,
  100% {
    transform: scale(1) translate3d(0, 0, 0);
  }

  50% {
    transform: scale(1.12) translate3d(16px, -10px, 0);
  }
}

@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .chat-list-panel {
    min-height: 320px;
  }

  .chat-shell {
    height: min(74vh, 760px);
  }
}

@media (max-width: 640px) {
  .layout,
  .admin-layout {
    padding: 16px;
  }

  body {
    overflow: auto;
  }

  .layout,
  .admin-layout {
    height: auto;
    min-height: 100vh;
  }

  .chat-shell,
  .chat-list-panel {
    border-radius: 22px;
  }

  .chat-shell {
    height: calc(100vh - 128px);
    min-height: 560px;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .composer-button {
    min-height: 52px;
  }

  .message {
    max-width: 92%;
  }

  .support-floating-text {
    top: 18px;
    max-width: calc(100% - 32px);
    line-height: 1.05;
    padding: 14px 20px;
    white-space: normal;
    animation: topBannerDriftMobile 12s ease-in-out infinite, neonPulse 2.8s ease-in-out infinite;
  }

  .support-hero-video {
    opacity: 0.22;
  }

  .chat-shell-client {
    margin-top: 96px;
  }
}

@keyframes topBannerDriftMobile {
  0% {
    left: 50%;
    top: 18px;
    transform: translate3d(-50%, 0, 0);
  }

  50% {
    left: 50%;
    top: 30px;
    transform: translate3d(-50%, -6px, 0);
  }

  100% {
    left: 50%;
    top: 18px;
    transform: translate3d(-50%, 0, 0);
  }
}

@keyframes neonPulse {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(178, 137, 255, 0.18) inset,
      0 0 18px rgba(168, 111, 255, 0.28),
      0 10px 30px rgba(58, 31, 94, 0.22);
    text-shadow:
      0 0 8px rgba(255, 255, 255, 0.48),
      0 0 18px rgba(186, 128, 255, 0.38);
  }

  50% {
    box-shadow:
      0 0 0 1px rgba(206, 175, 255, 0.28) inset,
      0 0 30px rgba(186, 128, 255, 0.58),
      0 0 56px rgba(159, 92, 255, 0.28),
      0 12px 42px rgba(58, 31, 94, 0.32);
    text-shadow:
      0 0 12px rgba(255, 255, 255, 0.72),
      0 0 28px rgba(202, 140, 255, 0.72);
  }
}

@keyframes monsterRun {
  0% {
    left: 24px;
  }

  50% {
    left: calc(100% - 84px);
    transform: scaleX(1);
  }

  50.1% {
    transform: scaleX(-1);
  }

  100% {
    left: 24px;
    transform: scaleX(-1);
  }
}

@keyframes monsterBounce {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-7px);
  }
}

@keyframes monsterLegLeft {
  0%,
  100% {
    transform: rotate(18deg);
  }

  50% {
    transform: rotate(-18deg);
  }
}

@keyframes monsterLegRight {
  0%,
  100% {
    transform: rotate(-18deg);
  }

  50% {
    transform: rotate(18deg);
  }
}

@keyframes monsterLook {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(1px);
  }
}

@media (max-width: 640px) {
  .chat-monster {
    width: 44px;
    height: 44px;
    bottom: -22px;
  }
}
