/* Contact CTA modal styles - follows existing modal patterns */

/* Modal overlay with semi-transparent background (matches chat/services modals) */
.contact-modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9999;
  padding: 3rem 2rem;
  overflow-y: auto;
}

/* Success notification overlay */
.contact-success-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Success notification popup */
.contact-success-notification {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 2.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  font-size: 1.15em;
  color: var(--ink);
  text-align: center;
  max-width: 400px;
  animation: slideInFade 0.3s ease-out;
}

@keyframes slideInFade {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.contact-success-notification::before {
  content: '✓';
  display: block;
  font-size: 2.5em;
  color: var(--accent);
  margin-bottom: 0.5rem;
  line-height: 1;
}

.contact-success-title {
  font-size: 1.4em;
  font-weight: 600;
  color: var(--secondary);
  margin: 0 0 0.5rem;
}

.contact-success-message {
  margin: 0;
  line-height: 1.6;
}

/* Dark mode — heavier overlay for contrast against dark pages */
.dark-mode .contact-modal-overlay {
  background: rgba(0, 0, 0, 0.7);
}

.contact-modal-overlay.is-open {
  display: flex;
}

/* Modal dialog container */
.contact-modal {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  position: relative;
  font-size: 1.15em;
  line-height: 1.6;
  padding: 2.5rem 2.5rem 2rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}

/* Modern Mac-style scrollbar for modal */
.contact-modal::-webkit-scrollbar {
  width: 8px;
}

.contact-modal::-webkit-scrollbar-track {
  background: transparent;
}

.contact-modal::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.contact-modal::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
  background-clip: padding-box;
}

body.dark-mode .contact-modal::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  background-clip: padding-box;
}

body.dark-mode .contact-modal::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
  background-clip: padding-box;
}

/* Header */
.contact-header {
  padding: 0 0 24px 0;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.contact-header-image {
  flex-shrink: 0;
  width: 120px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-header-image svg {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
}

.contact-header-text {
  flex: 1;
  min-width: 0;
}

.contact-title {
  font-size: 2em;
  font-weight: 600;
  color: var(--primary);
  margin: 0 0 8px;
}

.contact-subtitle {
  color: var(--ink-muted);
  font-size: 1em;
  margin: 0;
}

.contact-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 400;
  transition: all 0.2s ease;
}

.contact-close:hover {
  background: var(--accent);
  color: var(--bg);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.contact-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Body */
.contact-body {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Section Labels */
.contact-section-label {
  color: var(--ink);
  font-size: 1em;
  font-weight: 600;
  margin-bottom: 12px;
  margin-top: 24px;
}

/* First section label (chips) shouldn't have top margin */
.contact-section-label:first-child {
  margin-top: 0;
}

/* Services Section (collapsible wrapper) */
.contact-services-section {
  position: relative;
}

/* Services labels - show desktop, hide mobile by default */
.contact-services-label-desktop {
  display: block;
}

.contact-services-label-mobile {
  display: none;
}

/* Services Toggle Button (hidden on desktop, shown on mobile) */
.contact-services-toggle {
  display: none;
}

/* Service Chips */
.contact-chip-container {
  display: flex;
  gap: 0.6em;
  flex-wrap: wrap;
}

.contact-service-chip {
  padding: 0.5em 1em;
  border-radius: 1em;
  border: 1px solid var(--secondary);
  background: transparent;
  color: var(--secondary);
  cursor: pointer;
  font-size: 1em;
  white-space: nowrap;
  transition: all 0.2s;
  font-family: inherit;
  position: relative;
  z-index: 1;
}

.contact-service-chip:hover {
  background: var(--secondary);
  color: white;
  transform: translateY(-1px);
  z-index: 10000;
}

.contact-service-chip.selected {
  background: var(--secondary);
  color: white;
}

/* Deselect feedback — accent color signals "click to remove" */
.contact-service-chip.selected:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.contact-service-chip:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

.contact-service-chip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85em;
  white-space: normal;
  width: 200px;
  z-index: 10001;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  animation: tooltip-fade-in 0.2s ease 0.5s forwards;
  opacity: 0;
}

@keyframes tooltip-fade-in {
  to {
    opacity: 1;
  }
}

/* Form Fields */
.contact-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
}

.contact-field-label {
  color: var(--ink);
  font-size: 0.95em;
  font-weight: 600;
}

.contact-field-required::after {
  content: "*";
  color: var(--accent);
  margin-left: 4px;
}

.contact-field-input,
.contact-field-select {
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--surface-variant);
  color: var(--ink);
  border-radius: 6px;
  font-size: 1em;
  font-family: inherit;
  transition: all 0.2s;
}

.contact-field-input:focus,
.contact-field-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

.contact-field-input::placeholder {
  color: var(--ink-muted);
  opacity: 0.7;
}

.contact-textarea {
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--surface-variant);
  color: var(--ink);
  border-radius: 6px;
  font-size: 1em;
  font-family: inherit;
  min-height: 120px;
  resize: vertical;
  transition: all 0.2s;
}

.contact-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

.contact-textarea::placeholder {
  color: var(--ink-muted);
  opacity: 0.7;
}

/* Business Fields Grid */
.contact-business-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

/* Tablet Responsive */
@media (max-width: 1024px) {
  .contact-modal {
    font-size: 1.1em;
  }

  .contact-title {
    font-size: 1.8em;
  }
}

@media (max-width: 767px) {
  /* iOS-style bottom sheet — compound selectors to beat .overlay-shell/.modal-shell */
  .contact-modal-overlay.overlay-shell {
    padding: 0;
    align-items: flex-end;
  }

  .contact-modal.modal-shell {
    width: 100%;
    max-width: none;
    min-width: 0;
    border-radius: 20px 20px 0 0;
    border: none;
    max-height: 90vh;
    overflow-y: auto;
    overscroll-behavior: none;
    padding: 0 1.5rem 2rem;
    box-sizing: border-box;
    flex-shrink: 0;
    scrollbar-width: none;
  }

  .contact-modal.modal-shell::-webkit-scrollbar {
    display: none;
  }

  /* Sticky close button — stays reachable while scrolling */
  .contact-modal.modal-shell .contact-close {
    position: sticky;
    top: 0.75rem;
    right: auto;
    align-self: flex-end;
    flex-shrink: 0;
    z-index: 11;
    margin-top: 0.75rem;
    margin-right: -0.75rem;
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  /* Sticky header — starts transparent, blurs on scroll */
  .contact-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: transparent;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1.5rem 1rem;
    margin: -1.5rem -1.5rem 0;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s;
  }

  .contact-header.contact-header--scrolled {
    background: var(--surface);
    border-bottom-color: var(--border);
  }

  .contact-header-image {
    display: none;
  }

  .contact-title {
    font-size: 1.5em;
    text-align: center;
  }

  .contact-body {
    padding: 0;
    gap: 16px;
  }

  /* Show collapsible toggle button on mobile */
  .contact-services-section {
    margin-bottom: 8px;
  }

  /* Swap labels on mobile */
  .contact-services-label-desktop {
    display: none;
  }

  .contact-services-label-mobile {
    display: block;
  }

  .contact-services-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0 0 8px 0;
    padding: 10px 14px;
    background: var(--surface-variant);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--ink);
    font-size: 0.95em;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
  }

  .contact-services-toggle:hover {
    background: var(--surface);
  }

  .contact-services-toggle-icon {
    transition: transform 0.2s;
    font-size: 0.8em;
  }

  .contact-services-toggle[aria-expanded="true"] .contact-services-toggle-icon {
    transform: rotate(180deg);
  }

  /* Chip container starts collapsed on mobile */
  .contact-chip-container--collapsible {
    max-height: 0;
    overflow: hidden;
    padding: 0;
    background: var(--surface-variant);
    border-radius: 8px;
    transition: max-height 0.3s ease, padding 0.3s ease;
  }

  .contact-chip-container--collapsible.contact-chip-container--expanded {
    max-height: 500px;
    padding: 12px 16px;
  }

  .contact-service-chip {
    font-size: 0.9em;
    padding: 0.4em 0.8em;
  }

  .contact-chip-container {
    gap: 0.5em;
  }

  .contact-business-fields {
    grid-template-columns: 1fr;
  }
}

/* Submit Button */
.contact-submit {
  padding: 14px 28px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  font-weight: 700;
  font-size: 1.1em;
  font-family: inherit;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin-top: 24px;
}

.contact-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--shadow);
}

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

.contact-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.contact-submit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Submit + mailto row */
.contact-submit-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.contact-submit-row .contact-submit {
  margin-top: 0;
}

.contact-mailto-inline {
  color: var(--ink-muted);
  font-size: 0.9em;
}

/* Legacy mailto section (kept for DG / fallback) */
.contact-mailto-section {
  text-align: center;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.contact-mailto-section p {
  color: var(--ink-muted);
  margin: 0 0 8px;
  font-size: 0.95em;
}

.contact-mailto-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 1em;
  transition: all 0.2s;
}

.contact-mailto-link:hover {
  text-decoration: underline;
  color: var(--secondary);
}

.contact-mailto-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Success/Error Messages */
.contact-message {
  padding: 16px;
  border-radius: 8px;
  font-size: 1em;
  line-height: 1.6;
}

.contact-message--success {
  background: rgba(var(--secondary-rgb), 0.1);
  border: 1px solid rgba(var(--secondary-rgb), 0.3);
  color: var(--ink);
}

.contact-message--error {
  background: rgba(245, 166, 35, 0.1);
  border: 1px solid rgba(245, 166, 35, 0.3);
  color: var(--ink);
}

/* Hidden utility */
.contact-hidden {
  display: none !important;
}

/* Anti-spam honeypot (visually hidden) */
.contact-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Mobile Landscape - Override to horizontal layout */
@media (max-width: 767px) and (orientation: landscape) {
  .contact-header {
    flex-direction: row;
    align-items: flex-start;
  }

  .contact-title {
    text-align: left;
  }
}

/* ── TS Slideout Panel ─────────────────────────────── *
 * Right-edge slide-in panel for Tsunami Swami only.
 * Key fix: resets font-size to 1em (modal-shell inflates to 1.35em)
 * so all em-based values stay at their intended sizes.
 *
 *   768px  → 85vw  (scroll acceptable on tablets)
 *   1024px → 75vw  (3 chip rows, no scroll on 1080p)
 *   1440px → 55vw  (comfortable)
 *   1920px → 42vw  (balanced)
 */

/* Base slideout — everything above mobile */
@media (min-width: 768px) {
  .contact-modal-overlay[data-brand="Tsunami Swami"] {
    justify-content: flex-end;
    padding: 0;
  }

  .contact-modal-overlay[data-brand="Tsunami Swami"] .contact-modal {
    height: 100vh;
    max-height: 100vh;
    width: 85vw;
    max-width: none;
    border-radius: 16px 0 0 16px;
    border: none;
    border-left: 1px solid var(--border);
    font-size: 1em;
    padding: 1.5rem 2.5rem 1.5rem;
    box-sizing: border-box;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }

  .contact-modal-overlay[data-brand="Tsunami Swami"].is-open .contact-modal {
    transform: translateX(0);
  }

  /* Header — force row layout (hero-header goes column at ≤768px) */
  .contact-modal-overlay[data-brand="Tsunami Swami"] .contact-header {
    flex-direction: row;
    padding-bottom: 16px;
    gap: 14px;
    align-items: center;
  }

  .contact-modal-overlay[data-brand="Tsunami Swami"] .contact-header-image {
    width: 115px;
    height: 62px;
  }

  .contact-modal-overlay[data-brand="Tsunami Swami"] .contact-title {
    font-size: 1.9em;
    margin-bottom: 2px;
  }

  .contact-modal-overlay[data-brand="Tsunami Swami"] .contact-subtitle {
    font-size: 0.95em;
  }

  /* Body — comfortable spacing */
  .contact-modal-overlay[data-brand="Tsunami Swami"] .contact-body {
    gap: 18px;
    flex: 1;
  }

  /* Section labels */
  .contact-modal-overlay[data-brand="Tsunami Swami"] .contact-section-label {
    margin-top: 12px;
    margin-bottom: 10px;
  }

  /* Field groups */
  .contact-modal-overlay[data-brand="Tsunami Swami"] .contact-field-group {
    margin-bottom: 16px;
  }

  /* Email — constrain width */
  .contact-modal-overlay[data-brand="Tsunami Swami"] #contact-email {
    max-width: 400px;
  }

  /* Textarea */
  .contact-modal-overlay[data-brand="Tsunami Swami"] .contact-textarea {
    min-height: 110px;
  }

  /* Business fields — all three side by side */
  .contact-modal-overlay[data-brand="Tsunami Swami"] .contact-business-fields {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
  }

  /* Submit row */
  .contact-modal-overlay[data-brand="Tsunami Swami"] .contact-submit-row {
    margin-top: 16px;
  }

  /* Close button — ghost pill with thick arrow */
  .contact-modal-overlay[data-brand="Tsunami Swami"] .contact-close {
    border-radius: 999px;
    border: 1.5px solid var(--secondary);
    background: transparent;
    color: var(--secondary);
    width: auto;
    height: auto;
    padding: 8px 20px;
    font-size: 1.2em;
    font-weight: 700;
    -webkit-text-stroke: 0.5px currentColor;
  }

  .contact-modal-overlay[data-brand="Tsunami Swami"] .contact-close:hover {
    background: var(--secondary);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
}

@media (min-width: 1024px) {
  .contact-modal-overlay[data-brand="Tsunami Swami"] .contact-modal {
    width: 75vw;
  }
}

@media (min-width: 1440px) {
  .contact-modal-overlay[data-brand="Tsunami Swami"] .contact-modal {
    width: 55vw;
  }
}

@media (min-width: 1920px) {
  .contact-modal-overlay[data-brand="Tsunami Swami"] .contact-modal {
    width: 42vw;
  }
}
