/* ==========================================================================
   CUAC AI Assistant - Chatbot Widget Styles (Glassmorphism & Responsive)
   ========================================================================== */

:root {
  --bot-primary: #102a45;
  --bot-secondary: #0d1b2a;
  --bot-accent: #c8a45a;
  --bot-accent-hover: #dfba6d;
  --bot-bg-glass: rgba(13, 27, 42, 0.92);
  --bot-msg-user: linear-gradient(135deg, #1e3d59 0%, #173047 100%);
  --bot-msg-bot: rgba(255, 255, 255, 0.06);
  --bot-border: rgba(200, 164, 90, 0.25);
  --bot-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

/* Floating Launcher Button */
.cuac-bot-launcher {
  position: fixed;
  bottom: 25px;
  left: 25px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #173047 0%, #0d1b2a 100%);
  border: 2px solid var(--bot-accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 15px rgba(200, 164, 90, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1050;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  user-select: none;
  outline: none;
}

.cuac-bot-launcher:hover {
  transform: scale(1.08) translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 25px rgba(200, 164, 90, 0.5);
  border-color: var(--bot-accent-hover);
}

.cuac-bot-launcher .bot-icon-main {
  font-size: 1.65rem;
  color: var(--bot-accent);
  transition: transform 0.3s ease;
}

.cuac-bot-launcher .bot-icon-close {
  font-size: 1.5rem;
  color: #ffffff;
  display: none;
}

.cuac-bot-launcher.open .bot-icon-main {
  display: none;
}

.cuac-bot-launcher.open .bot-icon-close {
  display: block;
}

/* Online Pulse Ring */
.cuac-bot-launcher::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #10b981;
  border: 2px solid #0d1b2a;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
}

/* Tooltip Badge */
.cuac-bot-tooltip {
  position: absolute;
  right: 75px;
  background: rgba(13, 27, 42, 0.95);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--bot-border);
  box-shadow: var(--bot-shadow);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(10px);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.cuac-bot-launcher:hover .cuac-bot-tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* Chatbot Modal Window */
.cuac-chat-window {
  position: fixed;
  bottom: 100px;
  left: 25px;
  width: 395px;
  height: 600px;
  max-height: calc(100vh - 125px);
  background: var(--bot-bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--bot-border);
  border-radius: 20px;
  box-shadow: var(--bot-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.9) translateY(20px);
  transform-origin: bottom left;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
}

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

/* Chat Header */
.cuac-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(23, 48, 71, 0.95) 0%, rgba(13, 27, 42, 0.95) 100%);
  border-bottom: 1px solid var(--bot-border);
}

.cuac-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cuac-chat-avatar {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(200, 164, 90, 0.15);
  border: 1.5px solid var(--bot-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bot-accent);
  font-size: 1.25rem;
}

.cuac-chat-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.cuac-chat-title-group h4 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: #ffffff;
}

.cuac-chat-title-group span {
  font-size: 0.75rem;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 5px;
}

.cuac-chat-title-group span::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px #10b981;
}

.cuac-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cuac-chat-btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
}

.cuac-chat-btn-icon:hover {
  background: rgba(200, 164, 90, 0.2);
  color: var(--bot-accent);
}

/* Quick Action Chips Bar */
.cuac-chat-chips-bar {
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  user-select: none;
}

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

.cuac-chip {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(200, 164, 90, 0.3);
  color: #f1f5f9;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cuac-chip:hover {
  background: rgba(200, 164, 90, 0.25);
  border-color: var(--bot-accent);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Chat Messages Container */
.cuac-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

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

.cuac-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(200, 164, 90, 0.25);
  border-radius: 4px;
}

/* Message Item */
.cuac-msg {
  display: flex;
  gap: 10px;
  max-width: 86%;
  animation: cuacMsgFade 0.3s ease forwards;
}

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

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

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

.cuac-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(200, 164, 90, 0.15);
  border: 1px solid var(--bot-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bot-accent);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.cuac-msg-bubble {
  padding: 12px 15px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #f8fafc;
  word-break: break-word;
}

.cuac-msg.user .cuac-msg-bubble {
  background: var(--bot-msg-user);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top-left-radius: 4px;
}

.cuac-msg.bot .cuac-msg-bubble {
  background: var(--bot-msg-bot);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top-right-radius: 4px;
}

/* Tracking Code Card inside bubble */
.cuac-tracking-card {
  margin-top: 10px;
  background: rgba(200, 164, 90, 0.12);
  border: 1px dashed var(--bot-accent);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

.cuac-tracking-code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--bot-accent);
  letter-spacing: 1.5px;
  margin: 6px 0;
  display: block;
}

.cuac-btn-copy {
  background: rgba(200, 164, 90, 0.25);
  border: 1px solid var(--bot-accent);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cuac-btn-copy:hover {
  background: var(--bot-accent);
  color: #000000;
}

/* Status Badge */
.cuac-status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.8rem;
  margin-top: 6px;
}
.cuac-status-review {
  background: rgba(234, 179, 8, 0.2);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.4);
}
.cuac-status-verified {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

/* Typing Indicator */
.cuac-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 18px;
}

.cuac-typing-dot {
  width: 7px;
  height: 7px;
  background: var(--bot-accent);
  border-radius: 50%;
  opacity: 0.4;
  animation: cuacTypingAnim 1.3s infinite ease-in-out;
}

.cuac-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.cuac-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes cuacTypingAnim {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-5px); opacity: 1; }
}

/* File Attachment Preview Bar */
.cuac-attach-preview-bar {
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: none;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #cbd5e1;
}

.cuac-attach-preview-bar.active {
  display: flex;
}

.cuac-attach-item {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 85%;
}

.cuac-attach-item i {
  color: var(--bot-accent);
}

.cuac-attach-remove {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 6px;
}

/* Chat Input Bar */
.cuac-chat-input-bar {
  padding: 12px 14px;
  background: rgba(13, 27, 42, 0.98);
  border-top: 1px solid var(--bot-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cuac-chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 14px;
  color: #ffffff;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s ease;
  resize: none;
  max-height: 80px;
}

.cuac-chat-input:focus {
  border-color: var(--bot-accent);
  background: rgba(255, 255, 255, 0.09);
}

.cuac-chat-input::placeholder {
  color: #94a3b8;
}

.cuac-chat-btn-action {
  background: linear-gradient(135deg, var(--bot-accent) 0%, #b38e42 100%);
  border: none;
  color: #0d1b2a;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
  flex-shrink: 0;
  font-weight: 700;
}

.cuac-chat-btn-action:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(200, 164, 90, 0.4);
}

.cuac-chat-btn-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cuac-chat-btn-attach {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
  flex-shrink: 0;
}

.cuac-chat-btn-attach:hover {
  background: rgba(200, 164, 90, 0.2);
  color: var(--bot-accent);
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .cuac-bot-launcher {
    bottom: 80px; /* Leave space for bottom nav bar */
    left: 18px;
    width: 54px;
    height: 54px;
  }
  .cuac-bot-launcher .bot-icon-main {
    font-size: 1.45rem;
  }
  .cuac-chat-window {
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }
}
