/* chatWidgetstyle.css */
:root {
  --chat-primary: #4f46e5;
  --chat-secondary: #4338ca;
  --chat-bg: #ffffff;
  --chat-text: #333333;
  --chat-light-bg: #f8f9fa;
  --chat-border: #ddd;
  --chat-shadow: rgba(0, 0, 0, 0.15);
  --chat-radius: 16px;
}

body {
  margin: 0;
  font-family: 'Lato', sans-serif;
}

/* ---------- Chat Container ---------- */
.chat-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* ---------- Chat Panel ---------- */
.chat-panel {
  width: min(90vw, 380px);
  height: min(80vh, 500px);
  background: var(--chat-bg);
  border-radius: var(--chat-radius);
  box-shadow: 0 8px 32px var(--chat-shadow);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: scale(0.9) translateY(16px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}

.chat-panel.active {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

/* ---------- Chat Header ---------- */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  border-bottom: 1px solid #ddd;
  background: #4f46e5; /* header color */
  border-radius: 16px 16px 0 0;
  color: white;
}

.chat-title {
  font-weight: bold;
  font-size: 14px;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-auth-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-auth-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.close-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.2s ease;
  margin-left: 8px;
}

.close-btn:hover {
  transform: scale(1.1);
  color: #f0f0f0;
}

/* ---------- Chat Body ---------- */
.chat-body {
  flex: 1;
  padding: 10px 15px;
  overflow-y: auto;
  font-size: 14px;
  color: #444;
  background: #fff;
  border-radius: 0 0 16px 16px;
  scroll-behavior: smooth;
}

.chat-message {
  margin: 8px 0;
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 85%;
  line-height: 1.4;
  font-size: 14px;
  position: relative;
  word-wrap: break-word;
}

.chat-message.blurred {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
}

.sender-name {
  font-weight: bold;
  display: block;
  font-size: 12px;
  margin-bottom: 2px;
}

.user-message {
  background-color: #4f46e5;
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 2px;
}

.other-message {
  background-color: #e5e7eb;
  color: #333;
  margin-right: auto;
  border-bottom-left-radius: 2px;
}

.timestamp-small {
  display: block;
  font-size: 10px;
  text-align: right;
  margin-top: 4px;
  opacity: 0.7;
}

.welcome-msg {
  text-align: center;
  color: #888;
  margin-top: 20px;
}

/* ---------- Chat Footer ---------- */
.chat-footer {
  display: flex;
  border-top: 1px solid #ddd;
  padding: 10px;
  gap: 8px;
  flex-shrink: 0;
  background: #fafafa;
  border-radius: 0 0 16px 16px;
}

.chat-footer input {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #ccc;
  outline: none;
  transition: all 0.2s ease;
}

.chat-footer input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

.chat-footer button {
  background: #4f46e5;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s ease;
}

.chat-footer button:hover {
  background: #4338ca;
}

/* ---------- Chat Toggle Button ---------- */
.chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #4f46e5;
  color: white;
  border: none;
  border-radius: 30px;
  padding: 12px 20px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  z-index: 9998;
}

.chat-toggle:hover {
  background: #4338ca;
  transform: translateY(-3px);
}

.chat-toggle.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

/* ---------- Popup for events ---------- */
.event-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.popup-content {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  position: relative;
}

.popup-content img {
  max-width: 100%;
  border-radius: 8px;
  margin-bottom: 12px;
}

.popup-content .close-popup {
  position: absolute;
  top: 8px;
  right: 12px;
  cursor: pointer;
  font-size: 20px;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .chat-panel {
    width: 90vw;
    height: 70vh;
  }

  .chat-footer {
    flex-direction: column;
  }

  .chat-footer input {
    width: 100%;
    margin-bottom: 8px;
  }

  .chat-toggle {
    bottom: 16px;
    right: 16px;
    padding: 10px 16px;
  }
}
