@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;700&family=DM+Sans:wght@400;500&display=swap');

#lucky-chat-root * { box-sizing: border-box; font-family: 'DM Sans', sans-serif; }

#lucky-chat-root {
  --red: #dc3232;
  --red-dark: #b02020;
  --green: #7ad03a;
  --bg: #1a1e22;
  --bg2: #222830;
  --bg3: #2c333c;
  --text: #f0f0f0;
  --text-muted: #8a9099;
  --border: rgba(255,255,255,0.08);
  --radius: 16px;
  --shadow: 0 24px 80px rgba(0,0,0,0.6), 0 4px 20px rgba(0,0,0,0.4);
}

#lucky-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 60px;
  height: 60px;
  background: var(--red);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(220,50,50,0.5);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 999999;
  padding: 0;
}

#lucky-toggle:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(220,50,50,0.7); }
#lucky-toggle.open { background: var(--bg3); box-shadow: 0 4px 20px rgba(0,0,0,0.4); }

#lucky-toggle .lw-notif {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: var(--green);
  border-radius: 50%;
  border: 2px solid white;
  animation: lw-pulse 2s infinite;
}

@keyframes lw-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(122,208,58,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(122,208,58,0); }
}

#lucky-toggle img.lw-toggle-img {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 50%;
}

#lucky-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 380px;
  height: 560px;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999998;
  border: 1px solid var(--border);
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom right;
}

#lucky-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.lw-header {
  background: var(--red);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.lw-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 60%);
}

.lw-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: white;
  border: 2px solid rgba(255,255,255,0.3);
  overflow: hidden;
  flex-shrink: 0;
}

.lw-avatar img { width: 100%; height: 100%; object-fit: cover; }

.lw-info { flex: 1; }

.lw-name {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: white;
  letter-spacing: 0.5px;
}

.lw-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  margin-top: 1px;
}

.lw-status-dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: lw-pulse 2s infinite;
}

.lw-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.lw-close:hover { background: rgba(255,255,255,0.25); }

.lw-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  box-sizing: border-box;
  width: 100%;
}

.lw-messages::-webkit-scrollbar { width: 4px; }
.lw-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.lw-msg {
  display: flex;
  gap: 8px;
  animation: lw-msgIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes lw-msgIn {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.lw-msg { width: 100%; box-sizing: border-box; }
.lw-msg:first-child { margin-top: 45px; }
.lw-msg.bot { align-items: flex-end; justify-content: flex-start; }
.lw-msg.user { align-items: flex-end; flex-direction: row-reverse; justify-content: flex-start; }

.lw-msg-avatar {
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: transparent;
  overflow: hidden;
  flex-shrink: 0;
}

.lw-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }

.lw-bubble {
  max-width: 68%;
  min-width: 0;
  padding: 13px 18px;
  border-radius: 20px;
  font-size: 17.25px;
  line-height: 1.55;
  color: var(--text);
  word-break: break-word;
  overflow-wrap: anywhere;
  box-sizing: border-box;
}

.lw-msg.bot .lw-bubble {
  background: var(--bg2);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}

.lw-msg.user .lw-bubble {
  background: var(--red);
  color: white;
  border-bottom-right-radius: 4px;
  margin-right: 8px;
}

.lw-typing { display: flex; gap: 8px; align-items: flex-end; }

.lw-typing-bubble {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.lw-typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: lw-typingDot 1.4s infinite ease-in-out;
}

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

@keyframes lw-typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.lw-input-area {
  padding: 12px 16px 12px 26px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--bg);
}

.lw-input {
  flex: 1;
  background: var(--bg3);
  border: 1.5px solid transparent;
  border-radius: 22px;
  padding: 18px 18px 18px 20px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  resize: none;
  outline: none;
  min-height: 56px;
  max-height: 120px;
  line-height: 1.5;
  overflow-y: hidden;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}

.lw-input:focus {
  border-color: var(--red);
  background: var(--bg2);
  box-shadow: 0 0 0 3px rgba(220,50,50,0.15);
}

.lw-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.lw-send {
  width: 40px;
  height: 40px;
  background: var(--red);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.lw-send:hover { background: var(--red-dark); transform: scale(1.05); }
.lw-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.lw-powered {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 6px;
}

.lw-powered a { color: var(--red); text-decoration: none; }

@media (max-width: 480px) {
  #lucky-window { width: calc(100vw - 20px); right: 10px; bottom: 90px; height: 70vh; }
}
