/**
 * 🎨 VORANIX AI Chatbot v2 - Styling
 * Premium Dark Theme - Matches VORANIX Website
 */

#voranix-chatbot-container {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================ */
/* MAIN WIDGET STYLING */
/* ============================================ */

.voranix-chat-widget {
  --primary: #cc0000;
  --secondary: #00d9ff;
  --dark: #0a0a0a;
  --darker-bg: #050505;
  --light: #f5f5f5;
  --success: #4caf50;
  --warning: #ff9800;
  --error: #ff1a1a;
  --accent-red: #ff4444;
  
  position: fixed;
  bottom: 20px;
  right: 20px;
  font-family: inherit;
  z-index: 99999;
  user-select: none;
}

/* ============================================ */
/* TOGGLE BUTTON */
/* ============================================ */

.voranix-chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #880000 100%);
  border: 1px solid rgba(204, 0, 0, 0.4);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(204, 0, 0, 0.35);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.voranix-chat-toggle:hover {
  transform: scale(1.12);
  box-shadow: 0 10px 36px rgba(204, 0, 0, 0.5);
  border-color: var(--primary);
}

.voranix-chat-toggle:active {
  transform: scale(0.95);
}

.voranix-chat-toggle.active {
  background: linear-gradient(135deg, #00d9ff 0%, #0099cc 100%);
  border-color: var(--secondary);
}

.voranix-chat-toggle svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.5;
}

.unread-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--warning);
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ============================================ */
/* CHAT WINDOW */
/* ============================================ */

.voranix-chat-window {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 480px;
  max-width: 100vw;
  height: 640px;
  max-height: 86vh;
  background: linear-gradient(135deg, #050505 0%, #1a1a1a 100%);
  border: 1px solid rgba(204, 0, 0, 0.2);
  border-radius: 14px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.9),
    0 0 40px rgba(204, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(10px);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .voranix-chat-window {
    width: calc(100vw - 20px);
    height: calc(100vh - 120px);
    bottom: 70px;
    right: 10px;
    left: 10px;
  }
}

/* ============================================ */
/* CHAT HEADER */
/* ============================================ */

.voranix-chat-header {
  padding: 18px;
  background: linear-gradient(135deg, #cc0000 0%, #880000 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow: 0 4px 12px rgba(204, 0, 0, 0.3);
}

.voranix-chat-header-info h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.voranix-chat-header-info p {
  margin: 4px 0 0;
  font-size: 12px;
  opacity: 0.9;
}

.voranix-chat-header-actions {
  display: flex;
  gap: 8px;
}

.chat-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chat-action-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* ============================================ */
/* MESSAGES CONTAINER */
/* ============================================ */

.voranix-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #0a0a0a;
  background-image: 
    linear-gradient(180deg, rgba(204, 0, 0, 0.03) 0%, transparent 20%);
}

.voranix-chat-messages::-webkit-scrollbar {
  width: 8px;
}

.voranix-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.voranix-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(204, 0, 0, 0.25);
  border-radius: 4px;
}

.voranix-chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(204, 0, 0, 0.4);
}

/* ============================================ */
/* MESSAGES */
/* ============================================ */

.voranix-message {
  display: flex;
  gap: 10px;
  animation: fadeIn 0.3s ease;
  align-items: flex-end;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.voranix-message-user {
  justify-content: flex-end;
}

.voranix-message-assistant {
  justify-content: flex-start;
}

.voranix-message-error {
  justify-content: flex-start;
}

.message-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(204, 0, 0, 0.15);
  border: 1px solid rgba(204, 0, 0, 0.3);
}

.voranix-message-user .message-avatar {
  background: rgba(0, 188, 212, 0.1);
  order: 2;
}

.message-content {
  max-width: 78%;
  padding: 14px 18px;
  border-radius: 14px;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.voranix-message-user .message-content {
  background: linear-gradient(135deg, #cc0000, #880000);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.voranix-message-assistant .message-content {
  background: rgba(255, 255, 255, 0.1);
  color: #d4d4d4;
  border: 1px solid rgba(204, 0, 0, 0.2);
  border-bottom-left-radius: 4px;
}

.voranix-message-error .message-content {
  background: rgba(255, 26, 26, 0.15);
  color: #ff6b6b;
  border-left: 4px solid #ff1a1a;
}

.message-content a {
  color: var(--secondary);
  text-decoration: none;
  font-weight: 500;
}

.message-content strong {
  color: var(--secondary);
}

/* ============================================ */
/* INPUT AREA */
/* ============================================ */

.voranix-chat-input-area {
  background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%);
  border-top: 1px solid rgba(204, 0, 0, 0.15);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.voranix-chat-suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.suggestion-btn {
  padding: 10px 14px;
  background: rgba(204, 0, 0, 0.12);
  border: 1px solid rgba(204, 0, 0, 0.28);
  color: #ff6b6b;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(204, 0, 0, 0.1);
}

.suggestion-btn:hover {
  background: rgba(204, 0, 0, 0.25);
  border-color: #cc0000;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(204, 0, 0, 0.25);
}

/* ============================================ */
/* CHAT FORM */
/* ============================================ */

.voranix-chat-form {
  display: flex;
  gap: 8px;
}

.voranix-chat-form input {
  flex: 1;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(204, 0, 0, 0.2);
  border-radius: 10px;
  color: white;
  font-size: 14px;
  transition: all 0.25s;
}

.voranix-chat-form input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.15);
  border-color: #cc0000;
  box-shadow: 0 0 12px rgba(204, 0, 0, 0.25);
}

.voranix-chat-form input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.voranix-send-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  background: linear-gradient(135deg, #cc0000, #880000);
  border: none;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
  font-weight: 600;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(204, 0, 0, 0.3);
}

.voranix-send-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(204, 0, 0, 0.45);
}

.voranix-send-btn:active:not(:disabled) {
  transform: translateY(-1px);
}

.voranix-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================ */
/* APPLICATION MODAL */
/* ============================================ */
.voranix-application-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  z-index: 100000;
  padding: 24px;
}

.voranix-application-modal.open {
  display: flex;
}

.application-modal-content {
  width: 680px;
  max-width: 100%;
  background: #0a0a0a;
  border: 1px solid rgba(204, 0, 0, 0.15);
  border-radius: 12px;
  padding: 20px;
  color: #d4d4d4;
  box-shadow: 0 18px 80px rgba(0, 0, 0, 0.8);
}

.application-modal-content h3 {
  margin: 0 0 8px 0;
}

.application-modal-content label {
  display: block;
  margin: 8px 0 4px;
  font-size: 13px;
  color: #cfcfcf;
}

.application-modal-content input,
.application-modal-content textarea {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 8px;
  color: #fff;
}

.application-modal-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.close-modal {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.06);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.submit-application {
  background: linear-gradient(90deg, #ff1744, #00bcd4);
  border: none;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}

/* ============================================ */
/* FOOTER / QUICK ACTIONS */
/* ============================================ */

.voranix-chat-footer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(65px, 1fr));
  gap: 8px;
  padding: 14px;
  background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%);
  border-top: 1px solid rgba(204, 0, 0, 0.1);
}

@media (max-width: 480px) {
  .voranix-chat-footer {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 350px) and (max-width: 650px) {
  .voranix-chat-footer {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* For wider screens, allow 5 columns (or auto-wrap) */
@media (min-width: 650px) {
  .voranix-chat-footer {
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  }
}

.quick-action {
  padding: 10px 12px;
  background: rgba(204, 0, 0, 0.15);
  border: 1px solid rgba(204, 0, 0, 0.3);
  color: #ff6b6b;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.25s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.quick-action:hover {
  background: rgba(204, 0, 0, 0.28);
  border-color: #cc0000;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(204, 0, 0, 0.2);
}

/* ============================================ */
/* LOADING & ANIMATIONS */
/* ============================================ */

.message-loading {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.loading-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cc0000;
  animation: loading 1.4s infinite;
  box-shadow: 0 0 8px rgba(204, 0, 0, 0.5);
}

.loading-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loading {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-10px); }
}

/* ============================================ */
/* RESPONSIVE ADJUSTMENTS */
/* ============================================ */

@media (max-width: 480px) {
  .voranix-chat-window {
    border-radius: 8px;
  }

  .message-content {
    max-width: 90%;
    font-size: 13px;
    padding: 10px 12px;
  }

  .voranix-chat-header {
    padding: 12px;
  }

  .voranix-chat-header-info h3 {
    font-size: 14px;
  }

  .voranix-chat-footer {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================ */
/* DARK MODE & ACCESSIBILITY */
/* ============================================ */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-color-scheme: light) {
  .voranix-chat-widget {
    --dark: #ffffff;
    --light: #f5f5f5;
  }

  .voranix-chat-window {
    background: #ffffff;
    border-color: rgba(204, 0, 0, 0.2);
  }

  .voranix-chat-input-area {
    background: #f9f9f9;
  }

  .message-content {
    background: rgba(0, 0, 0, 0.08);
    color: #333;
  }

  .voranix-message-assistant .message-content {
    background: rgba(0, 0, 0, 0.08);
    color: #333;
  }
}
