.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(6, 13, 30, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.32s ease, visibility 0.32s ease;
}

[data-theme="dark"] .modal-overlay {
  background: rgba(4, 8, 20, 0.85);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  position: relative;
  width: 90%;
  max-width: 700px;
  max-height: 88dvh;
  margin: 0;
  overflow-y: auto;
  border-radius: 28px;
  background: var(--bg);
  border: 1px solid var(--border-s);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.04);
  transform: translateY(32px) scale(0.96);
  transition: transform 0.38s cubic-bezier(0.22, 0.68, 0, 1.2);
  scrollbar-width: thin;
  scrollbar-color: var(--accent-soft) transparent;
}

.modal-box::-webkit-scrollbar {
  width: 4px;
}

.modal-box::-webkit-scrollbar-thumb {
  background: var(--border-s);
  border-radius: 4px;
}

.modal-overlay.open .modal-box {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: clamp(1.5rem, 4vw, 2rem) clamp(1.25rem, 4vw, 2rem) 0;
}

.modal-header-text .modal-label {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.45rem;
}

.modal-header-text h2 {
  font-family: "Sora", sans-serif;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  margin: 0;
}

.modal-header-text p {
  font-size: clamp(0.8rem, 2vw, 0.85rem);
  color: var(--muted);
  margin: 0.4rem 0 0;
}

.modal-close {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-s);
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.22s, color 0.22s, border-color 0.22s, transform 0.22s;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #ef4444;
  transform: rotate(90deg);
}

.modal-body {
  padding: clamp(1.25rem, 3vw, 1.75rem) clamp(1.25rem, 4vw, 2rem) clamp(1.5rem, 4vw, 2rem);
}

.modal-body .contact-form {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.fab-orcamento {
  position: fixed;
  bottom: clamp(1.25rem, 3vw, 2rem);
  right: clamp(1.25rem, 3vw, 2rem);
  z-index: 8000;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: clamp(0.78rem, 2vw, 0.9rem) clamp(1.1rem, 3vw, 1.5rem);
  background: linear-gradient(135deg, var(--accent), #5b7ff5);
  color: #fff;
  font-family: inherit;
  font-size: clamp(0.82rem, 2vw, 0.88rem);
  font-weight: 700;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(59, 124, 244, 0.5);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  white-space: nowrap;
  position: fixed;
  overflow: hidden;
}

.fab-orcamento::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.fab-orcamento:hover::before {
  transform: translateX(100%);
}

.fab-orcamento:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 14px 40px rgba(59, 124, 244, 0.6);
}

.fab-orcamento .fab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: fab-pulse 2s ease infinite;
  flex-shrink: 0;
}

@keyframes fab-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  60% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
}

.fab-orcamento.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

@media (max-width: 600px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-box {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
  }

  .modal-overlay.open .modal-box {
    transform: translateY(0);
  }

  .fab-orcamento {
    bottom: 1rem;
    right: 1rem;
    font-size: 0.8rem;
    padding: 0.7rem 1.1rem;
  }
}

@media (max-width: 360px) {
  .fab-orcamento span:not(.fab-dot) {
    display: none;
  }

  .fab-orcamento {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    justify-content: center;
  }

  .fab-orcamento .fab-dot {
    margin: 0;
    width: 12px;
    height: 12px;
  }
}
