/* =========================================================
   Transacta Brokers — Luxury Contact Modal Component
   Matches Marbella Gold & Deep Obsidian aesthetic
========================================================= */

.tb-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

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

.tb-modal-window {
  position: relative;
  width: 100%;
  max-width: 34rem;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  background: #0d0d0a;
  border: 1px solid rgba(201, 168, 76, 0.38);
  border-radius: 1rem;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.95), 0 0 45px rgba(201, 168, 76, 0.12);
  padding: 2.25rem 2rem 2rem;
  transform: scale(0.95) translateY(8px);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  color: #f0ece0;
  font-family: 'Jost', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.tb-modal-backdrop.tb-modal--open .tb-modal-window {
  transform: scale(1) translateY(0);
}

/* Close Button */
.tb-modal-close {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: #9a9180;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.18s;
  padding: 0;
  z-index: 2;
}

.tb-modal-close:hover {
  background: rgba(201, 168, 76, 0.15);
  border-color: #c9a84c;
  color: #c9a84c;
  transform: scale(1.05);
}

.tb-modal-close:focus-visible {
  outline: 2px solid #c9a84c;
  outline-offset: 2px;
}

/* Header */
.tb-modal-header {
  margin-bottom: 1.5rem;
  text-align: left;
  padding-right: 2rem;
}

.tb-modal-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #c9a84c;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.tb-modal-label::before {
  content: '';
  display: inline-block;
  width: 1.25rem;
  height: 1px;
  background: #c9a84c;
}

.tb-modal-title {
  font-family: 'Cormorant Garamond', 'Georgia', serif;
  font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem);
  line-height: 1.15;
  color: #f0ece0;
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.tb-modal-subtitle {
  font-size: 0.875rem;
  color: #9a9180;
  line-height: 1.5;
  margin: 0;
}

/* Form Styles */
.tb-modal-form {
  position: relative;
  text-align: left;
}

.tb-modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

@media (max-width: 480px) {
  .tb-modal-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .tb-modal-window {
    padding: 1.75rem 1.25rem 1.5rem;
  }
}

.tb-modal-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.95rem;
}

.tb-modal-field label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9a9180;
}

.tb-modal-req {
  color: #c9a84c;
  font-weight: 700;
}

.tb-modal-opt {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: #6a6456;
}

.tb-modal-form input[type="text"],
.tb-modal-form input[type="email"],
.tb-modal-form input[type="tel"],
.tb-modal-form select,
.tb-modal-form textarea {
  width: 100%;
  appearance: none;
  background: #141410;
  color: #f0ece0;
  border: 1px solid rgba(201, 168, 76, 0.28);
  border-radius: 0.65rem;
  padding: 0.78rem 0.95rem;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  box-sizing: border-box;
}

.tb-modal-form textarea {
  min-height: 6.5rem;
  resize: vertical;
}

.tb-modal-form select {
  background-image: linear-gradient(45deg, transparent 50%, #c9a84c 50%),
    linear-gradient(135deg, #c9a84c 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2.25rem;
  cursor: pointer;
}

.tb-modal-form input::placeholder,
.tb-modal-form textarea::placeholder {
  color: #5a5548;
}

.tb-modal-form input:hover,
.tb-modal-form select:hover,
.tb-modal-form textarea:hover {
  border-color: #c9a84c;
}

.tb-modal-form input:focus,
.tb-modal-form select:focus,
.tb-modal-form textarea:focus {
  outline: none;
  border-color: #c9a84c;
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.22);
  background: #1a1a14;
}

.tb-modal-form input[aria-invalid="true"],
.tb-modal-form select[aria-invalid="true"],
.tb-modal-form textarea[aria-invalid="true"] {
  border-color: #c45c4a;
  box-shadow: 0 0 0 3px rgba(196, 92, 74, 0.18);
}

.tb-modal-error {
  font-size: 0.75rem;
  color: #e08a7a;
  min-height: 0;
}

/* Honeypot field (hidden from humans) */
.tb-modal-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Submit Button */
.tb-modal-submit {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  padding: 0.9rem 1.5rem;
  background: #c9a84c;
  color: #000000;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 0.65rem;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s, box-shadow 0.18s;
  box-shadow: 0 4px 18px rgba(201, 168, 76, 0.28);
}

.tb-modal-submit:hover:not(:disabled) {
  background: #dbbe62;
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(201, 168, 76, 0.38);
}

.tb-modal-submit:active:not(:disabled) {
  transform: translateY(0);
}

.tb-modal-submit:disabled {
  opacity: 0.65;
  cursor: wait;
  box-shadow: none;
}

.tb-modal-hint {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: #6a6456;
  text-align: center;
  line-height: 1.45;
}

.tb-modal-hint a {
  color: #c9a84c;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tb-modal-status {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: #e08a7a;
  text-align: center;
  min-height: 1.25em;
}

/* Success Card */
.tb-modal-success {
  text-align: center;
  padding: 1.5rem 0.5rem;
}

.tb-modal-success[hidden] {
  display: none !important;
}

.tb-modal-success-icon {
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(201, 168, 76, 0.18);
  border: 1px solid rgba(201, 168, 76, 0.4);
  color: #c9a84c;
}

.tb-modal-success h3 {
  font-family: 'Cormorant Garamond', 'Georgia', serif;
  font-size: 1.85rem;
  margin: 0 0 0.6rem;
  color: #f0ece0;
}

.tb-modal-success p {
  margin: 0 auto 1.5rem;
  color: #9a9180;
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 32ch;
}

.tb-modal-direct {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
}

.tb-modal-direct a {
  color: #c9a84c;
  font-weight: 500;
  font-size: 0.85rem;
  text-decoration: none;
}

.tb-modal-direct a:hover {
  text-decoration: underline;
}
