/**
 * Site chat — composer, empty state, guest bar, emoji picker
 */

/* —— Footer / composer —— */
.site-chat-footer {
  border-top: 1px solid rgba(22, 119, 255, 0.18);
  background: linear-gradient(
    0deg,
    rgba(14, 19, 28, 0.98) 0%,
    rgba(18, 24, 36, 0.92) 55%,
    rgba(22, 119, 255, 0.04) 100%
  );
  box-shadow:
    0 -8px 24px -12px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 0.75rem 0.875rem max(0.75rem, env(safe-area-inset-bottom));
}

.site-chat-composer {
  width: 100%;
}

.site-chat-composer__bar {
  display: flex;
  align-items: flex-end;
  gap: 0.375rem;
  padding: 0.375rem 0.375rem 0.375rem 0.5rem;
  border-radius: 1rem;
  border: 1px solid rgba(22, 119, 255, 0.32);
  background: rgba(12, 16, 24, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 4px 16px -8px rgba(0, 0, 0, 0.45);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.site-chat-composer__bar:focus-within {
  border-color: rgba(64, 150, 255, 0.55);
  background: rgba(14, 20, 32, 0.88);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 0 0 3px rgba(22, 119, 255, 0.14),
    0 4px 20px -6px rgba(22, 119, 255, 0.25);
}

.site-chat-composer__emoji {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.0625rem;
  padding: 0;
  border: none;
  border-radius: 0.75rem;
  color: #94a3b8;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    transform 0.12s ease;
}

.site-chat-composer__emoji:hover:not(:disabled) {
  color: #cbd5e1;
  background: rgba(22, 119, 255, 0.1);
}

.site-chat-composer__emoji:active:not(:disabled) {
  transform: scale(0.94);
  background: rgba(22, 119, 255, 0.16);
}

.site-chat-composer__emoji[aria-expanded="true"] {
  color: var(--site-accent-bright, #91caff);
  background: rgba(22, 119, 255, 0.18);
}

.site-chat-composer__emoji:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.site-chat-composer__emoji svg {
  display: block;
  width: 1.375rem;
  height: 1.375rem;
}

.site-chat-composer__input-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
}

.site-chat-composer__input,
.site-chat-input.site-chat-composer__input {
  display: block;
  width: 100%;
  min-height: 2.5rem;
  max-height: 7rem;
  margin: 0;
  padding: 0.5rem 0.25rem 0.5rem 0;
  border: none;
  border-radius: 0;
  color: #f1f5f9;
  background: transparent;
  box-shadow: none;
  resize: none;
  font-size: 0.9375rem;
  line-height: 1.45;
  outline: none;
  transition: none;
}

.site-chat-composer__input::placeholder {
  color: #64748b;
}

.site-chat-composer__input:focus {
  border: none;
  background: transparent;
  box-shadow: none;
  outline: none;
}

.site-chat-composer__input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.site-chat-composer__send,
.site-chat-send.site-chat-composer__send {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.0625rem;
  padding: 0 !important;
  min-width: 2.5rem;
  border: none;
  border-radius: 0.75rem;
  color: #fff !important;
  background: var(--site-accent, #4096ff) !important;
  box-shadow:
    0 2px 10px -2px rgba(22, 119, 255, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease;
}

.site-chat-composer__send:hover:not(:disabled) {
  background: var(--site-accent-hover, #69b1ff) !important;
  box-shadow:
    0 4px 14px -2px rgba(22, 119, 255, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.site-chat-composer__send:active:not(:disabled) {
  transform: scale(0.96);
  background: var(--site-accent-active, #1677ff) !important;
}

.site-chat-composer__send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.site-chat-composer__send svg {
  display: block;
  width: 1.125rem;
  height: 1.125rem;
}

/* —— Empty state —— */
#site-chat-empty.site-chat-empty {
  margin: 0 1rem 0.5rem;
  padding: 0.875rem 1rem;
  border: 1px dashed rgba(22, 119, 255, 0.35);
  border-radius: 0.75rem;
  background: rgba(22, 119, 255, 0.06);
  color: #94a3b8;
  font-size: 0.8125rem;
  line-height: 1.5;
  text-align: center;
}

/* —— Guest bar —— */
.site-chat-guest-bar {
  margin-bottom: 0.625rem;
  padding: 0.875rem 1rem;
  border: 1px solid rgba(22, 119, 255, 0.2);
  border-radius: 0.875rem;
  background: rgba(22, 119, 255, 0.05);
}

.site-chat-guest-bar__text {
  margin: 0 0 0.75rem;
  color: #cbd5e1;
  font-size: 0.8125rem;
  line-height: 1.55;
  text-align: center;
}

/* —— Emoji picker —— */
.site-chat-emoji-pop {
  pointer-events: auto;
  z-index: 200;
  filter: drop-shadow(0 -12px 32px rgba(0, 0, 0, 0.45));
  touch-action: manipulation;
}

.site-chat-emoji-pop__panel {
  overflow: hidden;
  border: 1px solid rgba(22, 119, 255, 0.28);
  border-radius: 1rem;
  background: linear-gradient(
    180deg,
    rgba(20, 26, 38, 0.98) 0%,
    rgba(14, 19, 28, 0.99) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 -4px 24px -8px rgba(22, 119, 255, 0.2);
}

.site-chat-emoji-pop__head {
  padding: 0.5rem 0.75rem 0.375rem;
  border-bottom: 1px solid rgba(22, 119, 255, 0.12);
}

.site-chat-emoji-pop__title {
  display: block;
  color: #64748b;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.site-chat-emoji-grid {
  max-height: min(42vh, 15.5rem);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(22, 119, 255, 0.4) transparent;
}

.site-chat-emoji-grid::-webkit-scrollbar {
  width: 5px;
}

.site-chat-emoji-grid::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(22, 119, 255, 0.35);
}

.site-chat-emoji-section {
  padding: 0.5rem 0.625rem 0.25rem;
}

.site-chat-emoji-section:last-child {
  padding-bottom: 0.625rem;
}

.site-chat-emoji-section__label {
  display: block;
  margin-bottom: 0.375rem;
  padding-left: 0.125rem;
  color: #64748b;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
}

.site-chat-emoji-section__grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.125rem;
}

@media (max-width: 380px) {
  .site-chat-emoji-section__grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

.site-chat-emoji-btn {
  display: inline-flex;
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  height: auto;
  padding: 0;
  border: none;
  border-radius: 0.5rem;
  font-size: 1.25rem;
  line-height: 1;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition:
    background 0.12s ease,
    transform 0.1s ease;
}

.site-chat-emoji-btn:hover {
  background: rgba(22, 119, 255, 0.14);
}

.site-chat-emoji-btn:active {
  transform: scale(0.92);
  background: rgba(22, 119, 255, 0.22);
}

.site-chat-emoji-btn:focus-visible {
  outline: 2px solid var(--site-accent, #4096ff);
  outline-offset: 1px;
}

/* —— Light theme —— */
[data-theme="light"] .site-chat-footer {
  border-top-color: rgba(22, 119, 255, 0.14);
  background: linear-gradient(0deg, #eef3fa 0%, #f8fafc 55%, #fff 100%);
  box-shadow:
    0 -6px 20px -10px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .site-chat-composer__bar {
  border-color: rgba(22, 119, 255, 0.22);
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 2px 12px -6px rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .site-chat-composer__bar:focus-within {
  border-color: rgba(22, 119, 255, 0.45);
  background: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 0 0 3px rgba(22, 119, 255, 0.12);
}

[data-theme="light"] .site-chat-composer__emoji {
  color: #64748b;
}

[data-theme="light"] .site-chat-composer__emoji:hover:not(:disabled) {
  color: #334155;
  background: rgba(22, 119, 255, 0.08);
}

[data-theme="light"] .site-chat-composer__emoji[aria-expanded="true"] {
  color: var(--site-accent-active, #1677ff);
  background: rgba(22, 119, 255, 0.1);
}

[data-theme="light"] .site-chat-composer__input,
[data-theme="light"] .site-chat-input.site-chat-composer__input {
  color: #0f172a;
}

[data-theme="light"] .site-chat-composer__input::placeholder {
  color: #94a3b8;
}

[data-theme="light"] #site-chat-empty.site-chat-empty {
  border-color: rgba(22, 119, 255, 0.28);
  background: rgba(22, 119, 255, 0.05);
  color: #64748b;
}

[data-theme="light"] .site-chat-guest-bar {
  border-color: rgba(22, 119, 255, 0.16);
  background: rgba(22, 119, 255, 0.04);
}

[data-theme="light"] .site-chat-guest-bar__text {
  color: #475569;
}

[data-theme="light"] .site-chat-emoji-pop__panel {
  border-color: rgba(22, 119, 255, 0.18);
  background: linear-gradient(180deg, #fff 0%, #f1f5f9 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 -8px 24px -8px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .site-chat-emoji-pop__head {
  border-bottom-color: rgba(22, 119, 255, 0.1);
}

[data-theme="light"] .site-chat-emoji-pop__title,
[data-theme="light"] .site-chat-emoji-section__label {
  color: #94a3b8;
}

[data-theme="light"] .site-chat-emoji-btn:hover {
  background: rgba(22, 119, 255, 0.1);
}

[data-theme="light"] .site-chat-emoji-btn:active {
  background: rgba(22, 119, 255, 0.16);
}
