/* CSS Styling - Conversational AI Registration Form (Light Theme & GNH Logo Palette) */
/* Self-hosted variable fonts keep typography identical across local and production. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("assets/fonts/inter-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("assets/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("assets/fonts/outfit-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("assets/fonts/outfit-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Outfit", "Inter", ui-sans-serif, system-ui, sans-serif;

  /* Logo-based Palette */
  --logo-teal: #13888c;      /* Xanh ngọc đậm từ logo GNH Talk */
  --logo-teal-light: #7cc8cc;/* Xanh ngọc nhạt */
  --logo-yellow: #f2b705;    /* Vàng từ logo */
  
  /* Theme Colors (Light Mode) */
  --bg-primary: #e2e8f0;     /* Soft grey background for centering layout */
  --bg-secondary: #ffffff;   /* Pure White */
  --bg-tertiary: #f8fafc;    /* Slate 50 */
  --border-color: #e2e8f0;   /* Slate 200 */
  
  --text-primary: #2c3e50;   /* Slate 900 equivalent */
  --text-secondary: #64748b; /* Slate 600 */
  --text-muted: #94a3b8;     /* Slate 400 */
  
  --accent-color: var(--logo-teal);
  --accent-hover: #0e6a6d;
  --accent-light: rgba(19, 136, 140, 0.06);
  --accent-yellow-light: rgba(242, 183, 5, 0.15);
  
  --shadow-premium: 0 15px 35px rgba(0, 0, 0, 0.05), 0 5px 15px rgba(0, 0, 0, 0.03);
  --border-radius: 20px;
  --transition-speed: 0.25s;
}

/* Base resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
}

html {
  overflow-x: hidden;
  width: 100%;
}

body {
  background: linear-gradient(135deg, #eef2f3 0%, #d5dde0 100%);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

h1, h2, h3, h4, .font-title {
  font-family: var(--font-display);
  font-weight: 600;
}

/* App Container wrapper */
.app-container {
  display: flex;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* ---------------------------------------------------- */
/* WELCOME GATE / CONNECT SCREEN */
/* ---------------------------------------------------- */
.welcome-gate-container {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.welcome-card {
  width: 100%;
  max-width: 680px;
  background-color: var(--bg-secondary);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-premium);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-header-agent {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
}

.agent-avatar-container {
  position: relative;
  width: 44px;
  height: 44px;
}

.agent-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background-color: #10b981; /* Green online */
  border: 2px solid white;
  border-radius: 50%;
}

.agent-meta h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.agent-meta p {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.welcome-body {
  padding: 28px 36px 36px 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.welcome-title {
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 4px;
}

.welcome-bubble {
  background-color: #faebe1; /* Soft peach/orange bubble from image */
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #5c3a21; /* Brownish text */
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.welcome-bubble-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gate-input-group {
  display: flex;
  flex-direction: column;
}

.gate-input {
  width: 100%;
  padding: 14px 20px;
  background-color: #f1f5f9;
  border: 1px solid transparent;
  border-radius: 12px;
  outline: none;
  font-size: 0.95rem;
  color: var(--text-primary);
  transition: all var(--transition-speed) ease;
}

.gate-input::placeholder {
  color: #94a3b8;
}

.gate-input:focus {
  border-color: var(--logo-teal-light);
  background-color: var(--bg-secondary);
  box-shadow: 0 0 0 3px rgba(124, 200, 204, 0.2);
}

.gate-submit-btn {
  background-color: #94a3b8; /* Slate grey from image */
  color: white;
  border: none;
  border-radius: 12px;
  padding: 15px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all var(--transition-speed) ease;
  margin-top: 6px;
  box-shadow: 0 4px 10px rgba(148, 163, 184, 0.15);
}

.gate-submit-btn:hover {
  background-color: var(--logo-teal);
  box-shadow: 0 6px 15px rgba(19, 136, 140, 0.2);
}

/* ---------------------------------------------------- */
/* CUSTOMER CHAT INTERFACE (Centered & Sleek) */
/* ---------------------------------------------------- */
.customer-chat-container {
  display: none; /* Shown after welcome gate completes */
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 15;
}

.customer-chat-card {
  width: 100%;
  max-width: 760px;
  height: 100%;
  max-height: 850px;
  background-color: var(--bg-secondary);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-premium);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header with progress bar */
.chat-header {
  height: 75px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background-color: var(--bg-secondary);
  z-index: 5;
}

.chat-title-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  margin-right: 12px;
}

.header-restart-btn {
  min-height: 44px;
  margin-right: 18px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--logo-teal) 45%, var(--border-color));
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--logo-teal);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex-shrink: 0;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.header-restart-btn:hover {
  background: color-mix(in srgb, var(--logo-teal) 8%, var(--bg-secondary));
  border-color: var(--logo-teal);
}

.header-restart-btn:active {
  transform: translateY(1px);
}

.header-restart-btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--logo-teal) 24%, transparent);
  outline-offset: 2px;
}

.header-restart-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.header-restart-icon::before {
  content: "↻";
}

.chat-title {
  font-size: 1.1rem;
  color: var(--text-primary);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--accent-color);
  font-weight: 600;
  white-space: nowrap;
}

.progress-bar-bg {
  width: 110px;
  height: 6px;
  background-color: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--logo-teal), var(--logo-teal-light));
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* Chat Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background-color: #fafbfc;
}

/* Custom Scrollbar for Chat Messages */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Chat Bubbles */
.message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 80%;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.assistant {
  align-self: flex-start;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.message.assistant .avatar {
  background: linear-gradient(135deg, var(--logo-teal), var(--accent-hover));
  color: white;
}

.message.user .avatar {
  background: linear-gradient(135deg, var(--logo-yellow), #e0a300);
  color: white;
}

.message-content {
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.5;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  word-break: break-word;
}

.message.assistant .message-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-top-left-radius: 4px;
}

.message.user .message-content {
  background: linear-gradient(135deg, var(--logo-teal), var(--accent-hover));
  color: white;
  border-top-right-radius: 4px;
}

.message-time {
  font-size: 0.68rem;
  color: var(--text-secondary);
  margin-top: 4px;
  display: block;
  text-align: right;
}

.message.user .message-time {
  color: rgba(255, 255, 255, 0.8);
  text-align: left;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  border-top-left-radius: 4px;
  width: fit-content;
  align-self: flex-start;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  margin-left: 48px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background-color: var(--accent-color);
  border-radius: 50%;
  opacity: 0.4;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* Suggestions & Quick Replies Area */
.suggestions-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 24px;
  justify-content: center;
  background-color: #fafbfc;
  border-top: 1px dashed var(--border-color);
  max-height: 220px;
  overflow-y: auto;
}

/* Custom Scrollbar for Suggestions Container */
.suggestions-container::-webkit-scrollbar {
  width: 6px;
}

.suggestions-container::-webkit-scrollbar-track {
  background: transparent;
}

.suggestions-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.suggestions-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.quick-reply-btn {
  padding: 8px 14px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.01);
  transition: all 0.2s ease;
}

.quick-reply-btn:hover {
  background-color: var(--accent-light);
  border-color: var(--accent-color);
  color: var(--accent-color);
  transform: translateY(-1px);
}

.quick-reply-btn.selected {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

/* Input Area */
.chat-input-area {
  padding: 16px 24px 20px 24px;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background-color: #f1f5f9;
  border: 1px solid transparent;
  border-radius: 24px;
  padding: 4px 6px 4px 18px;
  transition: all var(--transition-speed) ease;
}

.input-wrapper:focus-within {
  border-color: var(--accent-color);
  background-color: var(--bg-secondary);
  box-shadow: 0 0 0 3px rgba(19, 136, 140, 0.1);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.92rem;
  padding: 8px 0;
  resize: none;
  max-height: 150px;
  min-height: 24px;
}

.chat-input::placeholder {
  color: var(--text-secondary);
}

.send-btn {
  width: 36px;
  height: 36px;
  background-color: var(--accent-color);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.send-btn:hover {
  background-color: var(--accent-hover);
}

.send-btn:disabled {
  background-color: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
}

.input-hint {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-align: center;
}

/* ---------------------------------------------------- */
/* ADMIN DASHBOARD VIEW (Full Screen) */
/* ---------------------------------------------------- */
.admin-layout {
  display: none; /* Only active on ?admin or #admin URL path */
  width: 100%;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 30;
  background-color: var(--bg-tertiary);
}

.admin-layout.active {
  display: flex;
}

.logo-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
  gap: 8px;
}

.logo-img {
  max-width: 120px;
  height: auto;
  border-radius: 8px;
}

.logo-text h2 {
  font-size: 1.2rem;
  color: var(--logo-teal);
  margin-top: 4px;
}

.logo-text p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

#adminLayout .sidebar {
  width: 300px !important;
  background-color: var(--bg-secondary) !important;
  border-right: 1px solid var(--border-color) !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 24px !important;
  flex-shrink: 0 !important;
  transform: none !important;
  position: relative !important;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  margin-top: 20px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  transition: all var(--transition-speed) ease;
}

.menu-item.active {
  color: var(--accent-color);
  background-color: var(--accent-light);
  border-color: rgba(19, 136, 140, 0.15);
}

.dashboard-section {
  flex: 1;
  overflow-y: auto;
  padding: 40px;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-tertiary);
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.dashboard-title h1 {
  font-size: 1.6rem;
  margin-bottom: 4px;
  color: var(--logo-teal);
}

.dashboard-title p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.dashboard-actions {
  display: flex;
  gap: 10px;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-premium);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background-color: var(--accent-light);
  color: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Config cards inside Dashboard */
.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow-premium);
}

.card-title {
  font-size: 1rem;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--logo-teal);
}

/* Table */
.table-container {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-premium);
  display: flex;
  flex-direction: column;
}

.table-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

th, td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
}

th {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

tr:hover td {
  background-color: var(--bg-tertiary);
}

td {
  color: var(--text-primary);
}

/* Detail Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 20px 40px -5px rgba(15, 23, 42, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(15px);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-section-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--logo-teal);
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 4px;
  margin-top: 8px;
  font-weight: 700;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.detail-value {
  font-size: 0.92rem;
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  white-space: pre-wrap;
}

.action-icon-btn {
  background: transparent;
  border: none;
  color: var(--accent-color);
  cursor: pointer;
  padding: 6px 10px;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.action-icon-btn:hover {
  background-color: var(--accent-light);
  color: var(--accent-hover);
}

/* Utilities */
.hidden {
  display: none !important;
}

/* =================================------------------ ================================= */
/* 📱 MOBILE RESPONSIVE OPTIMIZATIONS (UX/UI Polish) */
/* =================================------------------ ================================= */

@media (max-width: 768px) {
  body {
    background: #f1f5f9;
    align-items: stretch;
    justify-content: stretch;
  }
  
  .app-container {
    height: 100vh;
    height: 100dvh;
    width: 100%;
  }

  /* 1. Welcome Gate Mobile UI */
  .welcome-gate-container {
    padding: 0;
  }

  .welcome-card {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .card-header-agent {
    padding: 12px 24px;
    background-color: var(--bg-secondary);
  }

  .welcome-body {
    padding: 20px 24px 32px 24px;
    overflow-y: auto;
    flex: 1;
    justify-content: flex-start;
  }

  .welcome-title {
    font-size: 0.8rem;
    margin-bottom: 2px;
  }

  .welcome-bubble {
    padding: 12px 16px;
    font-size: 0.88rem;
    gap: 10px;
  }

  .gate-input {
    padding: 12px 16px;
    font-size: 0.92rem;
    border-radius: 10px;
  }

  .gate-submit-btn {
    padding: 14px;
    font-size: 0.9rem;
    border-radius: 10px;
  }

  /* 2. Customer Chat Mobile UI */
  .customer-chat-container {
    padding: 0;
  }

  .customer-chat-card {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .chat-header {
    height: 65px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
  }

  .chat-title-container {
    margin-right: 8px;
  }

  .header-restart-btn {
    width: 44px;
    min-width: 44px;
    padding: 0;
    margin-right: 10px;
  }

  .header-restart-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .chat-title {
    font-size: 0.98rem;
  }

  .chat-subtitle {
    font-size: 0.72rem;
  }

  .progress-container {
    gap: 6px;
  }

  .progress-text {
    font-size: 0.72rem;
  }

  .progress-bar-bg {
    width: 70px;
    height: 5px;
  }

  .chat-messages {
    padding: 24px;
    gap: 16px;
  }

  .message {
    max-width: 90%;
    gap: 10px;
  }

  .avatar {
    width: 32px;
    height: 32px;
  }

  .message-content {
    padding: 10px 14px;
    font-size: 0.88rem;
    border-radius: 14px;
  }

  .typing-indicator {
    padding: 8px 12px;
    margin-left: 42px;
  }

  /* Premium Mobile Pattern: Horizontally scrollable quick replies */
  .suggestions-container {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    padding: 12px 24px;
    gap: 8px;
    border-top: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  .suggestions-container::-webkit-scrollbar {
    display: none; /* Hide scrollbar for clean app-like look */
  }

  .quick-reply-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 0.8rem;
    border-radius: 16px;
    scroll-snap-align: start;
  }

  .chat-input-area {
    padding: 12px 24px 18px 24px;
  }

  .input-wrapper {
    padding: 4px 6px 4px 14px;
    border-radius: 20px;
  }

  .chat-input {
    font-size: 0.88rem;
    padding: 6px 0;
  }

  .send-btn {
    width: 32px;
    height: 32px;
  }

  .input-hint {
    font-size: 0.68rem;
  }

  /* 3. Admin Layout Mobile UI */
  .admin-layout {
    flex-direction: column;
    overflow: hidden;
  }

  #adminLayout .sidebar {
    width: 100% !important;
    height: auto !important;
    padding: 24px !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    transform: none !important;
    position: relative !important;
    background-color: var(--bg-secondary) !important;
  }

  .logo-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    text-align: left;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    gap: 10px;
  }

  .logo-img {
    max-width: 80px;
  }

  .logo-text h2 {
    font-size: 1rem;
  }

  .logo-text p {
    display: none; /* Hide subtitle to save mobile space */
  }

  .sidebar-menu {
    display: flex;
    flex-direction: row;
    margin-top: 0;
    gap: 6px;
    flex: 0;
  }

  .menu-item {
    padding: 8px 12px;
    font-size: 0.8rem;
    border-radius: 8px;
    white-space: nowrap;
    gap: 6px;
  }

  .dashboard-section {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
  }

  .dashboard-title h1 {
    font-size: 1.25rem;
  }

  .dashboard-title p {
    font-size: 0.78rem;
  }

  .dashboard-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .dashboard-actions .btn {
    padding: 8px 12px;
    font-size: 0.78rem;
    border-radius: 6px;
    flex: 1;
    justify-content: center;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 14px;
    gap: 12px;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .stat-value {
    font-size: 1.15rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  .table-header-row {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 10px;
  }

  .table-header-row h3 {
    font-size: 0.95rem;
  }

  .table-header-row .form-group {
    min-width: 100%;
  }

  th, td {
    padding: 10px 12px;
    font-size: 0.78rem;
  }

  .modal-content {
    width: 95%;
    max-height: 90vh;
  }
  /* Premium Mobile Pattern: Horizontally scrollable quick replies */
  .suggestions-container {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    padding: 12px 24px;
    gap: 8px;
    border-top: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  .suggestions-container::-webkit-scrollbar {
    display: none; /* Hide scrollbar for clean app-like look */
  }

  .quick-reply-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 0.8rem;
    border-radius: 16px;
    scroll-snap-align: start;
  }

  .chat-input-area {
    padding: 12px 16px 18px 16px;
  }

  .input-wrapper {
    padding: 4px 6px 4px 14px;
    border-radius: 20px;
  }

  .chat-input {
    font-size: 0.88rem;
    padding: 6px 0;
  }

  .send-btn {
    width: 32px;
    height: 32px;
  }

  .input-hint {
    font-size: 0.68rem;
  }

  /* 3. Admin Layout Mobile UI */
  .admin-layout {
    flex-direction: column;
    overflow: hidden;
  }

  #adminLayout .sidebar {
    width: 100% !important;
    height: auto !important;
    padding: 16px !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    transform: none !important;
    position: relative !important;
    background-color: var(--bg-secondary) !important;
  }

  .logo-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    text-align: left;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    gap: 10px;
  }

  .logo-img {
    max-width: 80px;
  }

  .logo-text h2 {
    font-size: 1rem;
  }

  .logo-text p {
    display: none; /* Hide subtitle to save mobile space */
  }

  .sidebar-menu {
    display: flex;
    flex-direction: row;
    margin-top: 0;
    gap: 6px;
    flex: 0;
  }

  .menu-item {
    padding: 8px 12px;
    font-size: 0.8rem;
    border-radius: 8px;
    white-space: nowrap;
    gap: 6px;
  }

  .dashboard-section {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
  }

  .dashboard-title h1 {
    font-size: 1.25rem;
  }

  .dashboard-title p {
    font-size: 0.78rem;
  }

  .dashboard-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .dashboard-actions .btn {
    padding: 8px 12px;
    font-size: 0.78rem;
    border-radius: 6px;
    flex: 1;
    justify-content: center;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 14px;
    gap: 12px;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .stat-value {
    font-size: 1.15rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  .table-header-row {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 10px;
  }

  .table-header-row h3 {
    font-size: 0.95rem;
  }

  .table-header-row .form-group {
    min-width: 100%;
  }

  th, td {
    padding: 10px 12px;
    font-size: 0.78rem;
  }

  .modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .modal-header {
    padding: 14px 16px;
  }

  .modal-body {
    padding: 16px;
    gap: 12px;
  }

  .detail-value {
    font-size: 0.85rem;
    padding: 6px 10px;
  }

  .form-option-btn {
    font-size: 0.85rem;
    padding: 12px 16px;
  }
}

@keyframes pulse {
  0% {
    opacity: 0.3;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1.1);
  }
}

.form-option-btn {
  width: 100%;
  padding: 14px 20px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  line-height: 1.4;
}

.form-option-btn:hover {
  border-color: var(--logo-teal-light);
  background-color: var(--accent-light);
  transform: translateY(-1px);
}

.form-option-btn.selected {
  border-color: var(--logo-teal);
  background-color: var(--accent-light);
  font-weight: 600;
  box-shadow: 0 0 0 2px var(--logo-teal);
}

/* Custom Scrollbar for Form Options */
.form-question-options::-webkit-scrollbar {
  width: 6px;
}

.form-question-options::-webkit-scrollbar-track {
  background: transparent;
}

.form-question-options::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.form-question-options::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Cheer Toast Notification */
.cheer-toast {
  position: fixed;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--logo-teal), var(--accent-hover));
  color: white;
  padding: 16px 24px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(19, 136, 140, 0.3);
  z-index: 1000;
  max-width: 90%;
  width: 480px;
  text-align: center;
  transition: top 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cheer-toast.show {
  top: 24px;
}

.cheer-toast-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.cheer-toast-body {
  font-size: 0.88rem;
  line-height: 1.5;
  opacity: 0.95;
}


/* Vertical Options Panel UI */
.suggestions-container.vertical {
  flex-direction: column;
  padding: 16px 24px;
  gap: 12px;
  background-color: #fafbfc;
  border-top: 1px solid var(--border-color);
  max-height: 50vh;
  flex-wrap: nowrap;
  overflow-y: hidden;
}

.options-scroll-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 4px;
}

.options-scroll-wrapper::-webkit-scrollbar {
  width: 6px;
}
.options-scroll-wrapper::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 3px;
}

.choice-option-btn {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background-color: #f6f5f0;
  border: 1px solid #e2e0d5;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
  text-align: left;
}

.choice-option-btn.multiple {
  align-items: flex-start;
}

.choice-option-btn:hover {
  background-color: #f0eee5;
}

.choice-option-btn.selected {
  background-color: #ffffff;
  border-color: var(--logo-teal);
  box-shadow: 0 2px 8px rgba(19, 136, 140, 0.1);
}

.checkbox-box {
  width: 20px;
  height: 20px;
  border: 1.5px solid #ccc;
  border-radius: 4px;
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  background-color: #fff;
  transition: all 0.2s ease;
}

.checkbox-box i {
  color: white;
  font-size: 14px;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.choice-option-btn.selected .checkbox-box {
  background-color: var(--logo-teal);
  border-color: var(--logo-teal);
}

.choice-option-btn.selected .checkbox-box i {
  opacity: 1;
  transform: scale(1);
}

.choice-submit-btn {
  width: 100%;
  padding: 14px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 1.05rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.choice-submit-btn.disabled {
  background-color: #a3c4b8;
  color: #fff;
  cursor: not-allowed;
  opacity: 0.8;
}

.choice-submit-btn.active {
  background-color: var(--logo-teal);
  color: white;
  box-shadow: 0 4px 12px rgba(19, 136, 140, 0.25);
}

.choice-submit-btn.active:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

/* Friendly validation and AI request feedback. */
.gate-field-error { margin: 6px 0 0; color: #b42318; font-size: 0.875rem; line-height: 1.5; }
.gate-input[aria-invalid="true"] { border-color: #b42318; }
.typing-indicator { flex-wrap: wrap; max-width: 100%; }
.typing-label { font-size: 0.875rem; line-height: 1.5; color: var(--text-secondary); }
#connectBtn { text-transform: none; }
