/* ========== MESH CHAT + CONTACT FORM ========== */

/* Botão CTA no nav */
.mesh-cta-chat {
  background: transparent;
  color: var(--text-1, #FAFAFA);
  padding: 10px 16px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid var(--border-light, #333);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mesh-cta-chat:hover {
  border-color: var(--accent, #B4FF39);
  color: var(--accent, #B4FF39);
  background: rgba(180, 255, 57, 0.05);
}

.mesh-cta-chat svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 1024px) {
  .mesh-cta-chat {
    display: none;
  }
}

/* Modal overlay */
.mesh-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.mesh-modal-overlay.active {
  display: flex;
  opacity: 1;
}

/* Modal container base */
.mesh-modal {
  background: #0A0A0A;
  border: 1px solid #262626;
  border-radius: 20px;
  width: 100%;
  max-width: 880px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 80px rgba(180, 255, 57, 0.08);
  animation: meshModalIn 0.25s ease-out;
}

@keyframes meshModalIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.mesh-chat-modal {
  height: 85vh;
  max-width: 880px;
}

.mesh-form-modal {
  max-width: 560px;
}

/* Modal header */
.mesh-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #262626;
  flex-shrink: 0;
}

.mesh-chat-header-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mesh-chat-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.mesh-chat-avatar svg {
  width: 100%;
  height: 100%;
  display: block;
}

.mesh-chat-title {
  font-size: 16px;
  font-weight: 700;
  color: #FAFAFA;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.mesh-chat-subtitle {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: #A3A3A3;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mesh-chat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #B4FF39;
  box-shadow: 0 0 8px rgba(180, 255, 57, 0.6);
  animation: meshPulse 1.8s infinite;
}

@keyframes meshPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.mesh-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #FAFAFA;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.mesh-modal-subtitle {
  font-size: 14px;
  color: #A3A3A3;
  line-height: 1.4;
}

.mesh-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mesh-modal-action,
.mesh-modal-close {
  background: transparent;
  border: none;
  color: #A3A3A3;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.mesh-modal-action:hover,
.mesh-modal-close:hover {
  background: #161616;
  color: #FAFAFA;
}

/* Chat messages */
.mesh-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

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

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

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

.mesh-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #333;
}

.mesh-msg {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: meshMsgIn 0.2s ease-out;
}

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

.mesh-msg-user {
  align-self: flex-end;
  background: #B4FF39;
  color: #0A0A0A;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.mesh-msg-assistant {
  align-self: flex-start;
  background: #161616;
  color: #FAFAFA;
  border: 1px solid #262626;
  border-bottom-left-radius: 4px;
}

.mesh-msg-assistant strong { color: #B4FF39; font-weight: 600; }
.mesh-msg-assistant em { color: #FAFAFA; font-style: italic; }
.mesh-msg-assistant code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  background: #1C1C1C;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #262626;
  color: #B4FF39;
}
.mesh-msg-assistant a {
  color: #B4FF39;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.mesh-msg-assistant a:hover { opacity: 0.8; }
.mesh-msg-assistant ul {
  margin: 6px 0 6px 0;
  padding-left: 20px;
}
.mesh-msg-assistant li {
  margin: 2px 0;
}
.mesh-msg-assistant > *:first-child { margin-top: 0; }
.mesh-msg-assistant > *:last-child { margin-bottom: 0; }

.mesh-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent, #B4FF39);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: meshCursorBlink 1s steps(2) infinite;
  border-radius: 1px;
}

@keyframes meshCursorBlink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

.mesh-msg-thinking {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 16px;
}

.mesh-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #A3A3A3;
  animation: meshDotPulse 1.4s infinite ease-in-out both;
}

.mesh-dot:nth-child(1) { animation-delay: -0.32s; }
.mesh-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes meshDotPulse {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Chat form */
.mesh-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 20px 20px;
  border-top: 1px solid #262626;
  background: #0A0A0A;
  flex-shrink: 0;
}

.mesh-chat-form textarea {
  flex: 1;
  background: #161616;
  border: 1px solid #262626;
  color: #FAFAFA;
  font-family: inherit;
  font-size: 15px;
  padding: 12px 16px;
  border-radius: 12px;
  resize: none;
  line-height: 1.4;
  max-height: 140px;
  transition: border-color 0.2s ease;
  outline: none;
}

.mesh-chat-form textarea:focus {
  border-color: #B4FF39;
}

.mesh-chat-form textarea:disabled {
  opacity: 0.5;
}

.mesh-chat-form textarea::placeholder {
  color: #737373;
}

.mesh-chat-form button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #B4FF39;
  color: #0A0A0A;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.mesh-chat-form button:hover {
  background: #C4FF55;
  box-shadow: 0 0 16px rgba(180, 255, 57, 0.4);
}

.mesh-chat-form button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mesh-chat-privacy {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: #737373;
  text-align: center;
  padding: 0 20px 12px;
  background: #0A0A0A;
}

/* Contact form */
.mesh-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.mesh-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mesh-form label span {
  font-size: 12px;
  color: #A3A3A3;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.mesh-form input,
.mesh-form textarea {
  background: #161616;
  border: 1px solid #262626;
  color: #FAFAFA;
  font-family: inherit;
  font-size: 15px;
  padding: 12px 14px;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s ease;
}

.mesh-form input:focus,
.mesh-form textarea:focus {
  border-color: #B4FF39;
}

.mesh-form textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  line-height: 1.5;
}

.mesh-form-submit {
  background: #B4FF39;
  color: #0A0A0A;
  padding: 14px 20px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 15px;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
}

.mesh-form-submit:hover {
  background: #C4FF55;
  box-shadow: 0 0 24px rgba(180, 255, 57, 0.4);
}

.mesh-form-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.mesh-form-status {
  text-align: center;
  font-size: 14px;
  margin-top: 4px;
  min-height: 20px;
}

.mesh-form-status-success {
  color: #B4FF39;
}

.mesh-form-status-error {
  color: #ff7373;
}

/* Mobile adjustments — chat permanece desktop only por escolha */
@media (max-width: 768px) {
  .mesh-modal-overlay {
    padding: 12px;
  }

  .mesh-modal {
    max-height: 92vh;
    border-radius: 16px;
  }

  .mesh-chat-modal {
    display: none; /* Chat só em desktop */
  }

  .mesh-modal-header {
    padding: 16px 20px;
  }

  .mesh-form {
    padding: 20px;
  }
}
