/* GIMS Voice Assistant Chatbot Stylesheet */

/* Root Variables matching GIMS theme */
:root {
  --gims-primary: #0c2a4a;
  --gims-secondary: #ffb703;
  --gims-bg-light: #f4f7f6;
  --gims-text-dark: #333333;
  --gims-text-light: #ffffff;
  --gims-border: #e2e8f0;
  --chat-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
  --chat-glass-bg: rgba(255, 255, 255, 0.95);
  --chat-glass-border: rgba(255, 255, 255, 0.4);
}

/* Floating Action Button (FAB) */
#gims-chat-fab {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gims-primary) 0%, #1e4d7c 100%);
  color: var(--gims-text-light);
  border: none;
  box-shadow: 0 4px 15px rgba(12, 42, 74, 0.4);
  cursor: pointer;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#gims-chat-fab:hover {
  transform: scale(1.08) translateY(-3px);
  box-shadow: 0 6px 20px rgba(12, 42, 74, 0.5);
}

#gims-chat-fab i {
  font-size: 24px;
}

/* Pulse animation for FAB */
#gims-chat-fab::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--gims-primary);
  opacity: 0.8;
  animation: fabPulse 2s infinite ease-out;
  pointer-events: none;
}

@keyframes fabPulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* Chat Widget Container */
#gims-chat-container {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 380px;
  height: 600px;
  max-height: calc(100vh - 120px);
  border-radius: 16px;
  background: var(--chat-glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--chat-glass-border);
  box-shadow: var(--chat-shadow);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

#gims-chat-container.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Responsive adjustment for Mobile */
@media (max-width: 480px) {
  #gims-chat-container {
    width: calc(100% - 40px);
    right: 20px;
    bottom: 90px;
    height: 80vh;
  }
  #gims-chat-fab {
    right: 20px;
    bottom: 20px;
  }
}

/* Chat Header */
.gims-chat-header {
  background: linear-gradient(135deg, var(--gims-primary) 0%, #1e4d7c 100%);
  color: var(--gims-text-light);
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.gims-chat-header img {
  width: 35px;
  height: 35px;
  object-fit: contain;
  background: white;
  border-radius: 50%;
  padding: 2px;
}

.gims-chat-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--gims-text-light);
  font-family: 'Open Sans', sans-serif;
}

.gims-chat-header p {
  margin: 0;
  font-size: 11px;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 5px;
}

.gims-chat-header .status-dot {
  width: 8px;
  height: 8px;
  background-color: #2ec4b6;
  border-radius: 50%;
  display: inline-block;
  animation: dotPulse 1.5s infinite;
}

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

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

.gims-chat-header .header-btn {
  background: transparent;
  border: none;
  color: var(--gims-text-light);
  cursor: pointer;
  font-size: 16px;
  opacity: 0.8;
  transition: opacity 0.2s;
  padding: 4px;
}

.gims-chat-header .header-btn:hover {
  opacity: 1;
}

/* Chat Messages Box */
.gims-chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background-color: rgba(244, 247, 246, 0.5);
  scroll-behavior: smooth;
}

/* Message Bubbles */
.gims-chat-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  animation: msgFadeIn 0.3s ease-out forwards;
}

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

.gims-chat-msg.bot {
  background-color: var(--gims-text-light);
  color: var(--gims-text-dark);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  border: 1px solid var(--gims-border);
}

.gims-chat-msg.user {
  background: linear-gradient(135deg, var(--gims-primary) 0%, #1e4d7c 100%);
  color: var(--gims-text-light);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 5px rgba(12, 42, 74, 0.15);
}

/* Suggestion Chips */
.gims-chat-suggestions {
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  overflow-x: auto;
  background-color: white;
  border-top: 1px solid var(--gims-border);
  scrollbar-width: none; /* Firefox */
}

.gims-chat-suggestions::-webkit-scrollbar {
  display: none; /* Safari & Chrome */
}

.gims-chat-chip {
  padding: 6px 12px;
  border-radius: 20px;
  background-color: #f0f4f8;
  color: var(--gims-primary);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid #d0deec;
  transition: all 0.2s;
  font-weight: 500;
}

.gims-chat-chip:hover {
  background-color: var(--gims-primary);
  color: white;
  border-color: var(--gims-primary);
}

/* Audio wave container */
.gims-chat-voice-wave {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 25px;
  padding: 0 10px;
  background-color: #fff3cd;
  border-radius: 12px;
  margin: 5px 20px;
  border: 1px solid #ffeeba;
}

.gims-chat-voice-wave.active {
  display: flex;
}

.wave-bar {
  width: 3px;
  height: 10px;
  background-color: #ffc107;
  border-radius: 2px;
  animation: wavePulse 1.2s infinite ease-in-out;
}

.wave-bar:nth-child(2) { animation-delay: 0.2s; height: 15px; }
.wave-bar:nth-child(3) { animation-delay: 0.4s; height: 8px; }
.wave-bar:nth-child(4) { animation-delay: 0.6s; height: 18px; }
.wave-bar:nth-child(5) { animation-delay: 0.8s; height: 12px; }

@keyframes wavePulse {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(2); }
}

/* Chat Input Panel */
.gims-chat-input-panel {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  background-color: white;
  border-top: 1px solid var(--gims-border);
  gap: 8px;
}

.gims-chat-input-panel input {
  flex: 1;
  border: 1px solid var(--gims-border);
  border-radius: 24px;
  padding: 10px 18px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.gims-chat-input-panel input:focus {
  border-color: var(--gims-primary);
}

.gims-chat-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 16px;
}

.gims-chat-btn-voice {
  background-color: #f0f4f8;
  color: var(--gims-primary);
}

.gims-chat-btn-voice.recording {
  background-color: #dc3545;
  color: white;
  animation: recBlink 1.5s infinite;
}

@keyframes recBlink {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(220, 53, 69, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

.gims-chat-btn-send {
  background-color: var(--gims-primary);
  color: white;
}

.gims-chat-btn-send:hover {
  background-color: #1e4d7c;
}

/* Settings Modal Panel overlay */
.gims-chat-settings-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(12, 42, 74, 0.95);
  color: white;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 30px;
  transform: translateY(-100%);
  transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  box-sizing: border-box;
}

.gims-chat-settings-panel.active {
  transform: translateY(0);
}

.gims-chat-settings-panel h5 {
  margin-top: 0;
  color: var(--gims-secondary);
  font-size: 18px;
  margin-bottom: 10px;
}

.gims-chat-settings-panel p {
  font-size: 13px;
  opacity: 0.9;
  line-height: 1.5;
}

.gims-chat-settings-panel input {
  width: 100%;
  padding: 10px 15px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  margin: 15px 0;
  font-size: 13px;
  box-sizing: border-box;
}

.gims-chat-settings-panel button {
  padding: 10px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.gims-chat-settings-panel .save-btn {
  background-color: var(--gims-secondary);
  color: var(--gims-primary);
  margin-bottom: 10px;
}

.gims-chat-settings-panel .close-settings-btn {
  background-color: transparent;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Custom Scrollbar for messages */
.gims-chat-messages::-webkit-scrollbar {
  width: 6px;
}

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

.gims-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(12, 42, 74, 0.2);
  border-radius: 3px;
}

.gims-chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(12, 42, 74, 0.4);
}
