/* ═══════════════════════════════════════════════════════════════════
   SINGPAY COPILOT - AI Assistant Widget Styles
   Premium glassmorphism design with smooth animations
   ═══════════════════════════════════════════════════════════════════ */

/* ─── CSS Variables ──────────────────────────────────────────────── */
:root {
  --copilot-primary: #930151;
  --copilot-primary-light: #b8026a;
  --copilot-primary-dark: #6e013d;
  --copilot-gradient: linear-gradient(135deg, #930151 0%, #930151 100%);
  --copilot-gradient-warm: linear-gradient(135deg, #930151 0%, #b8026a 100%);
  --copilot-bg: #ffffff;
  --copilot-surface: #f8f9fc;
  --copilot-text: #1e293b;
  --copilot-text-secondary: #64748b;
  --copilot-border: rgba(0, 0, 0, 0.06);
  --copilot-shadow: 0 25px 60px rgba(0, 0, 0, 0.15), 0 8px 20px rgba(0, 0, 0, 0.1);
  --copilot-fab-shadow: 0 8px 30px rgba(147, 1, 81, 0.4);
  --copilot-radius: 0px;
  --copilot-width: 400px;
  --copilot-height: 600px;
}

/* ─── Floating Action Button ─────────────────────────────────────── */
#copilot-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 60px;
  height: 60px;
  border-radius: 0;
  background: var(--copilot-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999998;
  box-shadow: var(--copilot-fab-shadow);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

#copilot-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(147, 1, 81, 0.5);
}

#copilot-fab:active {
  transform: scale(0.95);
}

.copilot-fab-active {
  transform: rotate(90deg) !important;
  background: linear-gradient(135deg, #6e013d 0%, #930151 100%) !important;
  box-shadow: 0 8px 30px rgba(147, 1, 81, 0.4) !important;
}

.copilot-fab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

/* Pulse animation */
.copilot-fab-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: var(--copilot-gradient);
  animation: copilotPulse 2.5s ease-in-out infinite;
  opacity: 0;
}

@keyframes copilotPulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

.copilot-fab-active .copilot-fab-pulse {
  animation: none;
  opacity: 0;
}

/* Badge */
.copilot-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  background: #ef4444;
  color: white;
  border-radius: 0;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  animation: copilotBadgeBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes copilotBadgeBounce {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

/* ─── Chat Panel ─────────────────────────────────────────────────── */
#copilot-panel {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: var(--copilot-width);
  height: var(--copilot-height);
  max-height: calc(100vh - 140px);
  max-width: calc(100vw - 40px);
  background: var(--copilot-bg);
  border-radius: var(--copilot-radius);
  box-shadow: var(--copilot-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999999;
  border: 1px solid var(--copilot-border);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.copilot-panel-hidden {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
}

.copilot-panel-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ─── Header ─────────────────────────────────────────────────────── */
.copilot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: var(--copilot-gradient);
  color: white;
  flex-shrink: 0;
}

.copilot-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.copilot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.copilot-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.copilot-header-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.copilot-header-status {
  font-size: 11px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 5px;
}

.copilot-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 0;
  background: #4ade80;
  display: inline-block;
  animation: copilotDotPulse 2s ease-in-out infinite;
}

@keyframes copilotDotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.copilot-header-actions {
  display: flex;
  gap: 4px;
}

.copilot-btn-icon {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 34px;
  height: 34px;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.copilot-btn-icon:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

/* ─── Messages Area ──────────────────────────────────────────────── */
.copilot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--copilot-surface);
  scroll-behavior: smooth;
}

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

.copilot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.copilot-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 0;
}

/* ─── Welcome Screen ─────────────────────────────────────────────── */
.copilot-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 10px;
  gap: 12px;
}

.copilot-welcome-icon {
  width: 72px;
  height: 72px;
  border-radius: 0;
  background: var(--copilot-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  box-shadow: 0 8px 24px rgba(147, 1, 81, 0.3);
}

.copilot-welcome h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--copilot-text);
  margin: 0;
}

.copilot-welcome p {
  font-size: 13px;
  color: var(--copilot-text-secondary);
  line-height: 1.5;
  margin: 0;
  max-width: 300px;
}

.copilot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.copilot-suggestion {
  background: white;
  border: 1px solid var(--copilot-border);
  border-radius: 0;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--copilot-text);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: "Roboto", sans-serif;
}

.copilot-suggestion:hover {
  background: var(--copilot-primary);
  color: white;
  border-color: var(--copilot-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(147, 1, 81, 0.25);
}

/* ─── Message Bubbles ────────────────────────────────────────────── */
.copilot-message {
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  max-width: 100%;
}

.copilot-message-appear {
  opacity: 1;
  transform: translateY(0);
}

.copilot-message-user {
  justify-content: flex-end;
}

.copilot-message-assistant {
  justify-content: flex-start;
}

.copilot-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 0;
  background: var(--copilot-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.copilot-msg-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 80%;
  min-width: 0;
}

.copilot-msg-bubble {
  padding: 10px 14px;
  border-radius: 0;
  font-size: 13px;
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.copilot-message-user .copilot-msg-bubble {
  background: var(--copilot-gradient);
  color: white;
  border-bottom-right-radius: 0;
}

.copilot-message-assistant .copilot-msg-bubble {
  background: white;
  color: var(--copilot-text);
  border: 1px solid var(--copilot-border);
  border-bottom-left-radius: 0;
}

.copilot-msg-time {
  font-size: 10px;
  color: var(--copilot-text-secondary);
  opacity: 0.7;
  padding: 0 4px;
}

.copilot-message-user .copilot-msg-time {
  text-align: right;
}

/* Code blocks */
.copilot-code-block {
  background: #1e293b;
  color: #e2e8f0;
  padding: 12px 14px;
  border-radius: 0;
  font-family: "Courier New", monospace;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  margin: 8px 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.copilot-inline-code {
  background: rgba(147, 1, 81, 0.1);
  color: var(--copilot-primary);
  padding: 2px 6px;
  border-radius: 0;
  font-family: "Courier New", monospace;
  font-size: 12px;
}

.copilot-message-assistant .copilot-msg-bubble a {
  color: var(--copilot-primary);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}

.copilot-message-assistant .copilot-msg-bubble a:hover {
  color: var(--copilot-primary-dark);
  text-decoration-style: solid;
}

/* ─── Input Area ─────────────────────────────────────────────────── */
.copilot-input-area {
  padding: 12px 16px 16px;
  background: var(--copilot-bg);
  border-top: 1px solid var(--copilot-border);
  flex-shrink: 0;
}

.copilot-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--copilot-surface);
  border: 1px solid var(--copilot-border);
  border-radius: 0;
  padding: 4px 4px 4px 16px;
  transition: all 0.2s ease;
}

.copilot-form:focus-within {
  border-color: var(--copilot-primary);
  box-shadow: 0 0 0 3px rgba(147, 1, 81, 0.1);
}

.copilot-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--copilot-text);
  outline: none;
  font-family: "Roboto", sans-serif;
  padding: 8px 0;
}

.copilot-input::placeholder {
  color: var(--copilot-text-secondary);
  opacity: 0.6;
}

.copilot-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 0;
  background: var(--copilot-gradient);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
}

.copilot-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(147, 1, 81, 0.35);
}

.copilot-send-btn:active {
  transform: scale(0.95);
}

/* ─── Typing Indicator ───────────────────────────────────────────── */
.copilot-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 8px;
}

.copilot-typing-dots {
  display: flex;
  gap: 4px;
}

.copilot-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 0;
  background: var(--copilot-primary);
  animation: copilotTypingBounce 1.4s ease-in-out infinite;
}

.copilot-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.copilot-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

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

.copilot-typing-text {
  font-size: 11px;
  color: var(--copilot-text-secondary);
  font-style: italic;
}

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #copilot-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    max-width: 100vw;
    border-radius: 0;
  }

  #copilot-fab {
    bottom: 20px;
    right: 20px;
    width: 54px;
    height: 54px;
  }
}
