/* =============================================
   Marinho Couros — Chat Widget
   ============================================= */

:root {
  --mc-green:       #25D366;
  --mc-green-dark:  #1ebe57;
  --mc-green-deep:  #128C7E;
  --mc-text-dark:   #213e38;
  --mc-radius:      16px;
  --mc-shadow:      0 8px 40px rgba(0,0,0,0.18);
  --mc-shadow-btn:  0 4px 20px rgba(37,211,102,0.45);
}

/* ── Botão flutuante ── */
#mc-chat-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--mc-green);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--mc-shadow-btn);
  transition: transform .2s, box-shadow .2s;
  animation: mc-pulse 3s infinite;
}

#mc-chat-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(37,211,102,0.6);
}

#mc-chat-trigger svg {
  width: 30px;
  height: 30px;
  fill: #fff;
  transition: opacity .2s;
}

#mc-chat-trigger .mc-icon-close {
  display: none;
  width: 22px;
  height: 22px;
}

/* Ícone GIF personalizado */
#mc-chat-trigger img.mc-icon-chat {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 0;
  transition: opacity .2s;
}

#mc-chat-trigger.mc-open .mc-icon-chat  { display: none; }
#mc-chat-trigger.mc-open .mc-icon-close { display: block; }

/* Tooltip */
#mc-chat-trigger::before {
  content: attr(data-tooltip);
  position: absolute;
  right: 72px;
  background: #1a1a1a;
  color: #fff;
  font-size: 12.5px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

#mc-chat-trigger:hover::before {
  opacity: 1;
}

/* Notificação / badge */
#mc-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #e53e3e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Painel do widget ── */
#mc-chat-panel {
  position: fixed;
  bottom: 102px;
  right: 28px;
  z-index: 9999;
  width: 360px;
  max-width: calc(100vw - 40px);
  background: #fff;
  border-radius: var(--mc-radius);
  box-shadow: var(--mc-shadow);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.85) translateY(10px);
  opacity: 0;
  pointer-events: none;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s ease;
}

#mc-chat-panel.mc-visible {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header do painel */
.mc-panel-header {
  background: linear-gradient(135deg, var(--mc-green-deep) 0%, var(--mc-green) 100%);
  padding: 18px 20px 22px;
  position: relative;
  color: #fff;
}

.mc-panel-header-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.mc-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.mc-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mc-avatar svg {
  width: 26px;
  height: 26px;
  fill: #fff;
}

.mc-panel-title {
  flex: 1;
}

.mc-panel-title h3 {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.mc-panel-title p {
  margin: 0;
  font-size: 12px;
  color: rgba(255,255,255,0.82);
  display: flex;
  align-items: center;
  gap: 5px;
}

.mc-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a7f3c4;
  display: inline-block;
  animation: mc-blink 1.8s infinite;
}

.mc-panel-header p.mc-subtitle {
  margin: 0;
  font-size: 13px;
  color: rgba(255,255,255,0.9);
  line-height: 1.4;
}

/* Bolha de mensagem no header */
.mc-bubble {
  background: rgba(255,255,255,0.15);
  border-radius: 12px 12px 12px 2px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: #fff;
  line-height: 1.45;
  margin-top: 10px;
}

/* Body do painel */
.mc-panel-body {
  padding: 20px;
}

/* Mensagem de estado */
.mc-state-message {
  display: none;
  text-align: center;
  padding: 8px 0 4px;
}

.mc-state-message.mc-active {
  display: block;
}

.mc-state-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mc-state-icon.mc-success { background: #f0fdf4; }
.mc-state-icon.mc-error   { background: #fef2f2; }

.mc-state-icon svg { width: 28px; height: 28px; }
.mc-state-icon.mc-success svg { fill: var(--mc-green); }
.mc-state-icon.mc-error   svg { fill: #ef4444; }

.mc-state-message h4 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--mc-text-dark);
}

.mc-state-message p {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}

/* Formulário */
.mc-form { display: block; }
.mc-form.mc-hidden { display: none; }

.mc-form-intro {
  font-size: 13.5px;
  color: #4b5563;
  margin: 0 0 16px;
  line-height: 1.5;
}

.mc-field {
  margin-bottom: 14px;
}

.mc-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--mc-text-dark);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

#mc-chat-panel .mc-field input,
#mc-chat-panel .mc-field select {
  width: 100% !important;
  padding: 11px 14px !important;
  border: 1.5px solid #e5e7eb !important;
  border-radius: 10px !important;
  font-size: 14px !important;
  color: #111827 !important;
  background: #f9fafb !important;
  outline: none !important;
  transition: border-color .15s, box-shadow .15s !important;
  box-sizing: border-box !important;
  -webkit-appearance: none !important;
  box-shadow: none !important;
  margin: 0 !important;
}

#mc-chat-panel .mc-field input:focus {
  border-color: var(--mc-green) !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px rgba(37,211,102,0.12) !important;
}

#mc-chat-panel .mc-field input::placeholder { color: #9ca3af; }

/* Botão submit — seletores duplos para sobrepor estilos do tema */
#mc-chat-panel .mc-submit-btn,
#mc-chat-panel button.mc-submit-btn {
  width: 100% !important;
  padding: 13px !important;
  background: var(--mc-green) !important;
  background-color: var(--mc-green) !important;
  color: #fff !important;
  font-size: 14.5px !important;
  font-weight: 700 !important;
  border: none !important;
  border-radius: 10px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  margin-top: 4px !important;
  transition: background .15s, transform .1s !important;
  letter-spacing: .2px !important;
  text-transform: none !important;
  box-shadow: none !important;
  line-height: 1.4 !important;
}

#mc-chat-panel .mc-submit-btn:hover:not(:disabled),
#mc-chat-panel button.mc-submit-btn:hover:not(:disabled) {
  background: var(--mc-green-dark) !important;
  background-color: var(--mc-green-dark) !important;
  color: #fff !important;
}

#mc-chat-panel .mc-submit-btn:active:not(:disabled) {
  transform: scale(.98) !important;
}

#mc-chat-panel .mc-submit-btn:disabled {
  opacity: .7 !important;
  cursor: not-allowed !important;
}

.mc-submit-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
  flex-shrink: 0;
}

/* Spinner de loading */
.mc-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: mc-spin .7s linear infinite;
  flex-shrink: 0;
  display: none;
}

.mc-submit-btn.mc-loading .mc-spinner    { display: block; }
.mc-submit-btn.mc-loading .mc-btn-icon   { display: none; }
.mc-submit-btn.mc-loading .mc-btn-label  { opacity: .8; }

/* Erro inline */
.mc-error-msg {
  display: none;
  color: #dc2626;
  font-size: 12.5px;
  margin-top: 10px;
  padding: 9px 12px;
  background: #fef2f2;
  border-radius: 8px;
  border-left: 3px solid #ef4444;
}

.mc-error-msg.mc-active { display: block; }

/* Footer */
.mc-panel-footer {
  text-align: center;
  padding: 0 20px 16px;
  font-size: 11.5px;
  color: #9ca3af;
}

.mc-panel-footer a {
  color: var(--mc-green-deep);
  text-decoration: none;
}

/* ── Animações ── */
@keyframes mc-pulse {
  0%   { box-shadow: 0 4px 20px rgba(37,211,102,.45); }
  50%  { box-shadow: 0 4px 30px rgba(37,211,102,.75), 0 0 0 8px rgba(37,211,102,.10); }
  100% { box-shadow: 0 4px 20px rgba(37,211,102,.45); }
}

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

@keyframes mc-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

/* ── Responsivo ── */
@media (max-width: 480px) {
  #mc-chat-panel {
    right: 12px;
    bottom: 90px;
    width: calc(100vw - 24px);
  }

  #mc-chat-trigger {
    right: 16px;
    bottom: 16px;
  }
}
