/* ================= FLOATING CHAT / CONTACT BUBBLE (cinematic) ================= */

:root {
  --chat-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --chat-ease-out: cubic-bezier(0.33, 1, 0.68, 1);
}

.chat-bubble-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  font-family: 'Inter', sans-serif;
}

/* Cinematic bubble: steady gold depth; motion on hover only (no idle keyframe loop) */
.chat-bubble-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #d4b04d 0%, var(--gold) 40%, #a68b38 100%);
  background-size: 200% 200%;
  color: #0a1222;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 3px 16px rgba(200, 166, 70, 0.2),
    0 0 26px rgba(200, 166, 70, 0.07);
  transition: transform 0.5s var(--chat-ease), box-shadow 0.5s var(--chat-ease), background-position 0.6s ease;
}

.chat-bubble-btn:hover {
  transform: scale(1.06);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.22),
    0 6px 26px rgba(200, 166, 70, 0.32),
    0 0 44px rgba(200, 166, 70, 0.12);
}

.chat-bubble-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  transition: transform 0.4s var(--chat-ease);
}

.chat-bubble-icon svg {
  width: 24px;
  height: 24px;
  display: block;
}

.chat-bubble-icon svg [stroke] {
  stroke-width: 1.9;
}

.chat-bubble-btn:hover .chat-bubble-icon {
  transform: scale(1.04);
}

/* Panel: cinematic reveal from bubble (origin bottom-right) */
.chat-panel {
  position: absolute;
  bottom: calc(56px + 16px);
  right: 0;
  width: 380px;
  max-width: calc(100vw - 48px);
  max-height: 520px;
  background: linear-gradient(180deg, rgba(14, 22, 40, 0.985) 0%, rgba(10, 18, 34, 0.975) 100%);
  backdrop-filter: blur(10px) saturate(1.06);
  -webkit-backdrop-filter: blur(10px) saturate(1.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 25px 80px rgba(0, 0, 0, 0.55),
    0 0 120px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  transform-origin: 100% 100%;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.88);
  transition:
    opacity 0.4s var(--chat-ease),
    transform 0.45s var(--chat-ease),
    visibility 0.4s;
}

.chat-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Premium subtle scrollbars inside chat panel */
.chat-panel ::-webkit-scrollbar {
  width: 6px;
}

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

.chat-panel ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

.chat-panel ::-webkit-scrollbar-thumb:hover {
  background: rgba(200, 166, 70, 0.4);
}

.chat-panel {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* Staggered content reveal when panel opens */
.chat-panel .chat-panel-header,
.chat-panel .chat-panel-tabs,
.chat-panel .chat-panel-content {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s var(--chat-ease), transform 0.35s var(--chat-ease);
}

.chat-panel.open .chat-panel-header {
  transition-delay: 0.08s;
  opacity: 1;
  transform: translateY(0);
}

.chat-panel.open .chat-panel-tabs {
  transition-delay: 0.14s;
  opacity: 1;
  transform: translateY(0);
}

.chat-panel.open .chat-panel-content {
  transition-delay: 0.2s;
  opacity: 1;
  transform: translateY(0);
}

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-panel-header h3 {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: rgba(230, 234, 248, 0.88);
  margin: 0;
  letter-spacing: 0.01em;
  line-height: 1.35;
  max-width: min(260px, calc(100% - 44px));
}

.chat-panel-close {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.3s var(--chat-ease), color 0.3s ease, transform 0.25s var(--chat-ease);
}

.chat-panel-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transform: none;
}

.chat-panel-tabs {
  display: flex;
  padding: 10px 14px 0;
  gap: 6px;
}

.chat-tab {
  flex: 1;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.3s var(--chat-ease), color 0.3s ease;
}

.chat-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.chat-tab.active {
  background: rgba(200, 166, 70, 0.18);
  color: var(--gold);
}

.chat-panel-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 16px 16px;
}

.chat-tab-pane {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.chat-tab-pane.active {
  display: flex;
}

/* Contact tab: scroll on pane so .contact-options does not clip hover shadows/borders */
#pane-contact.chat-tab-pane {
  overflow-y: auto;
  overflow-x: visible;
  min-height: 0;
}

/* Chat pane */
.chat-ai-placeholder {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.chat-suggest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chat-suggest-chip {
  padding: 0.35rem 0.55rem;
  font-size: 12px;
  line-height: 1.2;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.chat-suggest-chip:hover {
  background: rgba(200, 166, 70, 0.12);
  border-color: rgba(200, 166, 70, 0.25);
  color: #fff;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  min-height: 80px;
  margin-bottom: 10px;
}

.chat-msg {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 8px;
  max-width: 90%;
  overflow-wrap: anywhere; /* avoid overflow in long words/URLs */
  word-break: break-word;
  transition: opacity 0.35s var(--chat-ease), transform 0.35s var(--chat-ease);
}

.chat-msg.chat-msg-new {
  opacity: 0;
  transform: translateY(10px) scale(0.98);
}

.chat-msg-user {
  background: rgba(200, 166, 70, 0.25);
  color: #fff;
  margin-left: auto;
}

.chat-msg-bot {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.chat-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 14px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    border-color 0.28s var(--chat-ease),
    background 0.28s var(--chat-ease),
    box-shadow 0.28s var(--chat-ease);
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.chat-input:focus,
.chat-input:focus-visible {
  border-color: rgba(200, 166, 70, 0.28);
  background: rgba(255, 255, 255, 0.075);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 3px rgba(200, 166, 70, 0.1);
}

.chat-send-btn {
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  background: var(--gold);
  color: #0a1222;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.chat-send-btn:hover {
  background: #d4b04d;
  transform: none;
}

/* Contact pane */
.contact-options {
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow: visible;
}

.contact-option {
  padding: 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.3s var(--chat-ease), background 0.3s ease, border-color 0.3s ease;
}

.contact-option:active {
  transform: scale(0.99);
}

.contact-option-icon,
.contact-option-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  margin-bottom: 4px;
}

.contact-option-detail {
  font-size: 13px;
  color: var(--text);
}

/* WhatsApp — horizontal row: site navy/gold + small brand badge (not a green slab) */
.contact-option.contact-whatsapp {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition:
    transform 0.28s var(--chat-ease),
    background 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s var(--chat-ease);
}

.contact-whatsapp .whatsapp-card-badge {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(37, 211, 102, 0.1);
  border: 1px solid rgba(37, 211, 102, 0.22);
  color: #25d366;
}

.contact-whatsapp .whatsapp-card-icon {
  display: block;
}

.contact-whatsapp .whatsapp-card-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.contact-whatsapp .whatsapp-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
  line-height: 1.25;
}

.contact-whatsapp .whatsapp-card-sub {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  color: rgba(209, 213, 219, 0.72);
}

.contact-whatsapp .whatsapp-card-cta {
  flex-shrink: 0;
}

.contact-whatsapp .whatsapp-card-cta-inner {
  display: inline-block;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(10, 18, 34, 0.95);
  background: linear-gradient(145deg, #e0c66a 0%, var(--gold) 45%, #b08d30 100%);
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 2px 10px rgba(200, 166, 70, 0.25);
  transition:
    transform 0.22s var(--chat-ease),
    box-shadow 0.22s ease,
    filter 0.2s ease;
}

.contact-whatsapp.contact-option:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(200, 166, 70, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 8px 24px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(200, 166, 70, 0.12);
}

.contact-whatsapp.contact-option:hover .whatsapp-card-cta-inner {
  filter: brightness(1.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 4px 14px rgba(200, 166, 70, 0.35);
}

.contact-whatsapp.contact-option:active {
  transform: translateY(0) scale(0.99);
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 2px 10px rgba(0, 0, 0, 0.22);
}

@media (prefers-reduced-motion: reduce) {
  .contact-option.contact-whatsapp,
  .contact-whatsapp .whatsapp-card-cta-inner {
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  }

  .contact-whatsapp.contact-option:hover {
    transform: none;
  }

  .contact-whatsapp.contact-option:active {
    transform: scale(0.99);
  }
}

/* Send a query — secondary */
.contact-option.contact-query {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.06);
}

.contact-query .contact-option-label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  margin-bottom: 6px;
}

.contact-query-form {
  position: relative;
}

.contact-query .query-input,
.contact-query .query-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    border-color 0.28s var(--chat-ease),
    background 0.28s var(--chat-ease),
    box-shadow 0.28s var(--chat-ease);
}

.contact-query .query-input::placeholder,
.contact-query .query-textarea::placeholder {
  color: rgba(255, 255, 255, 0.55);
  opacity: 1;
}

.contact-query .query-input:focus,
.contact-query .query-input:focus-visible,
.contact-query .query-textarea:focus,
.contact-query .query-textarea:focus-visible {
  border-color: rgba(200, 166, 70, 0.28);
  background: rgba(255, 255, 255, 0.075);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 3px rgba(200, 166, 70, 0.1);
}

.contact-query .query-name {
  margin-top: 10px;
  margin-bottom: 0;
}

.contact-query .query-email {
  margin-top: 10px;
  margin-bottom: 10px;
}

.contact-query .query-textarea {
  resize: vertical;
  min-height: 80px;
  margin-bottom: 6px;
}

.contact-query .query-error {
  margin: 0 0 8px;
  font-size: 12px;
  min-height: 18px;
}

.contact-query .query-error:not(.query-success) {
  color: #e8a0a0;
}

.contact-query .query-error.query-success {
  color: #7dcea0;
}

.contact-query #query-success {
  display: none;
}

/* Keyboard focus polish (inputs use soft ring in field rules — not this outline) */
:is(
  #chat-bubble-btn,
  #chat-panel-close,
  .chat-tab,
  .contact-whatsapp,
  #chat-send,
  #query-send-btn
):focus-visible {
  outline: 2px solid rgba(212, 176, 77, 0.9);
  outline-offset: 2px;
}

.contact-query .query-send-btn {
  width: 100%;
  margin-top: 4px;
  padding: 12px 14px;
  min-width: 0; /* override global .btn min-width so it fits neatly */
  border-radius: 10px;
  font-size: 14px;
}

/* Typing indicator inside chat messages */
.chat-typing {
  font-style: italic;
  color: rgba(255, 255, 255, 0.7);
  animation: chatTypingPulse 1.1s ease-in-out infinite;
}

@keyframes chatTypingPulse {
  0% { opacity: 0.55; }
  50% { opacity: 1; }
  100% { opacity: 0.55; }
}


.contact-email-direct .contact-email-link {
  display: inline-block;
  margin-top: 6px;
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  word-break: break-all;
  transition: color 0.2s;
}

.contact-email-direct .contact-email-link:hover {
  color: #d4b04d;
  text-decoration: underline;
}

/* Tablet optimization: keep desktop/mobile styles intact */
@media (min-width: 481px) and (max-width: 992px) {
  .chat-panel-tabs {
    padding: 10px 12px 0;
    gap: 4px;
  }

  .chat-tab {
    min-width: 0;       /* allow flex items to shrink */
    white-space: nowrap; /* prevent wrapping (Chat/Contact) */
    padding: 10px 10px;
    font-size: 12.5px;
  }

  .contact-options {
    gap: 18px; /* slightly tighter on tablet to avoid tall panel feeling */
  }
}

@media (max-width: 992px) {
  .chat-bubble-wrap {
    bottom: 20px;
    right: 20px;
  }
  .chat-panel {
    width: min(380px, calc(100vw - 32px));
    max-height: 65vh;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .chat-bubble-btn {
    animation: none;
  }
}

/* Extra comfort for tablet range (Surface Pro sizes) */
@media (min-width: 481px) and (max-width: 992px) {
  .chat-panel {
    max-height: 70vh; /* slightly taller than 992px max to prevent clipped content */
  }

  .chat-panel-content {
    padding: 10px 14px 14px;
  }

  .chat-messages {
    margin-bottom: 6px;
  }
}

@media (max-width: 480px) {
  .chat-bubble-wrap {
    bottom: 16px;
    right: 16px;
  }
  .chat-bubble-btn {
    width: 52px;
    height: 52px;
  }
  .chat-panel {
    width: calc(100vw - 32px);
    max-height: 70vh;
    right: 0;
  }
}

/* Prefer reduced motion: remove heavy transforms/animations */
@media (prefers-reduced-motion: reduce) {
  .chat-bubble-btn {
    animation: none !important;
    transition: none !important;
  }

  .chat-panel,
  .chat-panel .chat-panel-header,
  .chat-panel .chat-panel-tabs,
  .chat-panel .chat-panel-content {
    transition: none !important;
    transform: none !important;
  }

  .chat-tab {
    transition: none !important;
  }

  .chat-msg {
    transition: none !important;
  }
}

