/**
 * Orpical Feedback Manager — Front-end Styles
 * Theme-independent. Button colors are injected via JS inline styles from settings.
 */

/* Launcher */
.ofm-launcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9998;
}

.ofm-launcher--bottom-left {
  right: auto;
  left: 20px;
}

.ofm-trigger {
  appearance: none;
  border: 0;
  border-radius: 999px; /* overridden dynamically */
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  padding: 13px 20px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: opacity 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.ofm-trigger:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.ofm-trigger:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Modal */
.ofm-modal[hidden] {
  display: none;
}

.ofm-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.ofm-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.ofm-modal__dialog {
  position: relative;
  width: min(92vw, 540px);
  margin: 8vh auto 0;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  padding: 28px;
  animation: ofm-slide-in 200ms ease;
}

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

.ofm-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 0;
  background: #f3f4f6;
  border-radius: 50%;
  color: #374151;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms ease;
}

.ofm-modal__close:hover {
  background: #e5e7eb;
}

/* Form */
.ofm-form__title {
  margin: 0 0 20px;
  font-size: 22px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

.ofm-form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.ofm-form__field {
  margin-bottom: 14px;
}

.ofm-form__field label {
  display: block;
  margin-bottom: 5px;
  color: #111827;
  font-size: 13px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

.ofm-form__field input,
.ofm-form__field textarea,
.ofm-form__field select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 14px;
  padding: 9px 12px;
  background: #fff;
  color: #111827;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  appearance: none;
  -webkit-appearance: none;
}

.ofm-form__field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.17l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px;
}

.ofm-form__field input:focus,
.ofm-form__field textarea:focus,
.ofm-form__field select:focus {
  border-color: #2271b1;
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.ofm-form__field input[readonly] {
  background: #f9fafb;
  color: #6b7280;
  cursor: default;
}

.ofm-form__actions {
  margin-top: 6px;
}

.ofm-btn--submit {
  appearance: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 22px;
  width: 100%;
  background: #111827;
  color: #ffffff;
  transition: opacity 150ms ease;
}

.ofm-btn--submit:hover:not(:disabled) {
  opacity: 0.9;
}

.ofm-btn--submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ofm-form__message {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  text-align: center;
}

.ofm-form__message.is-success { color: #166534; }
.ofm-form__message.is-error   { color: #b91c1c; }

/* Honeypot */
.ofm-honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
  height: 0;
  overflow: hidden;
}

/* Responsive */
@media ( max-width: 600px ) {
  .ofm-modal__dialog {
    margin-top: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 24px 20px;
    animation: ofm-slide-up 220ms ease;
  }

  @keyframes ofm-slide-up {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  .ofm-form__grid {
    grid-template-columns: 1fr;
  }
}
