/* BotFlow Chat Component Styles */
:root {
  --bf-panel: #111;
  --bf-screen: #000;
  --bf-header: #0a5a4f;
  --bf-incoming: #ffffff;
  --bf-outgoing: #dcf8c6;
  --bf-text: #e8eef2;
  --bf-text-dark: #303030;
  --bf-text-incoming: #303030;
  --bf-border: #2a3942;
  --bf-typing: #8696a0;
  --bf-shadow: rgba(0, 0, 0, 0.3);
}

/* Container */
.bf-wrap {
  width: 400px;
  max-width: 95vw;
  margin: 0 auto;
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Phone Frame */
.bf-phone-frame {
  background: var(--bf-panel);
  border-radius: 20px;
  padding: 8px;
  box-shadow: 0 20px 40px var(--bf-shadow);
}

.bf-phone-screen {
  background: var(--bf-screen);
  border-radius: 16px;
  overflow: hidden;
  height: 650px;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Header */
.bf-header {
  background: var(--bf-header);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--bf-border);
  flex-shrink: 0;
}

.bf-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bf-outgoing);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bf-text-dark);
  font-weight: bold;
  font-size: 18px;
}

.bf-contact-info {
  flex: 1;
  text-align: left;
}

.bf-contact-name {
  color: var(--bf-text);
  font-size: 16px;
  font-weight: 500;
  margin: 0;
  line-height: 1.2;
  text-align: left;
}

.bf-contact-status {
  color: var(--bf-typing);
  font-size: 13px;
  margin: 2px 0 0 0;
  line-height: 1;
  text-align: left;
}

.bf-header-actions {
  display: flex;
  gap: 16px;
  color: var(--bf-typing);
  font-size: 20px;
}

.bf-header-actions svg {
  width: 20px;
  height: 20px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.bf-header-actions svg:hover {
  color: var(--bf-text);
}

/* Messages Container */
.bf-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background-image: url('../images/whatsapp-bg.jpg');
  background-size: auto;
  background-position: top left;
  background-repeat: repeat;
  background-attachment: scroll;
}

.bf-messages::-webkit-scrollbar {
  width: 4px;
}

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

.bf-messages::-webkit-scrollbar-thumb {
  background: var(--bf-border);
  border-radius: 2px;
}

/* Message Bubbles */
.bf-message {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.bf-message.bf-show {
  opacity: 1;
  transform: translateY(0);
}

.bf-message.bf-incoming {
  align-items: flex-start;
}

.bf-message.bf-outgoing {
  align-items: flex-end;
}

.bf-message-bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  text-align: left;
}

.bf-incoming .bf-message-bubble {
  background: var(--bf-incoming);
  color: var(--bf-text-incoming);
  border-bottom-left-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.bf-outgoing .bf-message-bubble {
  background: var(--bf-outgoing);
  color: var(--bf-text-dark);
  border-bottom-right-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.bf-message-time {
  font-size: 11px;
  color: #667781;
  margin-top: 4px;
  align-self: flex-end;
}

.bf-incoming .bf-message-time {
  align-self: flex-start;
}

/* Typing Indicator */
.bf-typing-indicator {
  display: flex;
  align-items: flex-start;
  margin-bottom: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.bf-typing-indicator.bf-show {
  opacity: 1;
  transform: translateY(0);
}

.bf-typing-bubble {
  background: var(--bf-incoming);
  padding: 12px 16px;
  border-radius: 8px;
  border-bottom-left-radius: 3px;
  display: flex;
  gap: 4px;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.bf-typing-dot {
  width: 6px;
  height: 6px;
  background: #667781;
  border-radius: 50%;
  animation: bf-typing-bounce 1.4s infinite ease-in-out;
}

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

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

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

/* Footer */
.bf-footer {
  background: var(--bf-screen);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--bf-border);
  flex-shrink: 0;
}

.bf-input-fake {
  flex: 1;
  background: var(--bf-incoming);
  color: #666666;
  padding: 12px 16px;
  border-radius: 20px;
  font-size: 14px;
  border: none;
  outline: none;
  transition: all 0.3s ease;
  cursor: text;
  min-height: 20px;
  display: flex;
  align-items: center;
}

.bf-input-fake.bf-typing-text {
  color: var(--bf-text-incoming)!important;
}

.bf-input-fake::after {
  content: '';
  display: inline-block;
  width: 1px;
  height: 14px;
  background: var(--bf-text);
  margin-left: 2px;
  opacity: 0;
  animation: bf-cursor-blink 1s infinite;
}

.bf-input-fake.bf-typing-text::after {
  opacity: 1;
}

@keyframes bf-cursor-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.bf-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #28d366;
  border: none;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bf-text-dark);
  font-size: 18px;
  transition: none;
  flex-shrink: 0;
}

.bf-send:hover {
  background: #28d366;
  transform: none;
}

.bf-send:active {
  transform: none;
}

.bf-send svg {
  width: 20px;
  height: 20px;
}

/* Responsive */
@media (max-width: 768px) {
  .bf-wrap {
    width: 350px;
    max-width: 90vw;
  }
  
  .bf-phone-screen {
    height: 650px;
  }
}

@media (max-width: 480px) {
  .bf-wrap {
    width: 350px;
    max-width: 85vw;
  }
  
  .bf-phone-frame {
    border-radius: 16px;
    padding: 6px;
  }
  
  .bf-phone-screen {
    border-radius: 12px;
    height: 600px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .bf-message,
  .bf-typing-indicator {
    transition: none;
  }
  
  .bf-typing-dot {
    animation: none;
    opacity: 0.6;
  }
  
  .bf-input-fake::after {
    animation: none;
    opacity: 1;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --bf-incoming: #333;
    --bf-outgoing: #00ff00;
    --bf-text: #ffffff;
    --bf-text-dark: #000000;
    --bf-border: #666;
  }
}