/* ============================================================
   Campaign Lead Form - standalone styles
   Mirrors the frontend CampaignLeadForm.tsx (Tailwind) exactly.
   ============================================================ */

:root {
  --radius: 0.5rem;
  --primary: #104677;
  --input: #e5e5e5;
  --foreground: #0a0a0a;
  --muted-foreground: #737373;
  --destructive: #ef4444;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', sans-serif;
  color: #333;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
p {
  margin: 0;
}

button,
input {
  font-family: inherit;
}

/* ============================== SCREENS ============================== */

.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background-image: linear-gradient(to bottom right, #f8fafc, #ffffff, #eff6ff);
}

.screen[hidden] {
  display: none;
}

.screen-success {
  padding-top: 48px;
  padding-bottom: 48px;
  background-image: linear-gradient(to bottom right, #ecfdf5, #ffffff, #eff6ff);
}

.wrapper {
  width: 100%;
  max-width: 28rem;
}

/* ============================== CARD ============================== */

.card {
  background: #fff;
  border-radius: 1rem;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* ============================== HEADER ============================== */

.card-header {
  position: relative;
  overflow: hidden;
  padding: 32px 24px;
  text-align: center;
  background-image: linear-gradient(to right, #2563eb, #1d4ed8, #4338ca);
}

.header-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.header-content {
  position: relative;
  z-index: 10;
}

.header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 1rem;
  border-radius: 1rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.header-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.header-title {
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 700;
  color: #fff;
}

/* ============================== FORM ============================== */

.card-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 24px;
}

.field {
  display: block;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: #374151;
}

.label-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  color: #3b82f6;
}

.label-icon-facebook {
  color: #2563eb;
}

.required {
  color: #ef4444;
}

.optional {
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 400;
  color: #9ca3af;
}

.input-wrap {
  position: relative;
}

.input {
  display: flex;
  width: 100%;
  height: 3rem;
  padding: 0.25rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5rem;
  color: inherit;
  background-color: transparent;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  outline: none;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}

.input::placeholder {
  color: var(--muted-foreground);
}

.input:focus-visible {
  outline: none;
  /* frontend disables the focus ring globally (--tw-ring-shadow: none) */
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.field-error {
  display: none;
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: var(--destructive);
}

.field-error.show {
  display: block;
}

.form-error {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: calc(var(--radius) - 2px);
}

.form-error[hidden] {
  display: none;
}

/* ============================== BUTTONS ============================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  height: 2.25rem;
  padding: 1.25rem 1rem;
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 500;
  white-space: nowrap;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  pointer-events: none;
}

.btn:focus {
  outline: none;
}

.btn:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.btn-primary {
  color: #fff;
  background-color: var(--primary);
  /* index.css overrides .shadow: 0 20px 27px 0 #0000000d !important */
  box-shadow: 0 20px 27px 0 rgba(0, 0, 0, 0.05);
}

.btn-primary:hover {
  background-color: rgba(16, 70, 119, 0.9);
}

.btn-primary:not(:disabled):hover {
  transform: translateY(-0.125rem);
  /* index.css overrides .shadow-lg !important */
  box-shadow:
    3px -2px 20px 0 rgba(0, 0, 0, 0.047),
    0 4px 20px 0 rgba(0, 0, 0, 0.047);
}

.btn-primary:focus {
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3);
}

.btn-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-loading[hidden] {
  display: none;
}

.btn-label[hidden] {
  display: none;
}

.spinner {
  animation: spin 1s linear infinite;
}

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

/* ============================== BRAND ============================== */

.brand {
  margin-top: 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  text-align: center;
  color: #9ca3af;
}

.brand strong {
  font-weight: 500;
  color: #4b5563;
}

/* ============================== SUCCESS ============================== */

.success-card {
  padding: 32px;
  text-align: center;
}

.success-anim {
  position: relative;
  display: inline-block;
  margin-bottom: 1.5rem;
}

.success-ring {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  margin: 0 auto;
  color: #059669;
  background-color: #d1fae5;
  border-radius: 9999px;
}

.success-ring svg {
  width: 2.5rem;
  height: 2.5rem;
}

.success-pulse {
  position: absolute;
  inset: 0;
  background-color: #a7f3d0;
  border-radius: 9999px;
  animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.success-pulse-1 {
  opacity: 0.75;
}

.success-pulse-2 {
  opacity: 0.5;
  animation-delay: 0.5s;
}

@keyframes ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

.success-title {
  margin-bottom: 0.75rem;
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 700;
  color: #111827;
}

.success-text {
  margin-bottom: 1.5rem;
  font-size: 1.125rem;
  line-height: 1.625;
  color: #4b5563;
}

.next-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  text-align: left;
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 0.75rem;
}

.next-box-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  color: #059669;
  background-color: #d1fae5;
  border-radius: 9999px;
}

.next-box-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.next-box-title {
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 500;
  color: #065f46;
}

.next-box-text {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #047857;
}

.btn-outline {
  height: 2.25rem;
  padding: 0.75rem 1rem;
  font-size: 1.125rem;
  line-height: 1.75rem;
  color: #333;
  background-color: #fff;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  /* index.css: button { box-shadow: none !important } */
  box-shadow: none;
}

.btn-outline:hover {
  color: #171717;
  background-color: #f5f5f5;
}

.redirect-note {
  margin-top: 1.5rem;
  font-size: 0.75rem;
  line-height: 1rem;
  color: #9ca3af;
}

.screen-success .brand {
  margin-top: 2rem;
}

/* ============================== RESPONSIVE ============================== */

@media (min-width: 640px) {
  .card-body {
    padding: 32px;
  }

  .success-card {
    padding: 40px;
  }

  .success-title {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }
}

@media (min-width: 768px) {
  .input {
    font-size: 0.875rem;
    line-height: 1.25rem;
  }
}

@media (min-width: 640px) {
  .screen,
  .screen-success {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (min-width: 1024px) {
  .screen,
  .screen-success {
    padding-left: 32px;
    padding-right: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
