/**
 * Shared UI: modern buttons + Hospitable messages.
 * Loaded after LBD / dark-mode / app-themes so these win.
 */

/* ------------------------------------------------------------------
 * Buttons — replace LBD 2px gray outline + neon #1DC7EA fill
 * ------------------------------------------------------------------ */

.btn:not(.btn-link):not(.btn-simple):not(.btn-social):not(.btn-merge):not(.btn-decline) {
  border-width: 1px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  opacity: 1;
  filter: none;
  line-height: 1.25;
  box-shadow: none;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    filter 0.15s ease,
    transform 0.1s ease;
}

.btn-sm:not(.btn-link):not(.btn-simple):not(.btn-social) {
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
}

.btn:not(.btn-link):not(.btn-simple):focus {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(62, 207, 255, 0.22);
}

/* Quiet actions: Refresh, Back, Cancel, outline */
.btn-ghost,
.btn-default,
.btn-secondary,
.btn-outline-secondary,
.occ-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent !important;
  border: 1px solid rgba(15, 23, 42, 0.14) !important;
  color: #475569 !important;
  box-shadow: none !important;
}

a.btn-ghost,
a.btn-default {
  text-decoration: none;
}

.btn-ghost:hover,
.btn-ghost:focus,
.btn-default:hover,
.btn-default:focus,
.btn-secondary:hover,
.btn-secondary:focus,
.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.occ-refresh:hover,
.occ-refresh:focus {
  background: rgba(15, 23, 42, 0.05) !important;
  border-color: rgba(15, 23, 42, 0.22) !important;
  color: #0f172a !important;
  box-shadow: none !important;
}

.btn-ghost:disabled,
.btn-ghost[disabled],
.btn-default:disabled,
.btn-default[disabled],
.btn-outline-secondary:disabled,
.occ-refresh:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary filled — theme color, not neon cyan */
.btn-info.btn-fill,
.btn-primary.btn-fill {
  background: var(--cb-theme-primary, #1f77d0) !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow: none !important;
  opacity: 1 !important;
}

.btn-info.btn-fill:hover,
.btn-info.btn-fill:focus,
.btn-primary.btn-fill:hover,
.btn-primary.btn-fill:focus {
  background: var(--cb-theme-primary-2, #1a5fb4) !important;
  border-color: transparent !important;
  color: #fff !important;
  filter: brightness(1.04);
  box-shadow: none !important;
}

.btn-success.btn-fill {
  background: #16a34a !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow: none !important;
}

.btn-success.btn-fill:hover,
.btn-success.btn-fill:focus {
  background: #15803d !important;
  color: #fff !important;
}

.btn-warning.btn-fill {
  background: #d97706 !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow: none !important;
}

.btn-warning.btn-fill:hover,
.btn-warning.btn-fill:focus {
  background: #b45309 !important;
  color: #fff !important;
}

.btn-danger.btn-fill {
  background: #dc2626 !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow: none !important;
}

.btn-danger.btn-fill:hover,
.btn-danger.btn-fill:focus {
  background: #b91c1c !important;
  color: #fff !important;
}

.btn.btn-fill:disabled,
.btn.btn-fill[disabled],
.btn.btn-fill.disabled {
  opacity: 0.5 !important;
  cursor: not-allowed;
  filter: none;
}

html[data-color-mode="dark"] .btn-ghost,
html[data-color-mode="dark"] .btn-default,
html[data-color-mode="dark"] .btn-secondary,
html[data-color-mode="dark"] .btn-outline-secondary,
html[data-color-mode="dark"] .occ-refresh {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: var(--cb-border-strong, rgba(255, 255, 255, 0.14)) !important;
  color: var(--cb-text-muted, #9aa8b5) !important;
  box-shadow: none !important;
}

html[data-color-mode="dark"] .btn-ghost:hover,
html[data-color-mode="dark"] .btn-ghost:focus,
html[data-color-mode="dark"] .btn-default:hover,
html[data-color-mode="dark"] .btn-default:focus,
html[data-color-mode="dark"] .btn-secondary:hover,
html[data-color-mode="dark"] .btn-secondary:focus,
html[data-color-mode="dark"] .btn-outline-secondary:hover,
html[data-color-mode="dark"] .btn-outline-secondary:focus,
html[data-color-mode="dark"] .occ-refresh:hover,
html[data-color-mode="dark"] .occ-refresh:focus {
  background: var(--cb-bg-hover, #2a3545) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  color: var(--cb-text, #e8eef4) !important;
}

html[data-color-mode="dark"] .btn-info.btn-fill,
html[data-color-mode="dark"] .btn-primary.btn-fill {
  background: var(--cb-accent, #3ecfff) !important;
  border-color: transparent !important;
  color: #0b1220 !important;
  box-shadow: none !important;
}

html[data-color-mode="dark"] .btn-info.btn-fill:hover,
html[data-color-mode="dark"] .btn-info.btn-fill:focus,
html[data-color-mode="dark"] .btn-primary.btn-fill:hover,
html[data-color-mode="dark"] .btn-primary.btn-fill:focus {
  background: #7ddfff !important;
  color: #0b1220 !important;
  box-shadow: none !important;
}

html[data-color-mode="dark"] .btn-success.btn-fill {
  background: var(--cb-success, #34c759) !important;
  color: #052e16 !important;
}

html[data-color-mode="dark"] .btn-warning.btn-fill {
  background: var(--cb-warning, #f0c14a) !important;
  color: #1c1403 !important;
}

html[data-color-mode="dark"] .btn-danger.btn-fill {
  background: var(--cb-danger, #ff6b6b) !important;
  color: #2a0b0b !important;
  box-shadow: none !important;
}

html[data-color-mode="dark"] .btn:not(.btn-link):not(.btn-simple):focus {
  box-shadow: 0 0 0 3px var(--cb-accent-soft, rgba(62, 207, 255, 0.14));
}

/* ------------------------------------------------------------------
 * List groups (inbox, AI jobs) — Bootstrap defaults to white
 * ------------------------------------------------------------------ */

.list-group-item {
  border-color: rgba(15, 23, 42, 0.08);
}

.list-group-item-action:hover,
.list-group-item-action:focus {
  background-color: #f8fafc;
}

html[data-color-mode="dark"] .list-group-item,
html[data-color-mode="dark"] a.list-group-item,
html[data-color-mode="dark"] .list-group-item-action {
  background: var(--cb-bg-soft, #222c3a) !important;
  border-color: var(--cb-border, rgba(255, 255, 255, 0.08)) !important;
  color: var(--cb-text, #e8eef4) !important;
}

html[data-color-mode="dark"] .list-group-item-action:hover,
html[data-color-mode="dark"] .list-group-item-action:focus,
html[data-color-mode="dark"] a.list-group-item:hover,
html[data-color-mode="dark"] a.list-group-item:focus {
  background: var(--cb-bg-hover, #2a3545) !important;
  color: var(--cb-text, #e8eef4) !important;
}

html[data-color-mode="dark"] .list-group-item-warning,
html[data-color-mode="dark"] a.list-group-item-warning,
html[data-color-mode="dark"] button.list-group-item-warning {
  background: rgba(240, 193, 74, 0.12) !important;
  color: var(--cb-text, #e8eef4) !important;
  border-color: rgba(240, 193, 74, 0.28) !important;
}

html[data-color-mode="dark"] .list-group-item-warning:hover,
html[data-color-mode="dark"] a.list-group-item-warning:hover {
  background: rgba(240, 193, 74, 0.2) !important;
}

html[data-color-mode="dark"] .list-group-item .text-muted,
html[data-color-mode="dark"] .list-group-item small,
html[data-color-mode="dark"] .list-group-item p {
  color: var(--cb-text-muted, #9aa8b5) !important;
}

html[data-color-mode="dark"] .badge-warning {
  background: rgba(240, 193, 74, 0.2);
  color: #fde68a;
  border: 1px solid rgba(240, 193, 74, 0.35);
}

/* ------------------------------------------------------------------
 * Messages inbox + thread
 * ------------------------------------------------------------------ */

.msg-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.msg-page-heading {
  min-width: 0;
  flex: 1 1 160px;
}

.msg-page-heading .card-title {
  margin: 0 0 2px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.msg-guest-photo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}

.msg-stay-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 6px;
  font-size: 12px;
  color: #475569;
}

.msg-listing-thumb {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  flex: 0 0 auto;
}

.msg-stay-label {
  font-weight: 600;
  color: #0f172a;
}

.msg-stay-status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
  background: #e2e8f0;
  color: #334155;
}

.msg-stay-status-finalized,
.msg-stay-status-booked {
  background: #dcfce7;
  color: #166534;
}

.msg-stay-status-pre-approved,
.msg-stay-status-approved {
  background: #dbeafe;
  color: #1d4ed8;
}

.msg-stay-status-cancelled,
.msg-stay-status-canceled {
  background: #fee2e2;
  color: #b91c1c;
}

.msg-page-header .btn-ghost {
  flex: 0 0 auto;
  margin-top: 2px;
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .msg-page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .msg-page-header .btn-ghost {
    align-self: flex-start;
    margin-top: 0;
  }

  .msg-convo-top {
    flex-direction: column;
  }
}

.msg-inbox {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg-convo {
  display: block;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
  color: inherit;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.msg-convo:hover,
.msg-convo:focus {
  background: #eef2f7;
  border-color: rgba(15, 23, 42, 0.12);
  color: inherit;
  text-decoration: none;
}

.msg-convo.is-unread {
  background: #fff7ed;
  border-color: rgba(245, 158, 11, 0.35);
}

.msg-convo-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.msg-convo-name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.msg-convo-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.msg-convo-time {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}

.msg-convo-unit {
  margin: 4px 0 0;
  font-size: 13px;
  color: #64748b;
}

.msg-convo-preview {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.28);
}

.msg-platform {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #fff;
  line-height: 1;
  flex-shrink: 0;
}
.msg-platform-airbnb { background: #ff5a5f; }
.msg-platform-he { background: #0f766e; }
.msg-platform-tr { background: #00b140; }

.msg-thread {
  max-height: 55vh;
  overflow-y: auto;
  margin-bottom: 16px;
  padding: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 12px;
}

.msg-row {
  margin: 8px 0;
  display: flex;
}

.msg-row.is-host {
  justify-content: flex-end;
}

.msg-row.is-guest {
  justify-content: flex-start;
}

.msg-bubble {
  max-width: 75%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.msg-bubble--host {
  background: linear-gradient(135deg, #2bb8c0 0%, #1a9aa8 100%);
  color: #ffffff;
  border-bottom-right-radius: 5px;
}

.msg-bubble--guest {
  background: #e2e8f0;
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-bottom-left-radius: 5px;
}

.msg-bubble-body {
  white-space: pre-wrap;
}

.msg-bubble-meta {
  font-size: 11px;
  opacity: 0.78;
  margin-top: 4px;
}

.msg-composer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg-composer .form-group {
  margin-bottom: 0;
}

.msg-composer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.msg-send-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 12px !important;
  padding: 9px 16px !important;
}

html[data-color-mode="dark"] .msg-convo {
  background: var(--cb-bg-soft, #222c3a);
  border-color: var(--cb-border, rgba(255, 255, 255, 0.08));
  color: var(--cb-text, #e8eef4);
}

html[data-color-mode="dark"] .msg-convo:hover,
html[data-color-mode="dark"] .msg-convo:focus {
  background: var(--cb-bg-hover, #2a3545);
  border-color: var(--cb-border-strong, rgba(255, 255, 255, 0.14));
  color: var(--cb-text, #e8eef4);
}

html[data-color-mode="dark"] .msg-convo.is-unread {
  background: rgba(240, 193, 74, 0.12);
  border-color: rgba(240, 193, 74, 0.28);
}

html[data-color-mode="dark"] .msg-convo-time,
html[data-color-mode="dark"] .msg-convo-unit {
  color: var(--cb-text-muted, #9aa8b5);
}

html[data-color-mode="dark"] .msg-convo-preview {
  color: #cbd5e1;
}

html[data-color-mode="dark"] .msg-badge {
  background: rgba(240, 193, 74, 0.18);
  color: #fde68a;
  border-color: rgba(240, 193, 74, 0.32);
}

html[data-color-mode="dark"] .msg-thread {
  background: linear-gradient(180deg, #0f172a 0%, #0b1220 55%, #0a1018 100%);
  border-color: var(--cb-border, rgba(255, 255, 255, 0.08));
}

html[data-color-mode="dark"] .msg-bubble--host {
  background: linear-gradient(135deg, #1a9fb0 0%, #0d7a8a 100%);
  color: #f0fdfa;
}

html[data-color-mode="dark"] .msg-bubble--guest {
  background: #1e293b;
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.12);
}

html[data-color-mode="dark"] .msg-bubble--guest .msg-bubble-meta,
html[data-color-mode="dark"] .msg-bubble--host .msg-bubble-meta {
  color: inherit;
}
