/* Glossa Chat SDK Styles */

/* Import Vazirmatn font */
@import '../assets/vazirmatn.css';

.glossa-chat-container {
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  direction: rtl;
}

.glossa-chat-button-wrapper {
  position: relative;
  display: inline-block;
}

.glossa-chat-button {
  transition: all 0.3s ease;
}

.glossa-chat-button:hover {
  transform: scale(1.05);
}

.glossa-chat-button:active {
  transform: scale(0.95);
}

/* Pulse/Echo animation for chat button */
.glossa-chat-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.glossa-chat-pulse-1 {
  animation: pulseEcho 4s ease-out infinite;
}

.glossa-chat-pulse-2 {
  animation: pulseEcho 4s ease-out infinite 2s;
}

@keyframes pulseEcho {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.8;
  }
  50% {
    opacity: 0.4;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.4);
    opacity: 0;
  }
}

.glossa-chat-panel {
  animation: slideUp 0.3s ease-out;
}

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

.glossa-chat-header {
  border-radius: 12px 12px 0 0;
}

.glossa-messages-area {
  scrollbar-width: thin;
  scrollbar-color: #d1d5db #f3f4f6;
}

.glossa-messages-area::-webkit-scrollbar {
  width: 6px;
}

.glossa-messages-area::-webkit-scrollbar-track {
  background: #f3f4f6;
}

.glossa-messages-area::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.glossa-messages-area::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.glossa-message {
  animation: messageSlide 0.3s ease-out;
}

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

.glossa-message-input {
  transition: border-color 0.2s ease;
}

.glossa-message-input:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.glossa-send-button {
  transition: all 0.2s ease;
}

.glossa-send-button:hover {
  transform: scale(1.05);
}

.glossa-send-button:active {
  transform: scale(0.95);
}

.glossa-send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive design */
/* Mobile phones (up to 480px) */
@media (max-width: 480px) {
  .glossa-chat-panel {
    width: calc(100vw - 20px) !important;
    height: calc(100vh - 100px) !important;
    max-height: calc(100vh - 100px) !important;
    right: 10px !important;
    left: 10px !important;
    top: 10px !important;
    bottom: auto !important;
    border-radius: 12px !important;
  }
  
  .glossa-chat-container {
    right: 10px !important;
    left: 10px !important;
  }
  
  .glossa-chat-button-wrapper {
    width: 56px !important;
    height: 56px !important;
  }
  
  .glossa-chat-button {
    width: 56px !important;
    height: 56px !important;
  }
  
  .glossa-chat-pulse {
    width: 56px !important;
    height: 56px !important;
  }
}

/* Small tablets (481px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  .glossa-chat-panel:not(.glossa-chat-panel-custom-size) {
    width: min(450px, calc(100vw - 40px)) !important;
    height: min(700px, calc(100vh - 120px)) !important;
    max-height: calc(100vh - 120px) !important;
  }
  
  .glossa-chat-button-wrapper {
    width: 60px !important;
    height: 60px !important;
  }
  
  .glossa-chat-button {
    width: 60px !important;
    height: 60px !important;
  }
  
  .glossa-chat-pulse {
    width: 60px !important;
    height: 60px !important;
  }
}

/* Large tablets and small desktops (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .glossa-chat-panel:not(.glossa-chat-panel-custom-size) {
    width: min(480px, calc(100vw - 40px)) !important;
    height: min(750px, calc(100vh - 120px)) !important;
    max-height: calc(100vh - 120px) !important;
  }
}

/* Large desktops (1025px and up) */
@media (min-width: 1025px) {
  .glossa-chat-panel:not(.glossa-chat-panel-custom-size) {
    width: 500px !important;
    height: min(800px, calc(100vh - 120px)) !important;
    max-height: calc(100vh - 120px) !important;
  }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 600px) {
  .glossa-chat-panel:not(.glossa-chat-panel-custom-size) {
    height: calc(100vh - 80px) !important;
    max-height: calc(100vh - 80px) !important;
  }
}

/* Force light theme for widget to match brand visuals (disable OS dark override) */
.glossa-chat-container {
  color-scheme: light;
}

/* Loading animation */
.glossa-loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Typing indicator */
.glossa-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
}

.glossa-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #6b7280;
  animation: typing 1.4s infinite ease-in-out;
}

.glossa-typing-dot:nth-child(1) {
  animation-delay: 0s;
}

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

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

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

/* Load more button spinner animation */
.glossa-spin {
  animation: spin 1s linear infinite;
}

/* Load more button styles */
.glossa-load-more-button {
  transition: all 0.2s ease;
}

.glossa-load-more-button:hover {
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%) !important;
}

.glossa-load-more-button:disabled {
  opacity: 0.7;
  cursor: wait;
}
