:root {
  --support-bg: #020617;
}

.support-body {
  background-color: var(--color-bg);
  color: var(--color-text);
  height: 100vh;           /* lock overall viewport height */
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;        /* prevent page from growing & pushing footer */
}

.support-main {
  padding: 2rem 0 1.25rem;
  flex: 1;
  display: flex;
  overflow: hidden;        /* main area is fixed height */
  min-height: 0;
}

.support-main .container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.support-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: 1.25rem;
  height: 100%;
  align-items: stretch;
  min-height: 0;
}

.support-card {
  padding: 1.4rem 1.25rem;
}

.support-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;        /* list scrolls inside */
  min-height: 0;
}

.support-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;        /* messages scroll inside */
  min-height: 0;
}

.support-header-title {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.support-mobile-back {
  display: none;
}

.btn-small {
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
}

.support-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: flex-end;
}

.support-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 140px;
}

.support-filter-group label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.support-filter-group input,
.support-filter-group select {
  border-radius: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background-color: rgba(15, 23, 42, 0.95);
  color: var(--color-text);
  padding: 0.45rem 0.75rem;
}

.support-filter-actions {
  margin-left: auto;
}

.support-error {
  border-radius: 0.85rem;
  border: 1px solid rgba(248, 113, 113, 0.6);
  background: rgba(127, 29, 29, 0.7);
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
  color: #fee2e2;
  margin-bottom: 0.75rem;
}

.support-empty {
  font-size: 0.92rem;
  color: var(--color-text-muted);
  padding: 0.5rem 0;
}

.support-conversations {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  overflow-y: auto;        /* sidebar scrolls internally */
  min-height: 0;
}

.support-conversation-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.95);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.support-conversation-item:hover {
  border-color: var(--color-accent);
  background: rgba(15, 23, 42, 1);
  transform: translateY(-1px);
}

.support-conversation-item.unread {
  border-color: rgba(59, 130, 246, 0.7);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.4);
}

.support-conversation-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.support-conversation-phone {
  font-weight: 500;
  font-size: 0.95rem;
}

.support-conversation-preview {
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

.support-conversation-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  font-size: 0.8rem;
}

.support-status-badge {
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.status-open {
  background: rgba(34, 197, 94, 0.16);
  color: #bbf7d0;
}

.status-pending {
  background: rgba(250, 204, 21, 0.15);
  color: #facc15;
}

.status-closed {
  background: rgba(148, 163, 184, 0.25);
  color: #e5e7eb;
}

.support-unread-badge {
  background: #ef4444;
  color: #fef2f2;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
}

.support-timestamp {
  color: var(--color-text-muted);
}

/* Login */

.support-login-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.support-login-card {
  max-width: 480px;
  margin: 0 auto;
}

.support-login-header h1 {
  margin: 0.75rem 0 0.25rem;
}

.support-login-form {
  margin-top: 1.25rem;
}

.support-login-remember {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.support-login-remember input {
  margin-right: 0.4rem;
}

/* Conversation */

.support-conversation-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.support-conversation-title {
  margin: 0 0 0.15rem;
  font-size: 1.3rem;
}

.support-close-chat {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.support-close-chat:hover,
.support-close-chat:focus-visible {
  background-color: rgba(15, 23, 42, 0.9);
  color: #f9fafb;
}

.support-status-control {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.support-status-control label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.support-status-control select {
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background-color: rgba(15, 23, 42, 0.95);
  color: var(--color-text);
  padding: 0.45rem 0.75rem;
}

.support-conversation-card {
  padding: 1.25rem 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  min-height: 0;           /* allow message list to shrink & scroll */
}

.support-messages {
  overflow-y: auto;
  padding-right: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
  min-height: 0;           /* critical so content scrolls instead of growing card */
}

.support-message-row {
  display: flex;
}

.support-message-row > div {
  max-width: 70%;
}

.support-message-bubble {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap; /* preserve line breaks in multi-line messages */
  word-break: break-word;
}

.support-message-device .support-message-bubble {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.support-message-device {
  justify-content: flex-start;
}

.support-message-support {
  justify-content: flex-end;
}

.support-message-support .support-message-bubble {
  background: var(--color-accent);
  color: #0f172a;
}

.support-message-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.2rem;
}

.support-input-bar {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
  align-items: center;
}

.support-input-bar input[type='text'],
.support-input-bar textarea {
  flex: 1;
  min-width: 0;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background-color: rgba(15, 23, 42, 0.95);
  color: var(--color-text);
  padding: 0.5rem 0.9rem;
  resize: vertical;
  max-height: 6rem;
  min-height: 2.5rem;
}

.support-attach-btn {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  padding: 0.4rem 0.7rem;
  font-size: 0.9rem;
  cursor: pointer;
  background-color: rgba(15, 23, 42, 0.95);
  display: flex;
  align-items: center;
}

.support-attach-icon {
  line-height: 1;
}

.support-upload-info {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Attachment modal */
.support-attachment-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.support-attachment-modal-inner {
  background: #020617;
  border-radius: 1rem;
  max-width: 96vw;
  max-height: 90vh;
  width: 960px;
  padding: 1rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
}

.support-attachment-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.support-attachment-modal-title {
  font-size: 0.95rem;
  font-weight: 500;
}

.support-attachment-modal-close {
  border: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 1.2rem;
  cursor: pointer;
}

.support-attachment-modal-body {
  flex: 1;
  overflow: auto;
}

.support-attachment-modal-body iframe,
.support-attachment-modal-body img {
  width: 100%;
  height: auto;
  border: none;
  border-radius: 0.75rem;
}

.support-attachment-video {
  width: 100%;
  max-height: 70vh;
  border-radius: 0.75rem;
  background: #000;
}

@media (max-width: 768px) {
  .support-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .support-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .support-filter-actions {
    margin-left: 0;
  }

  .support-conversation-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .support-message-row > div {
    max-width: 85%;
  }

  /* Mobile: show list first, chat when a conversation is selected */
  .support-chat {
    display: none;
  }

  .support-body.support-mobile-chat .support-sidebar {
    display: none;
  }

  .support-body.support-mobile-chat .support-chat {
    display: flex;
  }

  .support-mobile-back {
    display: inline-flex;
    margin-bottom: 0.4rem;
  }
}


