/* Standalone contact form. No WordPress header, so the page itself fills the viewport. */
:root {
  --bg: #ffffff;
  --text: #222222;
  --text-rgb: 34, 34, 34;
  --link: #0066cc;
  --link-rgb: 0, 102, 204;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --text: #eeeeee;
    --text-rgb: 238, 238, 238;
    --link: #66aaff;
    --link-rgb: 102, 170, 255;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  padding: 0.45rem 1.25rem 0.5rem;
  overflow: hidden;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

html.iframe-embedded body {
  height: 100dvh;
  min-height: 0;
  padding: 0.75rem;
  overflow: hidden;
}

.modern-contact-form-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
}

.iframe-embedded .modern-contact-form-container {
  padding-top: 3.25rem;
  min-height: 0;
}

.iframe-fulllink .modern-contact-form-container {
  padding-top: 0.75rem;
}

.iframe-fulllink .back-to-form-button {
  display: none !important;
}

.cancel-button.iframe-cancel-button {
  background: #dc2626;
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.35);
}

.cancel-button.iframe-cancel-button:hover {
  background: #b91c1c;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.45);
}

.cancel-button.iframe-cancel-button:active {
  transform: translateY(0);
}

.iframe-embedded .submit-row {
  width: 100%;
}

.iframe-embedded .button-group {
  flex: 1;
  justify-content: space-between;
}

.iframe-mobile {
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

.iframe-mobile body {
  width: 100%;
  margin: 0;
}

.iframe-mobile .modern-contact-form-container {
  max-width: 100%;
  margin: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
  min-height: 100vh;
  padding: calc(1.15rem + env(safe-area-inset-top)) calc(1rem + env(safe-area-inset-right)) calc(1.5rem + env(safe-area-inset-bottom)) calc(1rem + env(safe-area-inset-left));
}

.iframe-mobile .contact-form-header {
  margin-bottom: 1rem;
}

.iframe-mobile .contact-form-title {
  font-size: 1.75rem;
}

.iframe-mobile .form-required-note {
  position: static;
  text-align: right;
  margin-bottom: 0.75rem;
  pointer-events: auto;
}

.iframe-mobile .required-field-description {
  font-size: 0.95rem;
}

.iframe-mobile .form-grid {
  grid-template-columns: 1fr;
  gap: 1rem;
}

.iframe-mobile .form-group label,
.iframe-mobile .password-field-group label {
  font-size: 0.85rem;
}

.iframe-mobile .form-group input,
.iframe-mobile .form-group textarea,
.iframe-mobile .password-field-group input {
  padding: 0.9rem 1rem;
  font-size: 1.0625rem;
}

.iframe-mobile .consent-label {
  font-size: 1rem;
}

.iframe-mobile .consent-checkbox-group input[type="checkbox"] {
  width: 1.35rem;
  height: 1.35rem;
}

.iframe-mobile .mobile-only {
  display: flex;
}

.iframe-mobile .modern-contact-form {
  gap: 1rem;
}

.iframe-mobile .submit-row {
  flex-direction: column;
  gap: 0.85rem;
  align-items: stretch;
}

.iframe-mobile .button-group {
  flex-direction: column;
  gap: 0.75rem;
  margin-left: 0;
  width: 100%;
}

.iframe-mobile .cancel-button,
.iframe-mobile .submit-button {
  width: 100%;
  justify-content: center;
  padding: 0.95rem 1.25rem;
  min-height: 3rem;
  font-size: 1rem;
}

.iframe-mobile .download-container {
  padding: 1.5rem;
  max-width: 340px;
}

.iframe-mobile .download-title {
  font-size: 1.15rem;
}

.iframe-mobile .download-subtitle {
  font-size: 0.8rem;
}

.iframe-mobile .download-button {
  width: 100%;
  justify-content: center;
  padding: 0.7rem 1rem;
  min-height: 44px;
}

.contact-form-header {
  text-align: center;
  margin-bottom: 0.65rem;
  flex-shrink: 0;
}

.contact-form-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
  line-height: 1.15;
  background: linear-gradient(135deg, var(--link) 0%, var(--link-rgb) 100%);
}

.contact-form-subtitle {
  font-size: 1.2rem;
  color: var(--text);
  opacity: 0.8;
  line-height: 1.4;
  max-width: 40rem;
  margin: 0 auto;
  display:none;
}

.modern-contact-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

/* Required field description */
.form-required-note {
  position: static;
  text-align: right;
  margin: 0 0 0.5rem;
  z-index: 1;
  pointer-events: none;
  line-height: 1.4;
  flex-shrink: 0;
}

.required-field-description {
  font-size: 1rem;
  color: var(--text);
  opacity: 0.9;
  margin: 0;
  font-style: normal;
  font-weight: 500;
  display: inline-block;
  white-space: nowrap;
}

.required-asterisk {
  color: var(--text);
  font-weight: 900;
  font-style: normal;
  margin-right: 0.3rem;
  font-size: 1.15rem;
  opacity: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.9rem 1.5rem;
  flex-shrink: 0;
}

@media (max-width: 1100px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.mobile-only {
  display: none;
}

.form-group.full-width {
  grid-column: 1 / -1;
  flex-shrink: 0;
}

/* Full QR code section styles */
.qr-code-full-section {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  animation: fadeIn 0.3s ease-out;
}

.qr-code-container {
  text-align: center;
  /*max-width: 400px;*/
  padding: 2rem;
}

/* Download section styles */
.download-full-section {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  animation: fadeIn 0.3s ease-out;
}

.download-container {
  text-align: center;
  padding: 2rem;
  max-width: 420px;
}

.download-header {
  margin-bottom: 1.5rem;
}

.download-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.4rem;
  background: linear-gradient(135deg, var(--link) 0%, var(--link-rgb) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.download-subtitle {
  font-size: 0.9rem;
  color: var(--text);
  opacity: 0.85;
  line-height: 1.4;
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
}

.download-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--link) 0%, rgba(var(--link-rgb), 0.8) 100%);
  color: var(--bg);
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(var(--link-rgb), 0.3);
}

.download-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(var(--link-rgb), 0.4);
}

/* QR section notification styles */
#qr-notification {
  margin-bottom: 1.5rem;
  border-radius: 6px;
  overflow: hidden;
  animation: slideDown 0.3s ease-out;
}

#qr-notification.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 1px solid #10b981;
}

#qr-notification.error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border: 1px solid #ef4444;
}

.qr-code-header {
  margin-bottom: 2rem;
}

.qr-code-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--link) 0%, var(--link-rgb) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.qr-code-subtitle {
  font-size: 0.9rem;
  color: var(--text);
  opacity: 0.8;
  line-height: 1.4;
}

.qr-code-image {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1.5rem 0;
}

.qr-code-image img {
  max-width: 200px;
  width: 200px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(var(--text-rgb), 0.1);
}

.qr-code-status {
  text-align: center;
  margin: 1rem 0;
  font-size: 0.8rem;
  color: var(--text);
  opacity: 0.8;
}

.qr-code-actions {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
}

.back-to-form-button,
.close-posted-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: var(--text);
  border: 1.5px solid rgba(var(--text-rgb), 0.3);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-family: inherit;
}

.back-to-form-button:hover,
.close-posted-button:hover {
  background: rgba(var(--text-rgb), 0.1);
  border-color: rgba(var(--text-rgb), 0.5);
  transform: translateY(-1px);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.form-group label {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  opacity: 0.9;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.72rem 1rem;
  border: 2px solid rgba(var(--text-rgb), 0.2);
  border-radius: 8px;
  font-size: 1.15rem;
  transition: all 0.3s ease;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 2px rgba(var(--link-rgb), 0.1);
  transform: translateY(-1px);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text);
  opacity: 0.5;
  font-style: italic;
}

.form-group textarea {
  resize: vertical;
  min-height: 3.25rem;
  line-height: 1.45;
}

.form-group.message-field {
  flex: 1 1 auto;
  min-height: 6.5rem;
  overflow: hidden;
}

.form-group.message-field textarea {
  flex: 1 1 0;
  min-height: 0;
  height: auto;
  resize: none;
}

/* Consent section styles */
.consent-section {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
}

.consent-checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}

.consent-checkbox-group input[type="checkbox"] {
  margin: 0;
  margin-top: 0.15rem;
  flex-shrink: 0;
  width: 1.45rem;
  height: 1.45rem;
  accent-color: var(--link);
}

.consent-label {
  font-size: 1.08rem;
  line-height: 1.45;
  color: var(--text);
  opacity: 0.9;
  cursor: pointer;
  user-select: none;
}

.consent-label:hover {
  opacity: 1;
}

/* Notification styles */
.form-notification {
  margin: 0.75rem 0;
  border-radius: 6px;
  overflow: hidden;
  animation: slideDown 0.3s ease-out;
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.form-notification.fade-out {
  opacity: 0;
  transform: translateY(-10px);
}

.form-notification.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 1px solid #10b981;
}

.form-notification.error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border: 1px solid #ef4444;
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: white;
}

.notification-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-text {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.4;
}

.notification-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 3px;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

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

.form-submit {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-shrink: 0;
  margin-top: 0.25rem;
}

.submit-row {
  display: flex;
  align-items: end;
  gap: 1.25rem;
  justify-content: flex-start;
}

.password-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 220px;
}

.password-field-group label {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  opacity: 0.9;
}

.password-field-group input {
  width: 100%;
  padding: 0.72rem 1rem;
  border: 2px solid rgba(var(--text-rgb), 0.2);
  border-radius: 8px;
  font-size: 1.15rem;
  transition: all 0.3s ease;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.password-field-group input:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 2px rgba(var(--link-rgb), 0.1);
  transform: translateY(-1px);
}

.password-field-group input::placeholder {
  color: var(--text);
  opacity: 0.5;
  font-style: italic;
}

.iframe-mobile .password-field-group {
  display: none;
}

.button-group {
  display: flex;
  gap: 1rem;
  margin-left: auto;
}

.iframe-mobile .submit-row {
  align-items: stretch;
}

.cancel-button {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.8rem 1.45rem;
  background: transparent;
  color: var(--text);
  border: 2px solid rgba(var(--text-rgb), 0.3);
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.cancel-button:hover {
  background: rgba(var(--text-rgb), 0.1);
  border-color: rgba(var(--text-rgb), 0.5);
  transform: translateY(-1px);
}

/* Iframe close button positioning */
.iframe-close-button {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.iframe-close-button:hover {
  opacity: 1;
  background: rgba(var(--text-rgb), 0.08);
}

.iframe-close-button:active {
  background: rgba(var(--text-rgb), 0.12);
}

.iframe-close-button svg {
  width: 20px;
  height: 20px;
}

.iframe-mobile .iframe-close-button {
  display: none !important;
}

.submit-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.6rem;
  background: linear-gradient(135deg, var(--link) 0%, rgba(var(--link-rgb), 0.8) 100%);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(var(--link-rgb), 0.3);
}

.submit-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(var(--link-rgb), 0.4);
}

.submit-button:active {
  transform: translateY(0);
}

.submit-button svg,
.cancel-button svg {
  transition: transform 0.3s ease;
  width: 18px;
  height: 18px;
}

.submit-button:hover svg {
  transform: translateX(2px);
}

/* Mobile layout: single column, full width, readable type */
@media (max-width: 768px) {
  body,
  html.iframe-embedded body,
  html.iframe-mobile body {
    height: auto;
    min-height: 100dvh;
    padding: 0;
    overflow: visible;
  }

  .modern-contact-form-container {
    width: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: calc(1.15rem + env(safe-area-inset-top)) calc(1rem + env(safe-area-inset-right)) calc(1.5rem + env(safe-area-inset-bottom)) calc(1rem + env(safe-area-inset-left));
    border: none;
    border-radius: 0;
    box-shadow: none;
    min-height: 100%;
    overflow: visible;
  }

  .iframe-embedded .modern-contact-form-container {
    padding-top: calc(3rem + env(safe-area-inset-top));
    min-height: 100dvh;
  }
  
  .contact-form-header {
    margin-bottom: 1rem;
  }

  .contact-form-title {
    font-size: 1.75rem;
  }
  
  .contact-form-subtitle {
    font-size: 1rem;
    max-width: none;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .modern-contact-form {
    gap: 1rem;
  }
  
  .form-required-note {
    margin-bottom: 0.75rem;
  }
  
  .required-field-description {
    font-size: 0.95rem;
  }

  .required-asterisk {
    font-size: 1.05rem;
  }
  
  .qr-code-container {
    padding: 1.25rem;
    max-width: 100%;
  }
  
  .qr-code-title {
    font-size: 1.5rem;
  }
  
  .qr-code-subtitle {
    font-size: 1rem;
  }
  
  .qr-code-image img {
    max-width: 180px;
    width: 180px;
  }
  
  .qr-code-actions,
  .download-actions {
    flex-direction: column;
    width: 100%;
  }

  .back-to-form-button,
  .close-posted-button {
    width: 100%;
    justify-content: center;
    padding: 0.85rem 1.25rem;
    font-size: 1rem;
  }
  
  #qr-notification {
    margin-bottom: 1rem;
  }

  .form-group label,
  .password-field-group label {
    font-size: 0.85rem;
  }
  
  .form-group input,
  .form-group textarea,
  .password-field-group input {
    padding: 0.9rem 1rem;
    font-size: 1.0625rem;
  }

  .form-group textarea,
  .form-group.message-field,
  .form-group.message-field textarea {
    min-height: 7rem;
  }
  
  .form-submit {
    gap: 0.85rem;
  }
  
  .submit-row {
    flex-direction: column;
    gap: 0.85rem;
    align-items: stretch;
  }
  
  .password-field-group {
    min-width: 0;
    width: 100%;
  }
  
  .button-group {
    flex-direction: column;
    gap: 0.75rem;
    margin-left: 0;
    width: 100%;
  }
  
  .cancel-button,
  .submit-button {
    width: 100%;
    justify-content: center;
    padding: 0.95rem 1.25rem;
    min-height: 3rem;
    font-size: 1rem;
  }
  
  .consent-section {
    margin: 0;
    padding: 0;
    gap: 1rem;
  }

  .consent-checkbox-group input[type="checkbox"] {
    width: 1.35rem;
    height: 1.35rem;
  }
  
  .consent-label {
    font-size: 1rem;
    line-height: 1.4;
  }
  
  .form-notification {
    margin: 0.5rem 0;
  }
  
  .notification-content {
    padding: 0.85rem 1rem;
    gap: 0.65rem;
  }
  
  .notification-text {
    font-size: 1rem;
  }
}

/* Loading state */
.submit-button.loading {
  opacity: 0.7;
  cursor: not-allowed;
}

.submit-button.loading svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Success/Error states */
.form-group.success input,
.form-group.success textarea {
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

.form-group.error input,
.form-group.error textarea {
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1);
}

/* Smooth animations */
.modern-contact-form-container {
  animation: fadeInUp 0.3s ease-out;
}

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

/* Dark mode specific adjustments */
@media (prefers-color-scheme: dark) {
  .form-group input,
  .form-group textarea {
    background: rgba(var(--text-rgb), 0.05);
    border-color: rgba(var(--text-rgb), 0.3);
  }
  
  .form-group input:focus,
  .form-group textarea:focus {
    background: rgba(var(--text-rgb), 0.1);
  }
}

/* Light mode specific adjustments */
@media (prefers-color-scheme: light) {
  .form-group input,
  .form-group textarea {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(var(--text-rgb), 0.2);
  }
  
  .form-group input:focus,
  .form-group textarea:focus {
    background: rgba(255, 255, 255, 1);
  }
}
