/* === DEXORA DIGITAL Chatbot Styles === */

:root {
  --dexora-primary: #375A7F;
  --dexora-secondary: #4a7099;
  --dexora-bg: #ffffff;
  --dexora-font: 'Urbanist', system-ui, -apple-system, sans-serif;
  --shadow-sm: 0 2px 8px rgba(55, 90, 127, 0.1);
  --shadow-md: 0 4px 16px rgba(55, 90, 127, 0.15);
  --shadow-lg: 0 8px 32px rgba(55, 90, 127, 0.2);
}

/* === Launcher Button === */
.dexora-launcher-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99998;
}

#dexora-chat-launcher {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dexora-primary), var(--dexora-secondary));
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: white;
  font-family: var(--dexora-font);
}

#dexora-chat-launcher:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(55, 90, 127, 0.3);
}

#dexora-chat-launcher:active {
  transform: scale(0.95);
}

#dexora-chat-launcher.chat-open {
  background: #333;
}

.launcher-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.launcher-inner svg {
  width: 32px;
  height: 32px;
  stroke-width: 2.5;
}

/* Pulse animation */
.launcher-pulse {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: var(--dexora-primary);
  animation: pulse 2s infinite;
  opacity: 0;
}

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

/* Notification badge */
.launcher-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #00D084;
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid white;
  box-shadow: var(--shadow-md);
  animation: bounce 0.5s ease;
}

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Tooltip */
#dexora-chat-launcher[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 75px;
  right: 0;
  background: #333;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.3s ease;
  font-family: var(--dexora-font);
}

/* === Chat Widget === */
#dexora-chat-widget {
  position: fixed;
  right: 20px;
  bottom: 95px;
  width: 420px;
  max-width: calc(100vw - 40px);
  height: 650px;
  max-height: calc(100vh - 120px);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: none;
  flex-direction: column;
  background: white;
  z-index: 99999;
  border: 1px solid rgba(0,0,0,0.06);
  font-family: var(--dexora-font);
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#dexora-chat-widget.show {
  display: flex;
}

#dexora-chat-widget.minimized {
  height: 60px;
}

#dexora-chat-widget.minimized .chat-body,
#dexora-chat-widget.minimized .chat-input-wrap {
  display: none;
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* === Header === */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--dexora-primary), var(--dexora-secondary));
  color: white;
  flex-shrink: 0;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.chat-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
  background: white;
  padding: 4px;
}

.chat-title-wrap {
  flex: 1;
}

.chat-title {
  font-weight: 700;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.chat-status {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #00D084;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

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

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

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

/* === Chat Body === */
.chat-body {
  flex: 1;
  padding: 20px;
  background: var(--dexora-bg);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--dexora-secondary) transparent;
  scroll-behavior: smooth;
}

.chat-body::-webkit-scrollbar {
  width: 6px;
}

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

.chat-body::-webkit-scrollbar-thumb {
  background: var(--dexora-secondary);
  border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
  background: var(--dexora-primary);
}

/* === Messages === */
.bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 14px;
  margin: 10px 0;
  line-height: 1.5;
  font-size: 15px;
  word-break: break-word;
  animation: fadeIn 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.bubble.user {
  background: linear-gradient(135deg, var(--dexora-primary), var(--dexora-secondary));
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.bubble.bot {
  background: white;
  border: 1px solid rgba(255, 90, 0, 0.15);
  color: #2c2c2c;
  border-bottom-left-radius: 4px;
}

.bubble.bot p {
  margin: 0 0 10px 0;
}

.bubble.bot p:last-child {
  margin-bottom: 0;
}

.bubble.bot ul,
.bubble.bot ol {
  margin: 8px 0 8px 20px;
  padding: 0;
}

.bubble.bot li {
  margin: 6px 0;
}

.bubble.bot a {
  color: var(--dexora-primary);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.bubble.bot a:hover {
  border-bottom-color: var(--dexora-primary);
}

.bubble.bot strong {
  color: var(--dexora-primary);
  font-weight: 700;
}

.bubble.bot code {
  background: rgba(255, 90, 0, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
}

.bubble.bot h2,
.bubble.bot h3,
.bubble.bot h4 {
  color: var(--dexora-primary);
  margin: 12px 0 8px 0;
  font-weight: 700;
}

.contact-info {
  line-height: 1.6;
}

.contact-info a {
  font-weight: 600;
}

/* === Typing Indicator === */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px !important;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--dexora-secondary);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

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

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

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

/* === Quick Actions === */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 8px;
  background: white;
  border-bottom: 1px solid #eee;
}

.quick-btn {
  background: white;
  border: 1.5px solid var(--dexora-secondary);
  color: var(--dexora-primary);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--dexora-font);
  white-space: nowrap;
}

.quick-btn:hover {
  background: linear-gradient(135deg, var(--dexora-primary), var(--dexora-secondary));
  color: white;
  border-color: var(--dexora-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* === Input Area === */
.chat-input-wrap {
  flex-shrink: 0;
  background: white;
  border-top: 1px solid #eee;
}

.chat-input {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  align-items: center;
}

.chat-input input {
  flex: 1;
  border: 2px solid #e5e5e5;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
  font-family: var(--dexora-font);
  background: #fafafa;
}

.chat-input input:focus {
  border-color: var(--dexora-secondary);
  background: white;
  box-shadow: 0 0 0 3px rgba(255, 90, 0, 0.1);
}

.chat-input button {
  background: linear-gradient(135deg, var(--dexora-primary), var(--dexora-secondary));
  color: white;
  border: none;
  border-radius: 12px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-input button:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.chat-input button:active:not(:disabled) {
  transform: scale(0.95);
}

.chat-input button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.powered-by {
  text-align: center;
  padding: 8px 16px 12px;
  font-size: 11px;
  color: #999;
  font-weight: 500;
}

.powered-by strong {
  color: var(--dexora-primary);
  font-weight: 700;
}

/* === Mobile Optimizations === */
@media (max-width: 768px) {
  .dexora-launcher-wrap {
    right: 16px;
    bottom: 16px;
  }
  
  #dexora-chat-launcher {
    width: 56px;
    height: 56px;
  }
  
  .launcher-inner svg {
    width: 28px;
    height: 28px;
  }
  
  #dexora-chat-widget {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  
  #dexora-chat-widget.keyboard-open {
    height: 50vh;
  }
  
  .bubble {
    max-width: 90%;
    font-size: 14px;
  }
  
  .quick-btn {
    font-size: 12px;
    padding: 6px 12px;
  }
  
  .chat-input input {
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

@media (max-width: 480px) {
  .chat-header {
    padding: 12px 14px;
  }
  
  .chat-logo {
    width: 32px;
    height: 32px;
  }
  
  .chat-title {
    font-size: 15px;
  }
  
  .action-btn {
    width: 28px;
    height: 28px;
  }
  
  .action-btn svg {
    width: 16px;
    height: 16px;
  }
}

/* === Accessibility === */
.action-btn:focus,
.quick-btn:focus,
.chat-input button:focus,
#dexora-chat-launcher:focus {
  outline: 3px solid rgba(255, 90, 0, 0.5);
  outline-offset: 2px;
}

.chat-input input:focus {
  outline: none; /* Using box-shadow instead */
}

/* === Print Styles === */
@media print {
  .dexora-launcher-wrap,
  #dexora-chat-widget {
    display: none !important;
  }
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .launcher-pulse {
    display: none;
  }
}

/* === Calendly Popup Modal === */
.clif-calendly-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 999999;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(5px);
}

.clif-calendly-modal.active {
  display: flex !important;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.clif-calendly-modal-content {
  position: relative;
  width: 90%;
  max-width: 1000px;
  height: 90%;
  max-height: 800px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.clif-calendly-modal.active .clif-calendly-modal-content {
  transform: scale(1);
}

.clif-calendly-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  background: #ffffff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #375A7F;
  z-index: 10;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.clif-calendly-close:hover {
  background: #375A7F;
  color: #ffffff;
  transform: rotate(90deg);
}

.clif-calendly-iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 20px;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .clif-calendly-modal-content {
    width: 95%;
    height: 95%;
    max-height: none;
    border-radius: 15px;
  }
  
  .clif-calendly-close {
    width: 35px;
    height: 35px;
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .clif-calendly-modal-content {
    border-radius: 10px;
  }
}

/* Calendly link styling in chatbot */
.calendly-popup-trigger {
  color: #375A7F !important;
  text-decoration: none !important;
  font-weight: 600;
  transition: color 0.2s ease;
}

.calendly-popup-trigger:hover {
  color: #2a4661 !important;
  text-decoration: underline !important;
}
