/* Telegram-like two-panel layout */
html.chat-page, html.chat-page body { overflow: hidden; height: 100vh; height: 100dvh; }
html.chat-page nav.navbar { margin-bottom: 0 !important; }
html.chat-page main.container {
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  height: calc(100vh - 56px); height: calc(100dvh - 56px);
  overflow: hidden;
}
.chat-split-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* Left sidebar */
.chat-sidebar {
  width: 320px;
  min-width: 320px;
  flex-shrink: 0;
  overflow: hidden;
}
.chat-list-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}
.chat-list-item:hover { background: #f5f5f5; }
.chat-list-item.active { background: #e3f2fd; }

/* Right panel */
.chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.chat-main .chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}
.chat-main .chat-input {
  flex: 0 0 auto;
}

/* ---- Mobile: sidebar/chat toggle ---- */
@media (max-width: 991.98px) {
  .chat-split-layout { position: relative; }
  .chat-sidebar {
    position: absolute;
    inset: 0;
    width: 100%;
    min-width: 0;
    z-index: 2;
  }
  /* !important needed to beat Bootstrap's .d-flex which uses !important */
  .chat-split-layout.mobile-show-main .chat-sidebar,
  .chat-split-layout.has-session .chat-sidebar { display: none !important; }
  .chat-main { width: 100%; }
  .chat-sidebar-toggle { display: inline-flex !important; }
}
@media (min-width: 992px) {
  .chat-sidebar-toggle { display: none !important; }
}
.chat-sidebar-toggle {
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  padding: 0;
  line-height: 1;
  font-size: 18px;
}

/* Emoji bar — wraps on narrow screens */
.emoji-bar {
  display: flex; gap: 2px; margin-top: 6px;
  flex-wrap: wrap;
}

/* ---- Navbar mobile: center items when the hamburger menu is open ---- */
@media (max-width: 991.98px) {
  .navbar-collapse { text-align: center; }
  .navbar-collapse .navbar-nav { align-items: center; }
  .navbar-collapse form { justify-content: center; }
  .navbar-collapse .navbar-text { display: block; }
}

/* ---- Guest list: breathing room + mobile harmony ---- */
@media (max-width: 991.98px) {
  .search-input { width: 100% !important; }
  .guest-card { padding: 12px 14px; gap: 12px; }
}

/* Chat textarea — base styles (overridden by .chat-input-row .chat-textarea) */
.chat-textarea { overflow-y: auto; resize: none; }
.chat-textarea:focus { box-shadow: none; border-color: #86b7fe; }

/* Copyable fields */
.copyable { cursor: default; }
.copyable::selection { background: #b7d6ff; }
.clip-copy { cursor: pointer; border-bottom: 1px dashed #adb5bd; position: relative; }
.clip-copy:hover { border-bottom-color: #6c757d; }
.copy-tip { position: absolute; bottom: 130%; left: 50%; transform: translateX(-50%);
  background: #198754; color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 4px;
  white-space: nowrap; pointer-events: none; z-index: 10; }

/* CSP-compliant helpers */
.clickable-row { cursor: pointer; }
.notes-truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-truncate-wide { max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-input { width: 220px; }
.detail-label { width: 100px; }
.toast-container-csp { z-index: 1080; }
.msg-bubble { max-width: 75%; }
.source-badge { font-size: 9px; font-weight: 400; padding: 1px 5px; }
.event-divider { font-size: 11px; }

/* Edit form spinner */
.guest-edit-form .btn-loading { display: none; }
.guest-edit-form.saving .btn-loading { display: inline-flex; }
.guest-edit-form.saving .btn-text { display: none; }
.guest-edit-form.saving [type="submit"] { pointer-events: none; opacity: 0.8; }

/* Date separator pill between days */
.date-separator { font-size: 12px; font-weight: 500; }

/* Chat input area — polished Telegram-style row */
.chat-input { padding: 8px 12px; }
.chat-input-row {
  display: flex; align-items: flex-end; gap: 8px;
}
.chat-input-row .chat-textarea {
  flex: 1; min-height: 42px; max-height: 120px;
  border-radius: 20px; padding: 9px 16px; font-size: 14px;
  resize: none; overflow-y: auto;
  border-color: #dee2e6; background: #f8f9fa;
}
.chat-input-row .chat-textarea:focus {
  box-shadow: 0 0 0 2px rgba(13,110,253,0.15);
  border-color: #86b7fe; background: #fff;
}

/* Circular send button */
.send-btn {
  width: 42px; height: 42px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; border-radius: 50% !important; padding: 0;
  line-height: 1;
}

/* Emoji bar — subtle row of picker buttons */
.emoji-bar {
  display: flex; gap: 2px; margin-top: 6px;
}
.emoji-btn {
  background: none; border: none; font-size: 20px; cursor: pointer;
  padding: 3px 5px; border-radius: 8px; line-height: 1;
  transition: background 0.12s;
}
.emoji-btn:hover { background: #e9ecef; }

/* ---- Guest cards ---- */
.guest-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.guest-card:hover {
  border-color: #cfd5db;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.guest-card.active-session {
  border-left: 3px solid #198754;
}
.guest-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  line-height: 1;
}
.guest-body {
  flex: 1;
  min-width: 0;
}
.guest-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.guest-name {
  font-weight: 600;
  font-size: 14px;
  color: #212529;
}
.guest-username {
  font-size: 12px;
  color: #6c757d;
}
.guest-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #6c757d;
  margin-top: 2px;
  flex-wrap: wrap;
}
.guest-meta-item {
  display: flex;
  align-items: center;
  gap: 3px;
}
.guest-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.guest-status-dot.active { background: #198754; }
.guest-status-dot.inactive { background: #adb5bd; }
.guest-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.guest-actions .btn {
  border-radius: 8px;
  font-size: 13px;
  padding: 4px 10px;
}
/* Whole guest card opens the details/edit modal; copyable raw text
 * (name, booking ref, room, telegram handle, language) stays selectable. */
.guest-card { cursor: pointer; user-select: none; }
.guest-card .selectable-text { cursor: text; user-select: text; }
.guest-note {
  font-size: 12px; color: #6c757d; margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Language flag badge */
.lang-badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  background: #f0f0f0;
  color: #555;
  white-space: nowrap;
  font-weight: 400;
}
/* Filter pills */
.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-pill {
  font-size: 13px;
  padding: 4px 14px;
  border-radius: 20px;
  border: 1px solid #dee2e6;
  background: #fff;
  color: #495057;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.12s;
}
.filter-pill:hover {
  background: #f0f0f0;
  border-color: #ced4da;
}
.filter-pill.active {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}
/* Summary bar */
.guest-summary {
  font-size: 13px;
  color: #6c757d;
}
.guest-summary strong { color: #212529; }

/* ---- Request cards (requests list) ---- */
.request-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.request-card:hover {
  border-color: #cfd5db;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.request-card.is-new {
  border-left: 3px solid #0d6efd;
}
.request-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  background: #f0f4ff;
  line-height: 1;
}
.request-title {
  font-weight: 600;
  font-size: 14px;
  color: #212529;
  text-decoration: none;
}
.request-title:hover { text-decoration: underline; }
.request-preview {
  font-size: 13px;
  color: #495057;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.request-comment {
  font-size: 12px;
  color: #6c757d;
  margin-top: 2px;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pill-count {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 11px;
  background: rgba(0,0,0,0.08);
  color: inherit;
}
.filter-pill.active .pill-count { background: rgba(255,255,255,0.25); }

/* Quick action forms: spinner on submit (mirrors guest-edit-form) */
.quick-action-form .btn-loading { display: none; }
.quick-action-form.saving .btn-loading { display: inline-flex; }
.quick-action-form.saving .btn-text { display: none; }
.quick-action-form.saving [type="submit"] { pointer-events: none; opacity: 0.8; }

/* Toasts: opaque white background (Bootstrap's default toast bg is 85%
   translucent, which makes live request notifications look see-through) */
.toast {
    --bs-toast-bg: #fff;
    background-color: #fff;
}

/* ---- Translation blocks (Google Cloud Translate for staff) ---- */
.translation-block {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #dee2e6;
  font-size: 12px;
  color: #6c757d;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.translation-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0.85;
}
.translation-block > span { min-width: 0; }

/* Staff (blue) bubbles: lighten the translation block for contrast. */
.bg-primary .translation-block {
  color: rgba(255, 255, 255, 0.9);
  border-top-color: rgba(255, 255, 255, 0.35);
}

/* Request cards: breathing room on mobile */
@media (max-width: 575.98px) {
  .request-card { padding: 12px 14px; gap: 10px; flex-wrap: wrap; }
  .request-card .guest-actions { width: 100%; justify-content: flex-end; }
}

/* Dashboard recent-request rows — subtle hover */
.request-dashboard-row { transition: background 0.12s; }
.request-dashboard-row:hover { background: #f8f9fa; }
