/* ==========================================================================
   Istanbul Photoshoot - AI Chatbot & WhatsApp Handoff Widget Styles
   Lüks Editoryal Cam Morfolojisi & Mobil Uyumlu Tasarım
   Brand Colors: #1a1c1b (İnk), #825335 (Terracotta), #059669 (WhatsApp Emerald)
   ========================================================================== */

:root {
  --chat-primary: #1a1c1b;
  --chat-accent: #825335;
  --chat-accent-hover: #6a4229;
  --chat-wa: #059669;
  --chat-wa-hover: #047857;
  --chat-bg: rgba(255, 255, 255, 0.92);
  --chat-border: rgba(26, 28, 27, 0.1);
  --chat-glass-border: rgba(255, 255, 255, 0.65);
  --chat-font-serif: "Cinzel", "Playfair Display", Georgia, serif;
  --chat-font-sans: "Hind Siliguri", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* 1. Floating Launcher Button */
.chat-launcher {
  position: fixed;
  bottom: 1.75rem;
  right: 5.75rem; /* Next to WhatsApp button */
  z-index: 99990;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1.15rem;
  border-radius: 999px;
  background: rgba(26, 28, 27, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, background 0.25s ease;
  font-family: var(--chat-font-sans);
  text-decoration: none;
}

.chat-launcher:hover {
  transform: translateY(-2px) scale(1.03);
  background: #1a1c1b;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.45);
}

.chat-launcher-icon {
  position: relative;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.chat-launcher-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.chat-launcher-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px #1a1c1b;
}

.chat-launcher-text {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* 2. Chat Widget Window */
.chat-window {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  width: 380px;
  max-width: calc(100vw - 3rem);
  height: 600px;
  max-height: calc(100dvh - 7rem);
  z-index: 99995;
  border-radius: 24px;
  background: var(--chat-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--chat-glass-border);
  box-shadow: 0 25px 60px rgba(10, 10, 10, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.4) inset;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--chat-font-sans);
}

.chat-window.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* 3. Header */
.chat-header {
  padding: 1.15rem 1.25rem;
  background: linear-gradient(135deg, #1a1c1b 0%, #262725 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.chat-header-profile {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.chat-avatar {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #825335 0%, #4a2c1d 100%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  display: grid;
  place-items: center;
  overflow: visible;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.chat-avatar-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
}

.chat-avatar-svg {
  width: 22px;
  height: 22px;
  stroke: #ffffff;
  display: block;
}

.chat-avatar-status {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #1a1c1b;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
}

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

.chat-header-title {
  font-family: var(--chat-font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #ffffff;
  line-height: 1.25;
}

.chat-header-sub {
  font-size: 0.725rem;
  color: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 2px;
}

.chat-header-sub::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

.chat-close-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: scale(1.06);
}

/* 4. Messages Stream */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(26, 28, 27, 0.2) transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(26, 28, 27, 0.2);
  border-radius: 999px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: chatMsgFadeIn 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.chat-msg-bot {
  align-self: flex-start;
}

.chat-msg-user {
  align-self: flex-end;
}

.chat-bubble {
  padding: 0.85rem 1.05rem;
  border-radius: 18px;
  font-size: 0.885rem;
  line-height: 1.5;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.04);
  word-break: break-word;
}

.chat-msg-bot .chat-bubble {
  background: #ffffff;
  color: #1a1c1b;
  border: 1px solid rgba(26, 28, 27, 0.08);
  border-bottom-left-radius: 4px;
}

.chat-msg-user .chat-bubble {
  background: #1a1c1b;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chat-time {
  font-size: 0.65rem;
  color: #8c8c88;
  margin-top: 0.25rem;
  padding-inline: 0.35rem;
}

.chat-msg-user .chat-time {
  text-align: right;
}

/* 5. Typing Indicator */
.chat-typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.65rem 0.95rem;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid rgba(26, 28, 27, 0.08);
  border-bottom-left-radius: 4px;
}

.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chat-accent);
  animation: chatBounce 1.3s infinite ease-in-out;
}

.chat-typing span:nth-child(2) { animation-delay: 0.18s; }
.chat-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes chatBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

/* 6. Quick Action Chips */
.chat-chips-wrap {
  padding: 0 1rem 0.75rem;
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.chat-chips-wrap::-webkit-scrollbar {
  display: none;
}

.chat-chip {
  flex-shrink: 0;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--chat-border);
  color: #1a1c1b;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.chat-chip:hover {
  border-color: var(--chat-accent);
  color: var(--chat-accent);
  background: rgba(130, 83, 53, 0.05);
  transform: translateY(-1px);
}

/* 7. WhatsApp Handoff Booking Card */
.chat-handoff-card {
  margin-top: 0.65rem;
  padding: 1.1rem;
  border-radius: 16px;
  background: linear-gradient(145deg, #ffffff 0%, #faf8f5 100%);
  border: 1px solid rgba(130, 83, 53, 0.25);
  box-shadow: 0 6px 20px rgba(130, 83, 53, 0.08);
}

.handoff-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px dashed rgba(26, 28, 27, 0.15);
}

.handoff-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--chat-wa);
}

.handoff-title {
  font-family: var(--chat-font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a1c1b;
}

.handoff-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.95rem;
  font-size: 0.8rem;
  color: #4a4a46;
}

.handoff-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.handoff-row span {
  color: #737370;
}

.handoff-row strong {
  color: #1a1c1b;
  text-align: right;
}

.handoff-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: #059669;
  color: #ffffff;
  font-size: 0.825rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.28);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.handoff-btn:hover {
  background: #047857;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(5, 150, 105, 0.35);
}

.handoff-btn svg {
  fill: currentColor;
  flex-shrink: 0;
}

/* 8. Input Area */
.chat-footer {
  padding: 0.85rem 1rem 1rem;
  background: #ffffff;
  border-top: 1px solid var(--chat-border);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  border: 1px solid rgba(26, 28, 27, 0.15);
  background: #fbfbfb;
  border-radius: 999px;
  padding: 0.7rem 1.15rem;
  font-size: 0.885rem;
  font-family: inherit;
  color: #1a1c1b;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.chat-input:focus {
  border-color: var(--chat-accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(130, 83, 53, 0.12);
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #1a1c1b;
  border: none;
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.18s ease, background 0.18s ease;
}

.chat-send-btn:hover {
  background: var(--chat-accent);
  transform: scale(1.08);
}

.chat-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.chat-send-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

/* 9. Mobile Sticky Thumb Bar (Inspired by emniyetservis.com) */
.chat-mobile-bar {
  display: none; /* Hidden on desktop */
}

@media (max-width: 768px) {
  /* Hide the old cluttered floating buttons on mobile */
  .chat-launcher {
    display: none !important;
  }
  .floating-whatsapp {
    display: none !important;
  }
  .back-to-top {
    bottom: 5.5rem !important;
  }
  body {
    padding-bottom: 74px !important;
  }

  /* Show the sleek anchored bottom bar */
  .chat-mobile-bar {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99990;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(26, 28, 27, 0.12);
    box-shadow: 0 -8px 25px rgba(26, 28, 27, 0.12);
    padding: 0.5rem 0.75rem max(0.55rem, env(safe-area-inset-bottom, 0px));
  }

  .chat-mobile-bar-inner {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    max-width: 440px;
    margin: 0 auto;
  }

  .chat-mobile-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.25rem;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  .chat-mobile-btn:active {
    transform: scale(0.95);
  }

  .chat-mobile-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-bottom: 2px;
  }

  .chat-mobile-btn-icon svg {
    width: 20px;
    height: 20px;
    display: block;
  }

  .chat-mobile-btn-label {
    font-family: var(--chat-font-sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.1;
  }

  /* 1. Call Studio - Dark Ink */
  .chat-mobile-call {
    background: #1a1c1b;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(26, 28, 27, 0.25);
  }
  .chat-mobile-call:hover {
    background: #2b2e2d;
  }

  /* 2. WhatsApp Direct - Rich Emerald */
  .chat-mobile-wa {
    background: #059669;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(5, 150, 105, 0.35);
  }
  .chat-mobile-wa:hover {
    background: #047857;
  }

  /* 3. AI Assistant - Warm Terracotta */
  .chat-mobile-ai {
    background: #825335;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(130, 83, 53, 0.35);
  }
  .chat-mobile-ai:hover {
    background: #6a4229;
  }

  /* Status Badges */
  .chat-mobile-badge {
    position: absolute;
    top: -5px;
    right: 4px;
    padding: 1px 5px;
    border-radius: 999px;
    background: #a7f3d0;
    color: #064e3b;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  }

  .chat-badge-amber {
    background: #fef3c7;
    color: #92400e;
  }

  /* Mobile Chat Window Placement */
  .chat-window {
    right: 0.5rem;
    left: 0.5rem;
    bottom: 4.85rem;
    width: auto;
    max-width: none;
    height: 74dvh;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  }
}
