/**
 * Ciph Creative Agency Chatbot Styles
 */

.ciph-chatbot {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  will-change: transform, opacity;
}

/* Toggle Button */
.chatbot-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(79, 140, 255, 0.6);
}

.chatbot-toggle.active {
  transform: scale(0.9);
}

.chatbot-toggle i {
  font-size: 26px;
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4444;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

/* Chatbot Window */
.chatbot-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 400px;
  height: 600px;
  max-width: calc(100vw - 40px);
  max-height: 85dvh;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(30px) scale(0.9);
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  overflow: hidden;
}

.chatbot-window.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.chatbot-header {
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  color: white;
  padding: 20px 24px;
  border-radius: 20px 20px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.header-text h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.status {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 5px;
}

.status::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
  animation: blink 2s infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.close-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.2s;
}

.close-btn:hover {
  transform: rotate(90deg);
}

/* Messages Container */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 3px;
}

/* Messages */
.message {
  display: flex;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-avatar {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #4F8CFF 0%, #3B5998 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 15px;
  flex-shrink: 0;
}

.message-content {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 13px;
}

.bot-message .message-content {
  background: white;
  color: #2d3748;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

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

.user-message .message-content {
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

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

.typing-dots {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: white;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: #cbd5e0;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

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

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

@keyframes typing {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.7;
  }

  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Quick Replies */
.chatbot-quick-replies {
  padding: 10px 20px;
  background: white;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid #e2e8f0;
  max-height: 150px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.quick-reply-btn {
  padding: 8px 16px;
  background: white;
  border: 2px solid #4F8CFF;
  color: #4F8CFF;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-reply-btn:hover {
  background: #4F8CFF;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 140, 255, 0.3);
}

/* Input Area */
.chatbot-input {
  padding: 14px 16px;
  background: white;
  border-radius: 0 0 16px 16px;
  display: flex;
  gap: 10px;
  border-top: 1px solid #e2e8f0;
}

#chatbot-input-field {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 24px;
  font-size: 16px;
  /* Prevents auto-zoom on iOS */
  outline: none;
  transition: border-color 0.2s;
  background: white;
}

#chatbot-input-field:focus {
  border-color: #4F8CFF;
}

.send-btn {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #4F8CFF 0%, #3B5998 100%);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.send-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(79, 140, 255, 0.4);
}

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

/* Mobile Responsive - Mobile First Approach */

/* Small phones (320px - 374px) */
@media (max-width: 374px) {
  .ciph-chatbot {
    bottom: 10px;
    right: 10px;
  }

  .chatbot-toggle {
    width: 48px;
    height: 48px;
  }

  .chatbot-toggle i {
    font-size: 20px;
  }

  .notification-badge {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }

  .chatbot-window {
    width: calc(100vw - 20px);
    height: calc(100svh - 90px);
    /* Primary svh for mobile */
    max-height: 85dvh;
    bottom: 70px;
    right: 10px;
    border-radius: 15px;
  }

  .chatbot-header {
    padding: 12px 15px;
  }

  .avatar {
    width: 35px;
    height: 35px;
    font-size: 18px;
  }

  .header-text h4 {
    font-size: 13px;
  }

  .status {
    font-size: 10px;
  }

  .close-btn {
    font-size: 16px;
    padding: 4px;
  }

  .chatbot-messages {
    padding: 12px;
    gap: 8px;
  }

  .message-content {
    font-size: 12px;
    padding: 8px 12px;
    max-width: 80%;
  }

  .message-avatar {
    width: 26px;
    height: 26px;
    font-size: 13px;
  }

  .chatbot-quick-replies {
    padding: 8px 12px;
    gap: 6px;
  }

  .quick-reply-btn {
    padding: 6px 12px;
    font-size: 11px;
    min-height: 40px;
  }

  .chatbot-input {
    padding: 10px 12px;
  }

  #chatbot-input-field {
    padding: 8px 12px;
    font-size: 12px;
  }

  .send-btn {
    width: 38px;
    height: 38px;
    font-size: 15px;
  }
}

/* Standard phones (375px - 480px) */
@media (min-width: 375px) and (max-width: 480px) {
  .ciph-chatbot {
    bottom: 12px;
    right: 12px;
  }

  .chatbot-toggle {
    width: 52px;
    height: 52px;
  }

  .chatbot-toggle i {
    font-size: 22px;
  }

  .notification-badge {
    width: 20px;
    height: 20px;
    font-size: 11px;
  }

  .chatbot-window {
    width: calc(100vw - 24px);
    height: calc(100vh - 100px);
    bottom: 75px;
    right: 12px;
    border-radius: 16px;
  }

  .chatbot-header {
    padding: 14px 16px;
  }

  .avatar {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }

  .header-text h4 {
    font-size: 14px;
  }

  .status {
    font-size: 11px;
  }

  .chatbot-messages {
    padding: 14px;
    gap: 10px;
  }

  .message-content {
    font-size: 13px;
    padding: 9px 13px;
    max-width: 82%;
  }

  .message-avatar {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .chatbot-quick-replies {
    padding: 10px 14px;
    gap: 7px;
  }

  .quick-reply-btn {
    padding: 7px 14px;
    font-size: 12px;
    min-height: 42px;
  }

  .chatbot-input {
    padding: 11px 14px;
  }

  #chatbot-input-field {
    padding: 9px 13px;
    font-size: 13px;
  }

  .send-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
}

/* Large phones (481px - 599px) */
@media (min-width: 481px) and (max-width: 599px) {
  .ciph-chatbot {
    bottom: 15px;
    right: 15px;
  }

  .chatbot-toggle {
    width: 55px;
    height: 55px;
  }

  .chatbot-toggle i {
    font-size: 24px;
  }

  .chatbot-window {
    width: calc(100vw - 30px);
    height: calc(100vh - 110px);
    bottom: 75px;
    right: 15px;
    max-width: 400px;
  }

  .chatbot-messages {
    padding: 16px;
  }

  .message-content {
    font-size: 13px;
    max-width: 85%;
  }

  .quick-reply-btn {
    font-size: 12px;
    min-height: 44px;
  }
}

/* Tablets (600px - 768px) */
@media (min-width: 600px) and (max-width: 768px) {
  .ciph-chatbot {
    bottom: 18px;
    right: 18px;
  }

  .chatbot-toggle {
    width: 58px;
    height: 58px;
  }

  .chatbot-toggle i {
    font-size: 26px;
  }

  .chatbot-window {
    width: 360px;
    height: 550px;
    bottom: 78px;
    right: 18px;
  }
}

/* Small laptops (769px - 1023px) */
@media (min-width: 769px) and (max-width: 1023px) {
  .ciph-chatbot {
    bottom: 20px;
    right: 20px;
  }

  .chatbot-window {
    width: 360px;
    height: 550px;
  }
}

/* Large screens (1024px - 1199px) */
@media (min-width: 1024px) and (max-width: 1199px) {
  .ciph-chatbot {
    bottom: 20px;
    right: 20px;
  }

  .chatbot-window {
    width: 360px;
    height: 550px;
  }
}

/* Extra large screens (1200px+) */
@media (min-width: 1200px) {
  .ciph-chatbot {
    bottom: 20px;
    right: 20px;
  }

  .chatbot-window {
    width: 360px;
    height: 550px;
  }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .chatbot-window {
    height: 85vh;
    max-height: 380px;
    width: 400px;
    bottom: 10px;
    right: 10px;
  }

  .ciph-chatbot {
    bottom: 15px;
    right: 15px;
  }

  .chatbot-header {
    padding: 8px 15px;
  }

  .avatar {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .header-text h4 {
    font-size: 13px;
  }

  .status {
    font-size: 10px;
  }

  .chatbot-messages {
    padding: 10px 15px;
    gap: 8px;
  }

  .message-content {
    font-size: 12px;
    padding: 7px 11px;
  }

  .chatbot-input {
    padding: 8px 15px;
  }

  #chatbot-input-field {
    padding: 7px 11px;
    font-size: 12px;
  }

  .send-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .quick-reply-btn {
    padding: 5px 12px;
    font-size: 11px;
    min-height: 36px;
  }
}

/* Very short landscape screens */
@media (max-height: 400px) and (orientation: landscape) {
  .chatbot-window {
    height: calc(100vh - 60px);
    max-height: 320px;
  }

  .chatbot-header {
    padding: 6px 12px;
  }

  .chatbot-messages {
    padding: 8px 12px;
  }

  .chatbot-input {
    padding: 6px 12px;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .chatbot-window {
    background: #1a202c;
  }

  .chatbot-messages {
    background: #2d3748;
  }

  .bot-message .message-content {
    background: #4a5568;
    color: #e2e8f0;
  }

  .chatbot-input {
    background: #1a202c;
    border-top-color: #4a5568;
  }

  #chatbot-input-field {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }

  .chatbot-quick-replies {
    background: #1a202c;
    border-top-color: #4a5568;
  }

  .quick-reply-btn {
    background: #2d3748;
    border-color: #4F8CFF;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Accessibility */
.chatbot-toggle:focus,
.close-btn:focus,
.send-btn:focus,
.quick-reply-btn:focus {
  outline: 2px solid #4F8CFF;
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .ciph-chatbot {
    display: none;
  }
}