/* BarnaRide AI Concierge Floating Widget Styles */
:root {
  --brai-bg-panel: rgba(22, 22, 26, 0.96);
  --brai-surface: #1E1E24;
  --brai-surface-hover: #282832;
  --brai-primary: #FFCC00;
  --brai-primary-glow: rgba(255, 204, 0, 0.35);
  --brai-accent-green: #25D366;
  --brai-accent-green-glow: rgba(37, 211, 102, 0.3);
  --brai-text-main: #FFFFFF;
  --brai-text-muted: #A1A1AA;
  --brai-border: rgba(255, 255, 255, 0.1);
  --brai-border-active: rgba(255, 204, 0, 0.4);
}

/* Floating Launcher Trigger */
.brai-launcher-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
}

/* Teaser / Welcome Bubble */
.brai-teaser {
  background: var(--brai-bg-panel);
  border: 1px solid var(--brai-border-active);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 12px 16px;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 204, 0, 0.15);
  max-width: 290px;
  color: var(--brai-text-main);
  font-size: 13px;
  line-height: 1.45;
  position: relative;
  cursor: pointer;
  transform-origin: bottom right;
  animation: brai-pop-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brai-teaser:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7), 0 0 25px rgba(255, 204, 0, 0.25);
}

.brai-teaser-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: var(--brai-text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  line-height: 1;
  border-radius: 50%;
  transition: color 0.15s ease;
}

.brai-teaser-close:hover {
  color: #FFFFFF;
}

.brai-teaser-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--brai-primary);
  font-size: 12px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.brai-teaser-body {
  color: #E4E4E7;
}

/* Floating Launcher Button */
.brai-launcher-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1C1C22 0%, #2D2D36 100%);
  border: 2px solid var(--brai-primary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px var(--brai-primary-glow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  user-select: none;
  outline: none;
}

.brai-launcher-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 204, 0, 0.55);
}

.brai-launcher-btn:active {
  transform: scale(0.96);
}

.brai-launcher-icon {
  width: 32px;
  height: 32px;
  fill: var(--brai-primary);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brai-launcher-btn.is-active .brai-launcher-icon {
  transform: rotate(90deg) scale(0.85);
}

.brai-online-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brai-accent-green);
  border: 2.5px solid #141416;
  box-shadow: 0 0 8px var(--brai-accent-green);
  animation: brai-pulse 2s infinite ease-in-out;
}

.brai-badge {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brai-primary);
  color: #000000;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}

/* Chat Popup Window */
.brai-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: var(--brai-bg-panel);
  border: 1px solid var(--brai-border-active);
  border-radius: 22px;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.75), 0 0 35px rgba(255, 204, 0, 0.15);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  z-index: 999998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  transform-origin: bottom right;
  opacity: 0;
  transform: scale(0.92) translateY(20px);
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Chat Header */
.brai-header {
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(35, 35, 42, 0.95) 0%, rgba(24, 24, 28, 0.9) 100%);
  border-bottom: 1px solid var(--brai-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.brai-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brai-avatar-wrap {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 204, 0, 0.15);
  border: 1.5px solid var(--brai-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brai-primary);
  font-size: 18px;
  box-shadow: 0 0 12px rgba(255, 204, 0, 0.2);
  flex-shrink: 0;
}

.brai-header-title-box {
  display: flex;
  flex-direction: column;
}

.brai-header-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--brai-text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.brai-header-status {
  font-size: 11px;
  color: var(--brai-accent-green);
  display: flex;
  align-items: center;
  gap: 4px;
}

.brai-status-dot-sm {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brai-accent-green);
  box-shadow: 0 0 6px var(--brai-accent-green);
}

.brai-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brai-header-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--brai-border);
  border-radius: 8px;
  color: var(--brai-text-muted);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.brai-header-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.2);
}

/* Quick Conversion Bar in Header */
.brai-contact-strip {
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--brai-border);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  flex-shrink: 0;
}

.brai-phone-link {
  color: #FFCC00;
  text-decoration: none;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: opacity 0.2s ease;
}

.brai-phone-link:hover {
  opacity: 0.85;
  text-decoration: underline;
}

.brai-wa-badge-btn {
  background: rgba(37, 211, 102, 0.15);
  color: #25D366;
  border: 1px solid rgba(37, 211, 102, 0.35);
  padding: 3px 8px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.brai-wa-badge-btn:hover {
  background: #25D366;
  color: #000000;
}

/* Chat Messages Area */
.brai-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.brai-body::-webkit-scrollbar {
  width: 5px;
}

.brai-body::-webkit-scrollbar-track {
  background: transparent;
}

.brai-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* Messages */
.brai-msg {
  display: flex;
  gap: 10px;
  max-width: 90%;
  animation: brai-msg-fade 0.25s ease-out forwards;
}

.brai-msg.is-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

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

.brai-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 204, 0, 0.12);
  border: 1px solid rgba(255, 204, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 2px;
}

.brai-msg-bubble {
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
}

.brai-msg.is-bot .brai-msg-bubble {
  background: var(--brai-surface);
  border: 1px solid var(--brai-border);
  border-top-left-radius: 4px;
  color: #E2E8F0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.brai-msg.is-user .brai-msg-bubble {
  background: linear-gradient(135deg, #FFCC00 0%, #E6B800 100%);
  color: #141416;
  font-weight: 500;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(255, 204, 0, 0.25);
}

.brai-msg-bubble p {
  margin: 0 0 8px 0;
}

.brai-msg-bubble p:last-child {
  margin-bottom: 0;
}

.brai-msg-bubble ul {
  margin: 6px 0;
  padding-left: 18px;
}

.brai-msg-bubble li {
  margin-bottom: 4px;
}

.brai-msg-bubble strong {
  color: #FFFFFF;
}

.brai-msg.is-user .brai-msg-bubble strong {
  color: #000000;
}

.brai-msg-bubble .brai-cta-action {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #25D366;
  color: #000000;
  font-weight: 700;
  font-size: 12.5px;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}

.brai-msg-bubble .brai-cta-action:hover {
  background: #20BA5A;
  transform: translateY(-1px);
}

.brai-msg-time {
  font-size: 10px;
  color: var(--brai-text-muted);
  margin-top: 4px;
  text-align: right;
}

/* Typing Indicator */
.brai-typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
}

.brai-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brai-primary);
  animation: brai-dot-bounce 1.4s infinite ease-in-out both;
}

.brai-dot:nth-child(1) { animation-delay: -0.32s; }
.brai-dot:nth-child(2) { animation-delay: -0.16s; }
.brai-dot:nth-child(3) { animation-delay: 0s; }

/* Quick Suggestion Chips */
.brai-chips-wrap {
  padding: 8px 16px 12px;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  white-space: nowrap;
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

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

.brai-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--brai-border);
  color: #D4D4D8;
  font-size: 11.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.brai-chip:hover {
  background: rgba(255, 204, 0, 0.12);
  border-color: var(--brai-primary);
  color: var(--brai-primary);
  transform: translateY(-1px);
}

/* Chat Input Bar */
.brai-footer {
  padding: 12px 16px 14px;
  background: rgba(20, 20, 24, 0.98);
  border-top: 1px solid var(--brai-border);
  flex-shrink: 0;
}

.brai-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--brai-surface);
  border: 1px solid var(--brai-border);
  border-radius: 24px;
  padding: 4px 6px 4px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.brai-input-form:focus-within {
  border-color: var(--brai-primary);
  box-shadow: 0 0 12px rgba(255, 204, 0, 0.2);
}

.brai-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--brai-text-main);
  font-size: 13.5px;
  outline: none;
  padding: 6px 0;
}

.brai-input::placeholder {
  color: #71717A;
}

.brai-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brai-primary);
  border: none;
  color: #000000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s ease;
  flex-shrink: 0;
}

.brai-send-btn:hover {
  transform: scale(1.08);
  background: #FFE066;
}

.brai-send-btn:active {
  transform: scale(0.92);
}

.brai-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* Keyframes */
@keyframes brai-pop-in {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes brai-msg-fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes brai-pulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

@keyframes brai-dot-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

/* Responsive Styles */
@media (max-width: 480px) {
  #brai-root.brai-open .brai-launcher-container {
    display: none;
  }
  .brai-launcher-container {
    bottom: 16px;
    right: 16px;
  }
  .brai-window {
    right: 10px;
    left: 10px;
    bottom: 12px;
    width: auto;
    height: calc(100vh - 24px);
    max-height: 90vh;
    border-radius: 18px;
  }
  .brai-teaser {
    max-width: 250px;
    font-size: 12px;
  }
}
