/* Customer Support — admin chat (1:1 mockup) */

:root {
  --cs-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --cs-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --cs-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --cs-fast: 0.22s;
  --cs-normal: 0.36s;
  --cs-slow: 0.48s;
}

body.admin-support-page {
  background: #000;
  color: #fff;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.admin-support-page .main-content {
  padding: 16px 16px 20px;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-support-page .dash-admin-header {
  flex-shrink: 0;
}

.admin-support-page .admin-page-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cs-shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 0;
  flex: 1;
  min-height: 0;
  height: 100%;
  background: #121212;
  border: 1px solid #1f1f1f;
  border-radius: 18px;
  overflow: hidden;
}

.cs-shell > .cs-chat {
  height: 100%;
  min-height: 0;
}

/* LEFT — recent messages */
.cs-recent {
  background: #0d0d0d;
  border-right: 1px solid #1f1f1f;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.cs-recent-head {
  padding: 18px 16px 12px;
}

.cs-recent-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 12px;
}

.cs-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cs-search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.cs-role-filter {
  position: relative;
  flex-shrink: 0;
}

.cs-role-filter-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #262626;
  border-radius: 10px;
  background: #161616;
  color: #d1d5db;
  cursor: pointer;
  transition:
    background var(--cs-fast) ease,
    border-color var(--cs-fast) ease,
    color var(--cs-fast) ease;
}

.cs-role-filter-btn:hover,
.cs-role-filter-btn.is-open {
  background: #1f1f1f;
  border-color: #404040;
  color: #fff;
}

.cs-role-filter-btn.is-active {
  border-color: #2563eb;
  color: #93c5fd;
}

.cs-role-filter-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 160px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid #2a2a2a;
  background: #181818;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.cs-role-filter-option {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  color: #d1d5db;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
}

.cs-role-filter-option:hover {
  background: rgba(255, 255, 255, 0.05);
}

.cs-role-filter-option.active {
  background: rgba(37, 99, 235, 0.18);
  color: #fff;
}

.cs-search-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  font-size: 0.9rem;
  pointer-events: none;
}

.cs-search {
  width: 100%;
  background: #161616;
  border: 1px solid #262626;
  border-radius: 10px;
  color: #fff;
  font-size: 0.88rem;
  padding: 10px 12px 10px 36px;
  outline: none;
  transition: border-color var(--cs-fast) ease, box-shadow var(--cs-normal) var(--cs-ease-out);
}

.cs-search:focus {
  border-color: #404040;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.cs-filters {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
}

.cs-filter-btn {
  border: 1px solid #333;
  background: transparent;
  color: #d1d5db;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--cs-normal) var(--cs-ease-out),
    color var(--cs-fast) ease,
    border-color var(--cs-fast) ease,
    transform var(--cs-fast) var(--cs-ease);
}

.cs-filter-btn:hover {
  transform: translateY(-1px);
}

.cs-filter-btn:active {
  transform: scale(0.97);
}

.cs-filter-btn.active {
  background: #fff;
  color: #000;
  border-color: #fff;
}

.cs-conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cs-conv-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 8px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition:
    background var(--cs-normal) var(--cs-ease-out),
    transform var(--cs-fast) var(--cs-ease),
    box-shadow var(--cs-normal) var(--cs-ease);
}

.cs-conv-item:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(2px);
}

.cs-conv-item.active {
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.cs-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.cs-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: #222;
  display: block;
}

.cs-online-dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #0d0d0d;
}

.cs-conv-body {
  min-width: 0;
}

.cs-conv-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.cs-conv-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-conv-role {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  line-height: 1.2;
}

.cs-conv-role-member {
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
}

.cs-conv-role-admin {
  background: rgba(59, 130, 246, 0.16);
  color: #93c5fd;
}

.cs-conv-role-unknown {
  background: rgba(156, 163, 175, 0.16);
  color: #d1d5db;
}

.cs-conv-item.has-unread .cs-conv-name,
.cs-conv-item.has-unread .cs-conv-preview {
  color: #fff;
  font-weight: 700;
}

.cs-conv-time {
  font-size: 0.72rem;
  color: #6b7280;
  white-space: nowrap;
  flex-shrink: 0;
}

.cs-conv-preview {
  font-size: 0.8rem;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-conv-preview.is-typing {
  color: #22c55e;
  font-weight: 600;
}

.cs-unread-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

/* RIGHT — chat panel */
.cs-chat {
  display: flex;
  flex-direction: column;
  background: #121212;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.cs-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #1f1f1f;
  background: #121212;
  flex-shrink: 0;
}

.cs-chat-head-info {
  flex: 1;
  min-width: 0;
}

.cs-chat-head-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  line-height: 1.2;
}

.cs-chat-head-status {
  font-size: 0.75rem;
  color: #9ca3af;
  margin: 2px 0 0;
}

.cs-chat-head-status.is-online {
  color: #22c55e;
}

.cs-chat-head-status.is-typing {
  color: #22c55e;
}

.cs-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cs-date-separator {
  display: flex;
  justify-content: center;
  align-self: center;
  width: 100%;
  margin: 4px 0 2px;
}

.cs-date-separator span {
  display: inline-block;
  background: #2a2a2a;
  color: #9ca3af;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  user-select: none;
}

.cs-msg-row {
  display: flex;
  flex-direction: column;
  max-width: min(520px, 78%);
}

.cs-msg-row.is-mine {
  align-self: flex-end;
  align-items: flex-end;
}

.cs-msg-row.is-theirs {
  align-self: flex-start;
  align-items: flex-start;
}

.cs-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-line;
  word-break: break-word;
  text-align: left;
  transition: transform var(--cs-fast) var(--cs-ease);
  cursor: pointer;
}

.cs-reply-preview {
  display: block;
  margin: -2px -2px 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

.cs-msg-row.is-mine .cs-reply-preview {
  background: rgba(0, 0, 0, 0.08);
}

.cs-reply-preview-name {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 2px;
  color: #92700a;
}

.cs-msg-row.is-mine .cs-reply-preview-name {
  color: #111;
}

.cs-reply-preview-text {
  display: block;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #4b5563;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-msg-row.is-mine .cs-reply-preview-text {
  color: #374151;
}

.cs-reply-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.28);
}

.cs-reply-bar-body {
  min-width: 0;
  flex: 1;
}

.cs-reply-bar-label {
  display: block;
  font-size: 0.72rem;
  color: #ca8a04;
  margin-bottom: 2px;
}

.cs-reply-bar-label strong {
  color: #ffd700;
}

.cs-reply-bar-text {
  display: block;
  font-size: 0.82rem;
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-reply-bar-cancel {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.cs-msg-row.highlight-target .cs-bubble {
  box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.65);
}

.cs-msg-row.is-theirs .cs-bubble {
  background: #fff;
  color: #111;
  border-bottom-left-radius: 6px;
}

.cs-msg-row.is-mine .cs-bubble {
  background: #ffd700;
  color: #111;
  border-bottom-right-radius: 6px;
}

.cs-msg-time {
  font-size: 0.72rem;
  color: #6b7280;
  margin-top: 4px;
  padding: 0 4px;
}

.cs-typing-row {
  align-self: flex-start;
  max-width: 220px;
}

.cs-typing-bubble {
  background: #fff;
  color: #6b7280;
  border-radius: 16px;
  border-bottom-left-radius: 6px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-style: italic;
}

.cs-empty-chat {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 0.92rem;
  padding: 24px;
  text-align: center;
}

.cs-composer {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 14px 16px;
  border-top: 1px solid #1f1f1f;
  background: #121212;
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
}

.cs-composer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.cs-composer-attach {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    color var(--cs-fast) ease,
    transform var(--cs-normal) var(--cs-ease-spring),
    background var(--cs-fast) ease;
  border-radius: 8px;
}

.cs-composer-attach:hover:not(:disabled) {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  transform: rotate(-12deg) scale(1.06);
}

.cs-composer-attach:active:not(:disabled) {
  transform: rotate(0) scale(0.94);
}

.cs-composer-attach:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cs-composer-file {
  display: none;
}

.cs-attach-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(37, 99, 235, 0.25);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(4px);
  transition:
    max-height var(--cs-normal) var(--cs-ease-out),
    opacity var(--cs-normal) var(--cs-ease),
    transform var(--cs-normal) var(--cs-ease-out),
    padding var(--cs-normal) var(--cs-ease-out);
}

.cs-attach-preview.is-visible {
  max-height: 48px;
  opacity: 1;
  margin-bottom: 10px;
  padding: 8px 10px;
  transform: translateY(0);
  pointer-events: auto;
}

.cs-attach-preview-name {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  color: #dbeafe;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-attach-preview-clear {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #d1d5db;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.cs-attach-preview-clear:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.cs-bubble-img {
  display: block;
  max-width: min(240px, 100%);
  max-height: 220px;
  border-radius: 10px;
  object-fit: cover;
}

.cs-bubble-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
  color: inherit;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  word-break: break-all;
}

.cs-msg-row.is-mine .cs-bubble-file {
  background: rgba(0, 0, 0, 0.08);
  color: #111;
}

.cs-msg-row.is-theirs .cs-bubble-file {
  background: rgba(0, 0, 0, 0.06);
  color: #111;
}

.cs-bubble-text {
  margin-top: 8px;
}

.cs-bubble-text:first-child {
  margin-top: 0;
}

.cs-composer-input {
  flex: 1;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  color: #fff;
  font-size: 0.9rem;
  padding: 11px 14px;
  outline: none;
  transition: border-color var(--cs-fast) ease, box-shadow var(--cs-normal) var(--cs-ease-out);
}

.cs-composer-input:focus {
  border-color: #404040;
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.12);
}

.cs-composer-input:disabled {
  opacity: 0.5;
}

.cs-composer-send {
  background: #ffd700;
  color: #111;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background var(--cs-fast) ease,
    transform var(--cs-fast) var(--cs-ease),
    box-shadow var(--cs-normal) var(--cs-ease-out);
}

.cs-composer-send:hover:not(:disabled) {
  background: #f5c400;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(255, 215, 0, 0.28);
}

.cs-composer-send:active:not(:disabled) {
  transform: scale(0.97);
}

.cs-composer-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cs-access-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 215, 0, 0.14);
  background: rgba(255, 215, 0, 0.06);
  flex-shrink: 0;
}

.cs-access-banner-text {
  margin: 0;
  font-size: 0.8125rem;
  color: #cbd5e1;
  line-height: 1.45;
}

.cs-access-banner-text strong {
  color: #ffd700;
}

.cs-access-banner-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cs-access-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 10px;
  background: #ffd700;
  color: #0d0e14;
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.cs-access-btn:hover {
  background: #f5c400;
  color: #0d0e14;
}

.cs-access-btn-ghost {
  background: transparent;
  border: 1px solid #2d3035;
  color: #fff;
}

.cs-access-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.cs-guest-welcome {
  margin: auto;
  max-width: 360px;
  padding: 28px 20px;
  text-align: center;
  color: #9ca3af;
}

.cs-guest-welcome i {
  display: block;
  font-size: 2rem;
  color: rgba(255, 215, 0, 0.45);
  margin-bottom: 10px;
}

.cs-guest-welcome-title {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.cs-guest-welcome-text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

.cs-guest-page .cs-composer {
  opacity: 0.72;
}

@media (max-width: 767.98px) {
  .cs-access-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .cs-access-banner-actions {
    width: 100%;
  }

  .cs-access-btn {
    flex: 1;
  }
}

/* User support (single thread) */
.cs-user-page .main-content {
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cs-user-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  flex: 1;
  min-height: 0;
  height: 100%;
  background: #121212;
  border: 1px solid #1f1f1f;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (max-width: 991.98px) {
  .admin-support-page .main-content,
  .cs-user-page .main-content {
    padding: 16px 16px 20px;
    height: calc(100dvh - var(--mobile-header-row1-h, 60px) - 82px - env(safe-area-inset-bottom, 0px));
  }

  .cs-shell {
    grid-template-columns: 1fr;
    flex: 1;
    min-height: 0;
    height: auto;
    position: relative;
  }

  .cs-recent {
    position: absolute;
    inset: 0;
    z-index: 5;
    transform: translateX(-100%);
    transition: transform 0.42s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
  }

  .cs-recent.open {
    transform: translateX(0);
  }

  .cs-mobile-back {
    display: inline-flex !important;
  }
}

.cs-mobile-back {
  display: none;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1.2rem;
  padding: 0;
  margin-right: 4px;
  transition: transform var(--cs-fast) var(--cs-ease), opacity var(--cs-fast) ease;
}

.cs-mobile-back:active {
  transform: scale(0.92);
}

@media (prefers-reduced-motion: reduce) {
  .cs-conv-item,
  .cs-filter-btn,
  .cs-composer-attach,
  .cs-composer-send,
  .cs-attach-preview,
  .cs-recent,
  .cs-search,
  .cs-composer-input {
    transition: none !important;
  }
}
