:root {
  --casino-primary: #0b3c5d;
  --casino-primary-light: #0e4d77;
  --casino-primary-dark: #082c45;
  --casino-accent: #1a8fc4;
  --casino-gold: #c9a84c;
  --bg-chat: #f2f4f7;
  --bg-bot: #ffffff;
  --bg-user: var(--casino-primary);
  --text-dark: #1a1d26;
  --text-mid: #5a6070;
  --text-light: #8b90a0;
  --border: #e2e5ec;
  --shadow-sm: 0 2px 8px rgba(11, 60, 93, 0.08);
  --shadow-md: 0 8px 32px rgba(11, 60, 93, 0.18);
  --shadow-lg: 0 16px 48px rgba(11, 60, 93, 0.25);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
}
/* ==================== CHAT ICON ==================== */
#chatbot-icon {
  position: fixed;
  bottom: 120px;
  right: 24px;
  width: 64px;
  height: 64px;
  background: linear-gradient(
    135deg,
    var(--casino-primary) 0%,
    var(--casino-primary-dark) 100%
  );
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  transition:
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.25s ease;
  border: none;
  outline: none;
}
#chatbot-icon:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(11, 60, 93, 0.35);
}
#chatbot-icon:active {
  transform: scale(0.96);
}

#chatbot-icon .icon-chat,
#chatbot-icon .icon-close {
  position: absolute;
  transition:
    opacity 0.25s ease,
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#chatbot-icon .icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}
#chatbot-icon.open .icon-chat {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}
#chatbot-icon.open .icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Pulse animation on load */
#chatbot-icon::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--casino-primary);
  opacity: 0;
  animation: iconPulse 3s ease-in-out infinite;
  z-index: -1;
}

@keyframes iconPulse {
  0%,
  100% {
    opacity: 0;
    transform: scale(1);
  }
  50% {
    opacity: 0.15;
    transform: scale(1.3);
  }
}

/* ==================== CHAT WINDOW ==================== */
#chatbot-container {
  position: fixed;
  bottom: 196px;
  right: 24px;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 140px);
  max-width: calc(100vw - 32px);
  background: var(--bg-chat);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#chatbot-container.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ---- Header ---- */
#chatbot-header {
  background: linear-gradient(
    135deg,
    var(--casino-primary) 0%,
    var(--casino-primary-dark) 100%
  );
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.header-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.header-info h2 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}
.header-info p {
  font-size: 0.72rem;
  opacity: 0.7;
  font-weight: 400;
}
.header-status {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  animation: statusBlink 2.5s ease-in-out infinite;
}
@keyframes statusBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

#chatbot-close {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
#chatbot-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ---- Welcome Screen ---- */
#welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
  gap: 1rem;
}
.welcome-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(
    135deg,
    var(--casino-primary) 0%,
    var(--casino-accent) 100%
  );
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(11, 60, 93, 0.2);
}
#welcome-screen h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
}
#welcome-screen p {
  font-size: 0.85rem;
  color: var(--text-mid);
  line-height: 1.5;
  max-width: 280px;
}
#start-chat-btn {
  background: linear-gradient(
    135deg,
    var(--casino-primary) 0%,
    var(--casino-primary-light) 100%
  );
  color: #fff;
  border: none;
  padding: 12px 32px;
  border-radius: var(--radius-full);
  font-family: "DM Sans", sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(11, 60, 93, 0.25);
  margin-top: 0.5rem;
}
#start-chat-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(11, 60, 93, 0.35);
}
#start-chat-btn:active {
  transform: translateY(0);
}

/* ---- Chat Area ---- */
#chat-area {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
#chat-area.active {
  display: flex;
}

/* ---- Messages ---- */
#chatbot-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}
#chatbot-messages::-webkit-scrollbar {
  width: 5px;
}
#chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}
#chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(11, 60, 93, 0.15);
  border-radius: 10px;
}

.message-row {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: msgIn 0.3s ease-out;
}
.message-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.message-row.bot {
  align-self: flex-start;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.msg-avatar.bot-av {
  background: var(--casino-primary);
}
.msg-avatar.user-av {
  background: var(--casino-gold);
}

.msg-bubble {
  padding: 10px 14px;
  font-size: 0.85rem;
  line-height: 1.55;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.bot .msg-bubble {
  background: var(--bg-bot);
  color: var(--text-dark);
  border-radius: 4px var(--radius-md) var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.user .msg-bubble {
  background: var(--bg-user);
  color: #fff;
  border-radius: var(--radius-md) 4px var(--radius-md) var(--radius-md);
}

/* Links in bot messages */
.bot .msg-bubble a {
  color: var(--casino-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.bot .msg-bubble a:hover {
  color: var(--casino-primary);
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}
.typing-indicator span {
  width: 7px;
  height: 7px;
  background: var(--text-light);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-indicator span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes typingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* Timestamp */
.msg-time {
  font-size: 0.65rem;
  color: var(--text-light);
  margin-top: 4px;
  padding: 0 4px;
}
.user .msg-time {
  text-align: right;
}

/* ---- Input ---- */
#chatbot-input-area {
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
#user-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 10px 16px;
  font-family: "DM Sans", sans-serif;
  font-size: 0.85rem;
  outline: none;
  color: var(--text-dark);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  background: var(--bg-chat);
}
#user-input::placeholder {
  color: var(--text-light);
}
#user-input:focus {
  border-color: var(--casino-accent);
  box-shadow: 0 0 0 3px rgba(26, 143, 196, 0.1);
  background: #fff;
}

#send-btn {
  width: 40px;
  height: 40px;
  background: linear-gradient(
    135deg,
    var(--casino-primary) 0%,
    var(--casino-primary-light) 100%
  );
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    transform 0.15s,
    opacity 0.15s;
}
#send-btn:hover {
  transform: scale(1.05);
}
#send-btn:active {
  transform: scale(0.95);
}
#send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* Powered by */
.powered-by {
  text-align: center;
  padding: 6px;
  font-size: 0.62rem;
  color: var(--text-light);
  background: #fff;
  letter-spacing: 0.03em;
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 420px) {
  #chatbot-container {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  #chatbot-icon {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }
}
