/* ══════════════════════════════════════════════════════════════
   DE PALMS HOTEL — AI CONCIERGE CHAT WIDGET
   Architectural & Boxy Design Language (Matching Reference Mockup)
   • Strict border-radius: 0 across all elements
   • Millimeter / blueprint graph grid background
   • Generous container padding (eliminates left edge hugging)
   • White message cards with dark green vertical left accent bar
   • Reference number tag pills ([DP-XXXXXX])
   • Crisp 2x2 reservation voucher (without internal logging footer)
   • Quick action suggestion chips above input bar
   • Attachment button, send button, and micro-text subtext footer
   • Graceful fallback card linking to WhatsApp and direct call
   ══════════════════════════════════════════════════════════════ */

/* ─── Widget Root Container ───────────────────────────────── */

#dp-chat-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  font-family: var(--sans, 'DM Sans', Arial, sans-serif);
  color: var(--ink, #151815);
  -webkit-font-smoothing: antialiased;
}

/* Keep the reset weaker than component rules so their spacing can take effect. */
:where(#dp-chat-root *, #dp-chat-root *::before, #dp-chat-root *::after) {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0 !important;
}

/* ─── Boxy Launcher Button ────────────────────────────────── */

.dp-launcher {
  width: 58px;
  height: 58px;
  background: var(--green, #174c3b);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 12px 32px -4px rgba(23, 76, 59, 0.45),
              0 2px 10px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.25s ease;
  outline: none;
  color: #fff;
}

.dp-launcher:hover {
  background: #0d2e23;
  transform: translateY(-2px);
  box-shadow: 0 16px 36px -4px rgba(23, 76, 59, 0.55),
              0 0 0 1px var(--green, #174c3b);
}

.dp-launcher:active {
  transform: translateY(0);
}

.dp-launcher svg {
  width: 26px;
  height: 26px;
  color: #fff;
  transition: transform 0.2s ease;
}

.dp-launcher.is-open .dp-icon-chat { display: none; }
.dp-launcher:not(.is-open) .dp-icon-close { display: none; }

/* Boxy online status indicator on launcher */
.dp-launcher-pip {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 9px;
  height: 9px;
  background: #10b981;
  border: 1.5px solid var(--green, #174c3b);
}

.dp-launcher-pip::after {
  content: '';
  position: absolute;
  inset: -3px;
  background: rgba(16, 185, 129, 0.4);
  animation: dpPulseBox 2.4s infinite;
}

@keyframes dpPulseBox {
  0%   { transform: scale(0.9); opacity: 0.9; }
  70%  { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ─── Boxy Greeting Notification Popout ───────────────────── */

.dp-greet-pop {
  position: absolute;
  right: 74px;
  bottom: 2px;
  width: 320px;
  background: #fff;
  box-shadow: 0 16px 40px -8px rgba(21, 24, 21, 0.22),
              0 4px 14px rgba(21, 24, 21, 0.08);
  border: 1px solid rgba(21, 24, 21, 0.15);
  padding: 18px 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  animation: dpPopIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 999;
}

.dp-greet-pop:hover {
  transform: translateY(-2px);
  border-color: rgba(23, 76, 59, 0.4);
}

.dp-greet-pop.is-hidden {
  display: none !important;
}

.dp-greet-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: rgba(21, 24, 21, 0.45);
  cursor: pointer;
  padding: 4px 6px;
  transition: color 0.15s, background 0.15s;
}

.dp-greet-close:hover {
  color: var(--ink, #151815);
  background: #f7f8f5;
}

.dp-greet-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.dp-greet-avatar {
  width: 36px;
  height: 36px;
  background: #0e3225;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2bf7d;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.dp-greet-avatar svg {
  width: 20px;
  height: 20px;
}

.dp-greet-avatar .dp-avatar-pip {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 7px;
  height: 7px;
  background: #10b981;
  border: 1px solid #0e3225;
}

.dp-greet-content {
  flex: 1;
  padding-right: 8px;
}

.dp-greet-title {
  font-family: var(--display, 'Instrument Serif', Georgia, serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: #174c3b;
  letter-spacing: 0.01em;
}

.dp-greet-msg {
  font-family: var(--sans, 'DM Sans', sans-serif);
  font-size: 0.8rem;
  line-height: 1.48;
  color: rgba(21, 24, 21, 0.75);
  margin-top: 3px;
}

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

/* ─── Boxy Chat Card Container ────────────────────────────── */

.dp-card {
  position: absolute;
  bottom: 74px;
  right: 0;
  width: 416px;
  max-width: calc(100vw - 32px);
  height: 630px;
  max-height: calc(100vh - 110px);
  max-height: calc(100dvh - 110px);
  background: #fff;
  box-shadow: 0 24px 60px -12px rgba(13, 46, 35, 0.4),
              0 6px 18px -4px rgba(21, 24, 21, 0.12);
  border: 1px solid #174c3b;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  visibility: hidden;

  /* Strict scroll isolation */
  overscroll-behavior: contain;
  -ms-scroll-chaining: none;
  touch-action: pan-y;
}

.dp-card.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

/* ─── Header: Luxury Dark Green with Gold Serif Title ─────── */

.dp-header {
  background: #0e3225;
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.dp-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dp-header-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e2bf7d;
  position: relative;
  flex-shrink: 0;
}

.dp-header-avatar svg {
  width: 22px;
  height: 22px;
}

.dp-header-avatar .dp-avatar-pip {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 7px;
  height: 7px;
  background: #10b981;
  border: 1px solid #0e3225;
}

.dp-header-info {
  display: flex;
  flex-direction: column;
}

.dp-header-info h3 {
  font-family: var(--display, 'Instrument Serif', Georgia, serif);
  font-size: 1.18rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: #e2bf7d;
}

.dp-header-info p {
  font: 600 0.58rem var(--mono, 'DM Mono', monospace);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #34d399;
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dp-header-info p::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #10b981;
}

.dp-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 8px;
}

.dp-header-btn {
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.75);
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  text-decoration: none;
}

.dp-header-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.dp-header-btn svg {
  width: 16px;
  height: 16px;
}

/* ─── Messages Stream with Millimeter Blueprint Grid ──────── */

.dp-messages {
  flex: 1;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;

  /* Generous container padding - completely fixes left padding issue */
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  scroll-behavior: smooth;

  /* Architectural millimeter graph grid background */
  background-color: #f6f8f5;
  background-image:
    linear-gradient(rgba(23, 76, 59, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 76, 59, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
}

.dp-messages::-webkit-scrollbar {
  width: 5px;
}

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

.dp-messages::-webkit-scrollbar-thumb {
  background: rgba(23, 76, 59, 0.18);
}

/* Date / Session Banner Pill */
.dp-date-badge {
  text-align: center;
  margin: 0 0 8px;
  padding: 2px 0;
}

.dp-date-badge span {
  font: 600 0.58rem var(--mono, 'DM Mono', monospace);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #2e4437;
  background: #dbe4d8;
  border: 1px solid #c8d4c5;
  padding: 4px 14px;
  display: inline-block;
}

/* ─── Architectural Message Layout (Matching Image 2) ──────── */

.dp-msg {
  display: flex;
  flex-direction: column;
  width: 100%;
  animation: dpMsgSlide 0.2s ease-out;
}

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

.dp-msg--ai {
  align-self: flex-start;
  width: 100%;
}

.dp-msg--user {
  align-self: flex-end;
  width: auto;
  max-width: 86%;
}

/* AI Concierge Boxy Message Cards with Dark Green Left Bar */
.dp-msg-card {
  background: #ffffff;
  border: 1px solid #d5ddd3;
  border-left: 3.5px solid #174c3b;
  padding: 15px 18px;
  margin-bottom: 10px;
  font-family: var(--sans, 'DM Sans', sans-serif);
  font-size: 0.88rem;
  line-height: 1.55;
  color: #1f2e26;
  box-shadow: 0 1px 3px rgba(23, 76, 59, 0.04);
  word-break: break-word;
}

.dp-msg-card:last-child {
  margin-bottom: 0;
}

.dp-msg-card strong {
  font-weight: 600;
  color: #11241a;
}

/* Reference Number Tag Badge Pill in AI Text */
.dp-tag-ref {
  background: #d8ece0;
  border: 1px solid #6fa887;
  color: #134635;
  font-family: var(--mono, 'DM Mono', monospace);
  font-weight: 700;
  padding: 2px 7px;
  display: inline-block;
  letter-spacing: 0.04em;
  font-size: 0.82rem;
  margin: 0 2px;
  vertical-align: baseline;
}

/* User Guest Message Bubble */
.dp-user-bubble {
  background: #e2ede4;
  color: #11241a;
  border: 1px solid rgba(23, 76, 59, 0.25);
  border-right: 3.5px solid #174c3b;
  padding: 14px 18px;
  font-family: var(--sans, 'DM Sans', sans-serif);
  font-size: 0.88rem;
  line-height: 1.5;
  box-shadow: 0 1px 4px rgba(23, 76, 59, 0.05);
  word-break: break-word;
}

.dp-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 6px;
  font: 500 0.54rem var(--mono, 'DM Mono', monospace);
  letter-spacing: 0.06em;
  color: rgba(21, 24, 21, 0.45);
}

.dp-bubble-ticks {
  color: var(--green, #174c3b);
  display: inline-flex;
  align-items: center;
}

.dp-bubble-ticks svg {
  width: 13px;
  height: 13px;
}

/* ─── Boxy Bank Accounts Card ─────────────────────────────── */

.dp-bank-card {
  margin: 8px 0;
  background: #fff;
  border: 1px solid rgba(23, 76, 59, 0.35);
  overflow: hidden;
}

.dp-bank-card-title {
  background: var(--green, #174c3b);
  color: #fff;
  font: 600 0.62rem var(--mono, 'DM Mono', monospace);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 9px 14px;
}

.dp-bank-item {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(21, 24, 21, 0.1);
}

.dp-bank-item:last-child {
  border-bottom: none;
}

.dp-bank-name {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--green, #174c3b);
}

.dp-bank-acc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-family: var(--mono, 'DM Mono', monospace);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink, #151815);
  background: #f7f8f5;
  padding: 6px 10px;
  border: 1px solid rgba(21, 24, 21, 0.12);
}

.dp-bank-acc button {
  background: var(--green, #174c3b);
  border: none;
  color: #fff;
  font: 600 0.54rem var(--mono, 'DM Mono', monospace);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.dp-bank-acc button:hover {
  background: #0d2e23;
}

.dp-bank-holder {
  font-size: 0.72rem;
  color: rgba(21, 24, 21, 0.65);
  margin-top: 4px;
}

/* ─── Boxy Reservation Voucher Card (Matching Image 2) ────── */

.dp-voucher {
  margin: 6px 0;
  background: #fff;
  border: 1px solid #174c3b;
  box-shadow: 0 2px 6px rgba(23, 76, 59, 0.08);
  overflow: hidden;
}

.dp-voucher-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #174c3b;
  color: #fff;
}

.dp-voucher-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--display, 'Instrument Serif', Georgia, serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: #e2bf7d;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dp-voucher-bell {
  font-size: 1rem;
}

.dp-voucher-ref {
  font: 700 0.65rem var(--mono, 'DM Mono', monospace);
  letter-spacing: 0.08em;
  background: #0a241b;
  color: #34d399;
  border: 1px solid #1c5c43;
  padding: 3px 8px;
}

.dp-voucher-body {
  padding: 14px 16px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dp-voucher-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dp-voucher-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dp-voucher-label {
  font: 600 0.52rem var(--mono, 'DM Mono', monospace);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #85968b;
}

.dp-voucher-val {
  font-family: var(--sans, 'DM Sans', sans-serif);
  font-size: 0.86rem;
  font-weight: 600;
  color: #1f2e26;
  line-height: 1.35;
}

.dp-voucher-val--total {
  font-size: 1.15rem;
  font-weight: 700;
  color: #174c3b;
}

.dp-voucher-badge {
  display: inline-block;
  background: #f0f4ef;
  border: 1px solid #c8d4c5;
  color: #2a4034;
  font: 700 0.6rem var(--mono, 'DM Mono', monospace);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  width: fit-content;
}

.dp-voucher-divider {
  border-bottom: 1px solid #edf2ec;
}

/* Note: dp-voucher-footer completely removed per user instruction */

/* ─── Quick Suggestion Chips Bar (Directly Above Input Bar) ── */

.dp-chips-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: #f6f8f5;
  border-top: 1px solid #d5ddd3;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.dp-chips-bar::-webkit-scrollbar {
  display: none;
}

.dp-chip-btn {
  background: #ffffff;
  border: 1px solid #c8d4c5;
  color: #233e31;
  font: 600 0.62rem var(--mono, 'DM Mono', monospace);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.dp-chip-btn:hover {
  background: #174c3b;
  color: #ffffff;
  border-color: #174c3b;
}

/* ─── Boxy Typing Indicator ───────────────────────────────── */

.dp-typing-bubble {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #d5ddd3;
  border-left: 3.5px solid #174c3b;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}

.dp-typing-dot {
  width: 5px;
  height: 5px;
  background: #174c3b;
  animation: dpBounceBox 1.4s ease-in-out infinite;
}

.dp-typing-dot:nth-child(2) { animation-delay: 0.16s; }
.dp-typing-dot:nth-child(3) { animation-delay: 0.32s; }

.dp-typing-text {
  font: 600 0.58rem var(--mono, 'DM Mono', monospace);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(21, 24, 21, 0.45);
  margin-left: 4px;
}

@keyframes dpBounceBox {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-3px); }
}

/* ─── Graceful Error Fallback Card ────────────────────────── */

.dp-error-card {
  background: #fff;
  border: 1px solid #e5a5a5;
  border-left: 4px solid #b91c1c;
  padding: 14px 16px;
  margin: 6px 0;
  box-shadow: 0 2px 8px rgba(185, 28, 28, 0.08);
}

.dp-error-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 700 0.65rem var(--mono, 'DM Mono', monospace);
  color: #991b1b;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.dp-error-body p {
  font-family: var(--sans, 'DM Sans', sans-serif);
  font-size: 0.83rem;
  line-height: 1.5;
  color: #374151;
  margin-bottom: 12px;
}

.dp-error-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dp-error-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  font: 600 0.65rem var(--mono, 'DM Mono', monospace);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.dp-error-btn svg {
  width: 15px;
  height: 15px;
}

.dp-error-btn--wa {
  background: #25d366;
  color: #fff;
  border: 1px solid #20ba5a;
}

.dp-error-btn--wa:hover {
  background: #1ebd5a;
}

.dp-error-btn--call {
  background: #174c3b;
  color: #fff;
  border: 1px solid #0f382b;
}

.dp-error-btn--call:hover {
  background: #0d2e23;
}

/* ─── Boxy Bottom Input Bar with Micro-Text ───────────────── */

.dp-input-bar {
  display: flex;
  flex-direction: column;
  padding: 14px 20px 10px;
  background: #fff;
  border-top: 1px solid #d5ddd3;
  flex-shrink: 0;
}

.dp-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dp-chat-input {
  flex: 1;
  height: 38px;
  border: 1px solid #ccd6cb;
  padding: 0 14px;
  font-family: var(--sans, 'DM Sans', sans-serif);
  font-size: 0.88rem;
  color: var(--ink, #151815);
  outline: none;
  background: #fcfdfc;
  transition: border-color 0.2s, background 0.2s;
}

.dp-chat-input:focus {
  border-color: #174c3b;
  background: #fff;
}

.dp-chat-input::placeholder {
  color: rgba(21, 24, 21, 0.42);
}

.dp-send-btn {
  width: 38px;
  height: 38px;
  background: #174c3b;
  border: 1px solid #174c3b;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.2s;
}

.dp-send-btn:hover:not(:disabled) {
  background: #0d2e23;
}

.dp-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dp-send-btn svg {
  width: 17px;
  height: 17px;
}

.dp-input-micro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 0 2px;
  font: 500 0.52rem var(--mono, 'DM Mono', monospace);
  color: #85968b;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ─── Mobile View ─────────────────────────────────────────── */

@media (max-width: 767px) {
  #dp-chat-root {
    bottom: 16px;
    right: 16px;
  }

  .dp-launcher {
    width: 54px;
    height: 54px;
  }

  .dp-launcher svg {
    width: 24px;
    height: 24px;
  }

  .dp-greet-pop {
    right: 0;
    bottom: 64px;
    width: calc(100vw - 32px);
    max-width: 340px;
    padding: 16px 18px;
  }

  .dp-card {
    bottom: 64px;
    right: -4px;
    width: calc(100vw - 24px);
    max-width: 390px;
    height: min(560px, 80vh);
    max-height: calc(100dvh - 84px);
  }

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

  .dp-header-info h3 {
    font-size: 1.05rem;
  }

  .dp-messages {
    padding: 16px 16px 12px;
    gap: 12px;
  }

  .dp-chips-bar {
    padding: 8px 16px;
    gap: 8px;
  }

  .dp-chip-btn {
    padding: 6px 10px;
    font-size: 0.58rem;
  }

  .dp-input-bar {
    padding: 12px 16px 8px;
  }

  .dp-send-btn {
    width: 36px;
    height: 36px;
  }

  .dp-chat-input {
    height: 36px;
    font-size: 0.84rem;
  }

  .dp-input-micro {
    font-size: 0.48rem;
  }
}

/* ─── Accessibility: Reduced Motion ───────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .dp-card,
  .dp-launcher,
  .dp-greet-pop,
  .dp-msg {
    transition: none !important;
    animation: none !important;
  }

  .dp-launcher-pip::after,
  .dp-typing-dot {
    animation: none !important;
  }
}
