/* ========================================================================
   Persistent Forms - UI Styles
   Beautiful, responsive, glassmorphism UI for forms. Powered by Deskulpt.
   ======================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --pf-bg: #15121b;
  --pf-bg-surface: #1c1825;
  --pf-text: #e8dfee;
  --pf-text-muted: #cfc8d8;
  --pf-primary: #7c3aed;
  --pf-primary-light: #8b5cf6;
  --pf-secondary: #d946ef;
  --pf-primary-glow: rgba(124, 58, 237, 0.45);
  --pf-surface: rgba(255, 255, 255, 0.03);
  --pf-surface-border: rgba(255, 255, 255, 0.08);
  --pf-surface-hover: rgba(255, 255, 255, 0.06);
  --pf-radius: 20px;
  --pf-radius-sm: 12px;
  --pf-font: 'Plus Jakarta Sans', sans-serif;
}

/* Base Body Styles for Demo - Can be removed in production */
body {
  background: var(--pf-bg);
  color: var(--pf-text);
  font-family: var(--pf-font);
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

/* Container */
.pf-container {
  width: 100%;
  max-width: 640px;
  padding: 2rem;
  box-sizing: border-box;
}

/* Glassmorphism Form Card */
.pf-form-card {
  background: var(--pf-surface);
  border: 1px solid var(--pf-surface-border);
  border-radius: var(--pf-radius);
  padding: 3.5rem 3rem;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 2rem;
  /* Increased breathing room */
  position: relative;
  overflow: hidden;
}

.pf-form-card:hover {
  background: var(--pf-surface-hover);
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 24px 80px rgba(124, 58, 237, 0.12);
}

.pf-form-header {
  text-align: center;
  margin-bottom: 0.5rem;
}

.pf-form-header h2 {
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--pf-primary-light), var(--pf-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.pf-form-header p {
  color: var(--pf-text-muted);
  font-size: 1rem;
  margin: 0;
}

/* Form Fields */
.pf-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  /* Increased spacing */
}

.pf-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pf-form-field label {
  padding-top: 22px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--pf-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pf-input,
.pf-textarea {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--pf-surface-border);
  border-radius: var(--pf-radius-sm);
  color: var(--pf-text);
  padding: 0 1.25rem;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  /* Touch target minimum */
  line-height: 48px;
}

.pf-input::placeholder,
.pf-textarea::placeholder {
  color: rgba(157, 147, 171, 0.4);
}

.pf-input:focus,
.pf-textarea:focus {
  border-color: var(--pf-primary-light);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.15), 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.pf-textarea {
  resize: vertical;
  min-height: 120px;
  padding: 1rem 1.25rem;
  line-height: 1.5;
}

/* Phone Badge Wrapper */
.pf-phone-wrapper {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  overflow: visible;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--pf-surface-border);
  border-radius: var(--pf-radius-sm);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 48px;
}

.pf-phone-wrapper:focus-within {
  border-color: var(--pf-primary-light);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.15), 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.pf-custom-select {
  position: relative;
  flex: 0 1 auto;
  border-right: 1px solid var(--pf-surface-border);
  color: var(--pf-text);
  font-family: inherit;
  font-size: 1.1rem;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  user-select: none;
  background: transparent;
  min-width: 80px;
  transition: all 0.2s;
}

.pf-custom-select:focus,
.pf-custom-select.pf-open {
  background: rgba(255, 255, 255, 0.05);
}

.pf-select-trigger {
  padding: 0 0.5rem 0 1.25rem;
  white-space: nowrap;
}

.pf-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 280px;
  max-height: 320px;
  background: var(--pf-bg-surface);
  border: 1px solid var(--pf-primary-light);
  border-radius: var(--pf-radius-sm);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: none;
  flex-direction: column;
  overflow: hidden;
  margin-top: 8px;
}

.pf-custom-select.pf-open .pf-select-dropdown {
  display: flex;
}

.pf-select-search {
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--pf-surface-border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--pf-text);
  font-size: 0.95rem;
  outline: none;
  font-family: inherit;
}

.pf-select-search:focus {
  background: rgba(255, 255, 255, 0.04);
}

.pf-select-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.pf-select-list li {
  padding: 10px 16px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pf-select-list li:hover {
  background: var(--pf-surface-hover);
}

.pf-input-with-badge {
  flex: 1 1 170px;
  width: auto;
  min-width: 170px;
  max-width: none;
  padding-left: 1rem;
  padding-right: 1.25rem;
  background: transparent;
  border: none;
  border-radius: 0;
  border-top-right-radius: var(--pf-radius-sm);
  border-bottom-right-radius: var(--pf-radius-sm);
  box-shadow: none !important;
  transform: none !important;
  min-height: auto;
}

.pf-input-with-badge:focus {
  background: transparent;
  border: none !important;
  box-shadow: none !important;
  transform: none !important;
}

/* Email Auto-complete Ghost */
.pf-email-wrapper .pf-input {
  width: 100%;
}

.pf-email-ghost {
  position: absolute;
  top: 0;
  left: 0;
  color: rgba(207, 200, 216, 0.4);
  background: transparent;
  z-index: 1;
  pointer-events: none;
}

.pf-email-front {
  position: relative;
  z-index: 2;
  background: transparent !important;
}

/* Auto Message Generator */
.pf-message-wrapper {
  position: relative;
}

.pf-message-arrows {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  background: rgba(28, 24, 37, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--pf-radius-sm);
  padding: 4px;
  border: 1px solid var(--pf-surface-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 3;
}

.pf-msg-arrow {
  background: transparent;
  border: none;
  color: var(--pf-text-muted);
  cursor: pointer;
  padding: 8px 12px;
  /* Increased tap target */
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all 0.2s;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pf-msg-arrow:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.pf-msg-arrow:active {
  transform: scale(0.9);
}

/* Rotate Captcha */
.pf-rotate-captcha {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--pf-surface-border);
  border-radius: var(--pf-radius-sm);
  margin-top: 0.5rem;
}

.pf-rotate-image-container {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.1);
  transition: border-color 0.3s ease, transform 0.3s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

#captcha-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.1s ease-out;
}

.pf-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
  padding: 0;
  min-height: 8px;
  line-height: 8px;
}

/* Range Thumb for Mobile Grabbing */
.pf-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s;
}

.pf-range::-moz-range-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: none;
}

.pf-range:active::-webkit-slider-thumb {
  transform: scale(1.15);
}

/* Button */
.pf-checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.pf-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  min-width: 24px;
  border: 2px solid var(--pf-surface-border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.pf-checkbox:checked {
  background: var(--pf-primary);
  border-color: var(--pf-primary-light);
}

.pf-checkbox:checked::after {
  content: '✓';
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.pf-checkbox-wrapper label {
  font-size: 0.85rem;
  color: var(--pf-text-muted);
  cursor: pointer;
  line-height: 1.4;
}

.pf-btn-primary {
  background: linear-gradient(135deg, var(--pf-primary-light), var(--pf-secondary));
  color: #fff;
  padding: 0 2.25rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1.05rem;
  border: none;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s ease, opacity 0.2s;
  display: inline-block;
  text-align: center;
  width: 100%;
  margin-top: 1rem;
  min-height: 52px;
  /* Large touch target */
}

.pf-btn-primary:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 10px 30px var(--pf-primary-glow), 0 0 60px rgba(124, 58, 237, 0.2);
}

.pf-btn-primary:active {
  transform: translateY(1px) scale(0.98);
}

/* Secondary Button */
.pf-btn-secondary {
  background: transparent;
  color: var(--pf-text);
  border: 1px solid var(--pf-surface-border);
  padding: 0 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 48px;
}

.pf-btn-secondary:hover {
  background: var(--pf-surface-hover);
}

.pf-btn-sm {
  min-height: 40px;
  font-size: 0.95rem;
  margin-top: 0;
  width: auto;
  padding: 0 1.5rem;
}

/* Cookie Banner */
.pf-cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(20, 17, 27, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--pf-surface-border);
  padding: 1.5rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
  gap: 2rem;
}

.pf-cookie-content h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.pf-cookie-content p {
  margin: 0;
  color: var(--pf-text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.pf-cookie-actions {
  display: flex;
  gap: 1rem;
  flex-shrink: 0;
}

.pf-cookie-actions .pf-btn-primary,
.pf-cookie-actions .pf-btn-secondary {
  margin-top: 0;
  width: auto;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* WCAG Accessibility Focus */
.pf-phone-wrapper:has(:focus-visible) {
  outline: 3px solid var(--pf-primary-light);
  outline-offset: 3px;
}

.pf-input-with-badge:focus-visible,
.pf-country-dropdown:focus-visible {
  outline: none !important;
}

.pf-input:focus-visible,
.pf-textarea:focus-visible,
.pf-btn-primary:focus-visible,
.pf-btn-secondary:focus-visible,
.pf-range:focus-visible {
  outline: 3px solid var(--pf-primary-light);
  outline-offset: 3px;
}

/* Responsive */
@media (max-width: 640px) {
  body {
    align-items: flex-start;
  }

  .pf-container {
    padding: 0;
    /* Remove outer padding so form touches edges */
  }

  .pf-form-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 2.5rem 1.5rem;
    gap: 1.5rem;
  }

  .pf-form-row {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .pf-cookie-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem;
    gap: 1.5rem;
  }

  .pf-cookie-actions {
    width: 100%;
    justify-content: flex-end;
  }
}