/* 
   Modern & Spectacular Chat Design 
   Refactored for MiApi
*/

:root {
  --chat-primary: #095e54;
  --chat-secondary: #128c7e;
  --chat-bg: rgba(255, 255, 255, 0.95);
  --chat-text: #333;
  --chat-bot-bubble: #f0f2f5;
  --chat-user-bubble: #e1ffc7;
  --chat-shadow: 0 12px 28px 0 rgba(0, 0, 0, 0.2), 0 2px 4px 0 rgba(0, 0, 0, 0.1);
  --radius: 16px;
}

#whatsapp-chat.chat-window {
  box-sizing: border-box !important;
  position: fixed;
  width: 380px;
  height: 550px;
  bottom: 100px;
  right: 30px;
  background: var(--chat-bg);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  box-shadow: var(--chat-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.hide {
  display: none !important;
}

#whatsapp-chat.showchat {
  display: flex;
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Header */
.header-chat {
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.head-home {
  display: flex;
  align-items: center;
  gap: 12px;
}

.info-avatar {
  position: relative;
}

.info-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
}


.chat-title-group {
  display: flex;
  flex-direction: column;
}

.whatsapp-name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.2px;
}

.status-indicator {
  font-size: 11px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-indicator .dot {
  width: 6px;
  height: 6px;
  background: #4ade80;
  border-radius: 50%;
}

.close-chat {
  color: white;
  opacity: 0.8;
  transition: all 0.2s;
  text-decoration: none !important;
  border: none !important;
  display: flex;
  align-items: center;
}

.close-chat:hover {
  opacity: 1;
  transform: rotate(90deg);
}

/* Body & Content */
.chat-body-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #f0f2f5;
  background-image: url("https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcd2de2.png");
  background-blend-mode: overlay;
  overflow: hidden;
}

.chat-content {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.message-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 85%;
  padding: 10px 14px;
  position: relative;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
  animation: messageIn 0.3s ease forwards;
}

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

.bot-msg {
  align-self: flex-start;
  background: white;
  color: #333;
  border-radius: 0px 12px 12px 12px;
}

.user-msg {
  align-self: flex-end;
  background: var(--chat-user-bubble);
  color: #333;
  border-radius: 12px 0px 12px 12px;
}

.msg-author {
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 3px;
  opacity: 0.5;
  text-transform: uppercase;
}

.msg-time {
  font-size: 10px;
  text-align: right;
  margin-top: 4px;
  opacity: 0.4;
}

/* Loading Indicator */
.loading-container {
  padding: 5px 15px;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: white;
  border-radius: 12px;
  width: fit-content;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: #999;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

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

@keyframes typing {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Input Area */
.input-area {
  padding: 12px 15px;
  background: white;
  border-top: 1px solid #e0e0e0;
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f0f2f5;
  padding: 4px 15px;
  border-radius: 25px;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.input-wrapper:focus-within {
  background: white;
  border-color: var(--chat-secondary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

textarea#chat-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  padding: 10px 0;
  max-height: 100px;
  resize: none;
  font-size: 14px;
  color: #333;
  outline: none !important;
  box-shadow: none !important;
}

button#send-it {
  background: var(--chat-primary);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
  margin-bottom: 4px;
}

button#send-it:hover {
  background: var(--chat-secondary);
  transform: scale(1.05);
}

button#send-it svg {
  margin-left: 2px;
}

/* Launcher */
.chat-launcher {
  position: fixed;
  bottom: 25px;
  right: 30px;
  background: white;
  color: #333;
  padding: 12px 24px;
  border-radius: 50px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
  text-decoration: none !important;
  z-index: 999;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-launcher:hover {
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

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

.launcher-icon {
  background: var(--chat-primary);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.launcher-text {
  font-weight: 600;
  font-size: 14px;
}

/* Media Queries */
@media (max-width: 480px) {
  #whatsapp-chat.chat-window {
    width: 90%;
    height: 80%;
    right: 5%;
    bottom: 90px;
  }
}