/* Chat Widget CSS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

#bma-chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s ease;
  max-width: 400px;
  width: 100%;
  box-sizing: border-box;
  display: block !important; /* Force display */
}

/* Widget state classes */
#bma-chat-widget.state-collapsed .bma-chat-collapsed { display: flex !important; }
#bma-chat-widget.state-collapsed .bma-chat-expanded,
#bma-chat-widget.state-collapsed .bma-connecting,
#bma-chat-widget.state-collapsed .bma-chat-button,
#bma-chat-widget.state-collapsed .bma-floating-widget { display: none !important; }

#bma-chat-widget.state-expanded .bma-chat-expanded { display: flex !important; }
#bma-chat-widget.state-expanded .bma-chat-collapsed,
#bma-chat-widget.state-expanded .bma-connecting,
#bma-chat-widget.state-expanded .bma-chat-button,
#bma-chat-widget.state-expanded .bma-floating-widget { display: none !important; }

#bma-chat-widget.state-connecting .bma-connecting { 
  display: flex !important; 
  z-index: 10002;
}
#bma-chat-widget.state-connecting .bma-chat-collapsed,
#bma-chat-widget.state-connecting .bma-chat-expanded,
#bma-chat-widget.state-connecting .bma-chat-button,
#bma-chat-widget.state-connecting .bma-floating-widget { 
  display: none !important; 
}

#bma-chat-widget.state-minimized .bma-chat-button { display: flex !important; }
#bma-chat-widget.state-minimized .bma-chat-collapsed,
#bma-chat-widget.state-minimized .bma-connecting,
#bma-chat-widget.state-minimized .bma-chat-expanded,
#bma-chat-widget.state-minimized .bma-floating-widget { display: none !important; }

#bma-chat-widget.state-floating .bma-floating-widget { display: block !important; }
#bma-chat-widget.state-floating .bma-chat-collapsed,
#bma-chat-widget.state-floating .bma-connecting,
#bma-chat-widget.state-floating .bma-chat-expanded,
#bma-chat-widget.state-floating .bma-chat-button { display: none !important; }

/* Hidden state - hide all widget components */
#bma-chat-widget.state-hidden {
  display: none !important;
}

#bma-chat-widget.dragging {
  opacity: 0.8;
  user-select: none;
  pointer-events: none;
}

#bma-chat-widget.minimized {
  width: 60px;
  height: 60px;
  overflow: hidden;
}

/* Toggle button for showing/hiding the widget */
.bma-toggle-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  min-width: 38px;
  height: 38px;
  border-radius: 16px;
  background-color: #2f4b30;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  z-index: 10001;
  transition: all 0.3s ease;
  padding: 0 10px;
}

.bma-toggle-button:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

.bma-toggle-button.widget-hidden {
  background-color: #264b28;
  min-width: 180px;
  padding: 0 12px;
  justify-content: space-between;
}

.bma-toggle-button svg {
  width: 20px;
  height: 20px;
  stroke: white;
  stroke-width: 2px;
  flex-shrink: 0;
}

.bma-toggle-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 8px;
  display: none;
}

.bma-toggle-button.widget-hidden .bma-toggle-avatar {
  display: block;
}

.bma-toggle-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
  margin-right: 8px;
}

.bma-toggle-button.widget-hidden .bma-toggle-name {
  display: block;
}

/* Responsive styles for the widget and toggle */
@media screen and (max-width: 768px) {
  #bma-chat-widget {
    max-width: 90%;
    width: 90%;
    right: 5%;
    left: 5%;
  }
  
  .bma-chat-expanded,
  .bma-connecting {
    width: 100% !important;
    height: 450px !important;
  }
  
  .bma-toggle-button.widget-hidden {
    min-width: 150px;
  }
  
  .bma-toggle-name {
    max-width: 100px;
  }
}

@media screen and (max-width: 480px) {
  #bma-chat-widget {
    max-width: 100%;
    width: 100%;
    right: 0;
    left: 0;
    bottom: 0;
  }
  
  .bma-chat-expanded,
  .bma-connecting {
    width: 100% !important;
    height: 100vh !important;
    border-radius: 0 !important;
  }
  
  .bma-toggle-button {
    bottom: 10px;
    right: 10px;
  }
  
  .bma-toggle-button.widget-hidden {
    min-width: 120px;
  }
  
  .bma-toggle-name {
    max-width: 70px;
  }
}

/* Collapsed state (button) */
.bma-chat-collapsed,
.bma-chat-button {
  width: 70px;
  height: 70px;
  border-radius: 30px;
  background-color: #29552b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.bma-chat-button-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bma-chat-button:hover,
.bma-chat-collapsed:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.bma-avatar-container,
.bma-chat-button {
  width: 60px;
  height: 60px;
  border-radius: 30px;
  background-color: #31ae38;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bma-avatar-image,
.bma-chat-button img {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  object-fit: cover;
}

.bma-collapsed-info {
  display: none;
}

.bma-collapsed-title,
.bma-chat-button-text {
  display: none;
}

.bma-chat-controls-mini {
  display: none;
}

.bma-chat-sound-mini,
.bma-chat-close-mini {
  display: none;
}

/* Connecting state */
.bma-connecting {
  width: 360px; /* Match the floating widget width */
  height: 500px; /* Match the floating widget height */
  background: #161616; /* Dark background */
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  color: #fff;
  text-align: center;
  padding: 20px;
  box-sizing: border-box;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

/* Responsive styles for connecting interface */
@media screen and (max-width: 768px) {
  .bma-connecting {
    width: 100%;
    height: 450px;
    max-width: 100%;
    border-radius: 16px;
  }
}

@media screen and (max-width: 480px) {
  .bma-connecting {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    padding: 15px;
  }
  
  .bma-connecting-title {
    font-size: 16px;
    margin-bottom: 20px;
  }
  
  .bma-connecting-text {
    font-size: 14px;
    margin-bottom: 25px;
  }
  
  .bma-loading-spinner {
    width: 40px;
    height: 40px;
    margin-bottom: 25px;
  }
  
  .bma-connecting-status {
    font-size: 16px;
  }
}

/* Gradient border around connecting card */
.bma-connecting::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #9b4dff, #ff7b4d, #4dffb4, #4d83ff);
  background-size: 400% 400%;
  z-index: -2;
  filter: blur(6px);
  border-radius: 22px;
  animation: gradientBorder 6s ease infinite;
  opacity: 0.9;
}

@media screen and (max-width: 480px) {
  .bma-connecting::before {
    border-radius: 0;
  }
}

.bma-connecting-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 30px;
  color: #31ae38;
}

.bma-connecting-text {
  font-size: 15px;
  line-height: 1.4;
  margin-bottom: 32px;
}

.bma-loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(49, 174, 56, 0.2);
  border-top-color: #31ae38;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 32px;
  margin-top: 20px;
  box-shadow: 0 0 15px rgba(49, 174, 56, 0.5);
}

.bma-connecting-status {
  font-size: 18px;
  font-weight: 600;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Expanded state (full chat) */
.bma-chat-expanded {
  width: 360px;
  height: 500px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#bma-chat-widget.compact .bma-chat-expanded {
  height: 550px;
}

#bma-chat-widget.compact .bma-connecting {
  height: 100%;
}

/* === Refined chat header === */
.bma-chat-header{
  background:#1e1e1e;              /* dark flat */
  border-bottom:1px solid #2d2d2d; /* subtle divider */
  padding:0 14px;
  height:56px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap:12px;
}
.bma-chat-header-avatar{
  display: flex;
  align-items: center;
}
.bma-chat-header-avatar img{
  width:36px;
  height:36px;
  border-radius:50%;
  object-fit:cover;
  border:2px solid #31ae38;        /* accent ring */
}
.bma-chat-title{
  flex:1;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-size:15px;
  font-weight:700;
  color:#ffffff;
}

.bma-chat-controls{
  display:flex;
  align-items: center;
  gap:8px;
}
.bma-chat-controls button{
  width:34px;
  height:34px;
  border-radius:50%;
  background:rgba(255,255,255,0.12);
  display:flex!important;
  align-items:center;
  justify-content:center;
  border:none;
  padding:0;
  color:#ffffff;
  cursor:pointer;
  opacity:0.9;
  transition:background .2s,opacity .2s;
}
.bma-chat-controls button:hover{background:rgba(255,255,255,0.20);opacity:1;}

/* special mic mute style */
.bma-chat-controls .bma-chat-microphone.muted{
  background:#d24b4b;
}

/* Hide unused icons to match design */
.bma-chat-size,
.bma-chat-minimize,
.bma-chat-close{display:none!important;}

/* messages */
.bma-chat-messages {
  flex: 1 1 auto;
  padding: 14px 16px 14px 52px; /* leave room for avatar */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f7f7f8;
}

.bma-message {
  max-width: 100%;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  padding: 10px 14px;
  border-radius: 14px;
}

.bma-message.user {
  align-self: flex-end;
  background: #31ae38;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bma-message.bot {
  align-self: flex-start;
  background: #ffffff;
  color: #222;
  border-bottom-left-radius: 4px;
  position: relative;
}

.bma-message.bot::before {
  content: '';
  position: absolute;
  left: -40px;
  top: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: url('../assets/bot-avatar.png') center/cover no-repeat;
  box-shadow: 0 0 0 2px #fff;
}

/* input */
.bma-chat-input-form {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e4e4e6;
  background: #ffffff;
}

.bma-chat-input {
  flex: 1;
  font-size: 14px;
  padding: 10px 14px;
  border: 1px solid #d0d0d5;
  border-radius: 22px;
  outline: none;
}

.bma-chat-input:focus {
  border-color: #31ae38;
}

.bma-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  background: #31ae38;
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.bma-chat-send:hover {
  background: #26912c;
}

/* scrollbar tweaks */
.bma-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.bma-chat-messages::-webkit-scrollbar-thumb {
  background: #c0c0c5;
  border-radius: 3px;
}

.bma-typing-indicator {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background-color: #f0f0f0;
  border-radius: 16px;
  align-self: flex-start;
  margin-bottom: 8px;
}

.bma-typing-indicator span {
  width: 8px;
  height: 8px;
  background-color: #999;
  border-radius: 50%;
  display: inline-block;
  margin: 0 2px;
  animation: typing 1.4s infinite both;
}

.bma-typing-indicator span:nth-child(1) {
  animation-delay: 0s;
}

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

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

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

.bma-powered-by {
  font-size: 11px;
  color: #999;
  text-align: center;
  padding: 6px;
}

.bma-powered-by span {
  color: #31ae38;
  font-weight: 600;
}

.bma-voice-recording-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(49, 174, 56, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  border-radius: 16px;
}

.bma-voice-recording-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.bma-recording-indicator {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  animation: pulse 1.5s infinite;
}

.bma-recording-text {
  color: white;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 24px;
}

.bma-recording-cancel {
  background-color: white;
  color: #31ae38;
  border: none;
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.bma-recording-cancel:hover {
  background-color: #f0f0f0;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(172, 171, 171, 0); }
}

/* Floating widget styles - DARK DESIGN WITH FULL IMAGE */
.bma-floating-widget {
  width: 360px;  /* Increased from 280px */
  height: 500px;  /* Increased from 380px */
  position: relative;
  z-index: 10001;
  overflow: hidden;
  display: block !important;
  visibility: visible !important;
}

.bma-floating-card {
  background-color: transparent;    /* changed from black to transparent */
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;  /* Take full height of parent */
  visibility: visible !important;
}

/* Background photo with lighter gradient overlay to show more of the image */
.bma-floating-card::before {
  content: '';
  position: absolute;
  inset: 0;
  /* avatar fills card with lighter gradient so image is more visible */
  background: linear-gradient(180deg, rgba(16,16,32,0.3) 0%, rgba(16,16,32,0.5) 40%, rgba(0,0,0,0.7) 100%),
              url('../assets/bot-avatar.png') center center / cover no-repeat;
  z-index: -1;
  visibility: visible !important;
}

/* Purple glow border effect */
.bma-floating-card::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #9b4dff, #ff7b4d, #4dffb4, #4d83ff);
  background-size: 400% 400%;
  z-index: -2;
  filter: blur(6px);
  border-radius: 26px;
  animation: gradientBorder 6s ease infinite;
  opacity: 0.8;
}

.bma-floating-header {
  padding: 20px 20px 0 20px;  /* Increased from 16px */
  text-align: left;
}

.bma-floating-title {
  color: #31ae38;
  font-size: 16px;  /* Increased from 16px */
  font-weight: 700;
  margin-bottom: 5px;
  text-align: left;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8), 0 0 8px rgba(0, 0, 0, 0.7);
}

.bma-floating-sparkle {
  color: #31ae38;
  margin-right: 6px;
  font-size: 20px;
}

.bma-floating-content {
  padding: 0;
  text-align: left;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-bottom: 10px;
  border: none;  /* Explicitly remove any border */
}

.bma-floating-heading-container {
  padding-top: 2px;  /* Further reduced from 20px */
  border-bottom: none;  /* Explicitly remove any border */
}

.bma-floating-heading {
  font-size: 22px;  /* Increased from 24px */
  color: #fff;
  margin: 220px 0 20px;  /* Increased top margin to move text down more */
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  padding: 0 20px;  /* Increased from 15px */
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(0, 0, 0, 0.7);
  max-width: 95%;
  border-bottom: none;  /* Explicitly remove any border */
}

/* Remove any horizontal lines in the floating widget */
.bma-floating-widget hr,
.bma-floating-card hr,
.bma-floating-content hr,
.bma-floating-heading::after,
.bma-floating-heading::before {
  display: none !important;
  border: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.bma-floating-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;  /* Increased from 12px */
  margin-bottom: 40px;  /* Increased from 30px */
  padding: 0 25px;  /* Increased from 20px */
}

/* Primary green button */
.bma-voice-action {
  background: #31ae38;
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 16px;  /* Increased from 14px */
  font-weight: 700;
  padding: 15px 0;  /* Increased from 12px */
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: background 0.2s, transform 0.2s;
}

.bma-voice-action:hover {
  background: #26912c;
  transform: translateY(-2px);
}

/* Secondary outlined button */
.bma-chat-action {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  font-size: 16px;  /* Increased from 14px */
  font-weight: 700;
  padding: 15px 0;  /* Increased from 12px */
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: background 0.2s, transform 0.2s;
}

.bma-chat-action:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.bma-floating-poweredby {
  font-size: 12px;  /* Increased from 11px */
  color: rgba(255, 255, 255, 0.7);
  padding: 15px;  /* Increased from 12px */
  text-align: right;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.bma-floating-poweredby span {
  color: #fff;
  font-weight: 600;
}

@keyframes gradientBorder {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Arbitration Q&A styles */
.bma-arb-progress { 
  font-size: 13px; 
  color: #31ae38; 
  margin-bottom: 6px; 
  font-weight: 600; 
}

.bma-arb-question { 
  font-size: 15px; 
  font-weight: 600; 
  margin-bottom: 8px; 
  color: #222; 
}

.bma-arb-answer { 
  width: 100%; 
  padding: 12px; 
  border-radius: 8px; 
  border: 1.5px solid #31ae38; 
  margin-bottom: 10px; 
  font-size: 15px; 
}

.bma-arb-next { 
  background: #31ae38; 
  color: #fff; 
  border: none; 
  border-radius: 8px; 
  padding: 10px 28px; 
  font-weight: bold; 
  font-size: 15px; 
  cursor: pointer; 
  box-shadow: 0 2px 8px rgba(49,174,56,0.08); 
  transition: background 0.2s; 
}

.bma-arb-next:hover { 
  background: #26912c; 
}

.bma-arb-generating { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
  font-size: 15px; 
  color: #222; 
}

.bma-spinner { 
  width: 22px; 
  height: 22px; 
  border: 3px solid #eee; 
  border-top: 3px solid #31ae38; 
  border-radius: 50%; 
  animation: spin 1s linear infinite; 
}

.bma-arb-download { 
  background: linear-gradient(45deg, #31ae38, #26912c); 
  color: #fff; 
  border: none; 
  border-radius: 8px; 
  padding: 14px 28px; 
  font-weight: bold; 
  font-size: 16px; 
  cursor: pointer; 
  box-shadow: 0 4px 12px rgba(49,174,56,0.2); 
  transition: all 0.3s; 
  display: flex; 
  align-items: center; 
  gap: 10px; 
}

.bma-arb-download:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 6px 16px rgba(49,174,56,0.3); 
}

/* Paywall styles */
.bma-paywall-container {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  padding: 20px;
  margin: 10px 0;
  text-align: center;
  animation: fadeIn 0.5s ease;
}

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

.bma-paywall-container h3 {
  margin: 0 0 15px 0;
  font-size: 18px;
  font-weight: 600;
  color: #222;
}

.bma-paywall-container p {
  margin: 0 0 20px 0;
  font-size: 14px;
  color: #555;
}

.bma-paywall-container ul {
  list-style: none;
  padding: 0;
  margin: 15px 0;
  text-align: left;
}

.bma-paywall-container li {
  margin: 5px 0;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.bma-paywall-container button {
  background: #31ae38;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 8px 15px;
  width: 100%;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease;
}

.bma-paywall-container button:hover {
  background: #2a9730;
}

.bma-arb-progress { 
  display: flex;
  width: 100%;
  margin-bottom: 15px;
  background: #f5f5f5;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
} 