:root {
  --bg: #000000;
  --panel: rgba(255, 255, 255, 0.98);
  --text-outside: #ffffff;
  --text-form: #0f172a;
  --text-light: #1e293b;
  --muted-outside: #e5e7eb;
  --muted-form: #64748b;
  --primary: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  --primary-hover: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  --border: rgba(148, 163, 184, 0.3);
  --border-focus: rgba(59, 130, 246, 0.5);
  --success: #059669;
  --error: #dc2626;
  --shadow-sm: 0 1px 2px 0 rgba(255, 255, 255, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(255, 255, 255, 0.1), 0 2px 4px -1px rgba(255, 255, 255, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(255, 255, 255, 0.1), 0 4px 6px -2px rgba(255, 255, 255, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(255, 255, 255, 0.1), 0 10px 10px -5px rgba(255, 255, 255, 0.04);
}

/* Force dark background with white form - override any preferences */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000 !important;
    --panel: rgba(255, 255, 255, 0.98) !important;
    --text-outside: #ffffff !important;
    --text-form: #0f172a !important;
    --muted-outside: #e5e7eb !important;
    --muted-form: #64748b !important;
    --border: rgba(148, 163, 184, 0.3) !important;
  }
}

* { 
  box-sizing: border-box; 
}

html, body { 
  height: 100%; 
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  color: var(--text-outside) !important;
  background: var(--bg) !important;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.container {
  max-width: 840px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Mobile-first responsive breakpoints */
@media (min-width: 480px) {
  .container {
    padding: 20px;
    margin: 20px auto;
    min-height: auto;
  }
}

@media (min-width: 768px) {
  .container {
    padding: 32px 24px;
    margin: 40px auto;
  }
}

.title { 
  font-size: 1.75rem; 
  font-weight: 700; 
  margin: 0 0 8px; 
  color: var(--text-outside);
  letter-spacing: -0.02em;
  text-align: center;
  line-height: 1.2;
}

.subtitle { 
  color: var(--muted-outside); 
  margin: 0 0 20px; 
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.5;
}

.description, .note { 
  color: var(--muted-outside); 
  margin: 0 0 16px; 
  font-size: 1rem;
  line-height: 1.6;
  text-align: center;
}

@media (min-width: 480px) {
  .description, .note { 
    font-size: 1.05rem;
  }
}

/* Desktop typography improvements */
@media (min-width: 768px) {
  .title { 
    font-size: 2.25rem;
    color: var(--text-outside);
    text-align: left;
  }
  
  .subtitle { 
    font-size: 1.1rem;
    text-align: left;
  }
  
  .description, .note { 
    font-size: 1rem;
    text-align: left;
  }
}

form {
  background: var(--panel) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid var(--border) !important;
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  width: 100%;
  margin: 0;
}

form::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
}

/* Enhanced mobile form styling */
@media (min-width: 480px) {
  form {
    padding: 24px;
    border-radius: 18px;
  }
}

@media (min-width: 768px) {
  form {
    padding: 32px;
    border-radius: 20px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-xl);
  }
  
  form::before {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  }
}

section { 
  margin: 20px 0 24px; 
  position: relative;
}

section h2 { 
  font-size: 1.375rem; 
  margin: 0 0 16px; 
  color: var(--text-form); 
  font-weight: 700; 
  letter-spacing: -0.01em;
  text-align: center;
}

/* Desktop section styling */
@media (min-width: 768px) {
  section { 
    margin: 24px 0 32px; 
  }
  
  section h2 { 
    font-size: 1.5rem; 
    margin: 0 0 20px; 
    letter-spacing: -0.015em;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
  }

  section h2::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
  }
}

.grid { 
  display: grid; 
  grid-template-columns: 1fr; 
  gap: 16px; 
}

@media (min-width: 640px) { 
  .grid { 
    grid-template-columns: 1fr 1fr; 
    gap: 20px; 
  } 
}

@media (min-width: 768px) { 
  .grid { 
    gap: 24px; 
  } 
}

.field { 
  display: flex; 
  flex-direction: column; 
  gap: 10px; 
  position: relative;
}

.field label { 
  font-weight: 600; 
  color: var(--text-form); 
  font-size: 1rem;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}

.hint { 
  color: var(--muted-form); 
  margin: 0; 
  font-size: 0.95rem; 
  line-height: 1.5;
}

/* Checkbox field styling */
.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  margin: 8px 0;
}

.checkbox-field input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin: 2px 0 0 0;
  cursor: pointer;
  accent-color: var(--primary);
}

.checkbox-field label {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-form);
  cursor: pointer;
  line-height: 1.5;
  margin-bottom: 0;
}

@media (max-width: 767px) {
  .checkbox-field {
    padding: 18px 16px;
    gap: 16px;
  }
  
  .checkbox-field input[type="checkbox"] {
    width: 24px;
    height: 24px;
    min-width: 24px;
  }
  
  .checkbox-field label {
    font-size: 1.05rem;
  }
}

@media (min-width: 768px) {
  .field label {
    font-size: 0.95rem;
  }
  
  .hint {
    font-size: 0.9rem;
  }
  
  .checkbox-field label {
    font-size: 0.95rem;
  }
}

input[type="text"], input[type="email"], input[type="date"], input[type="time"], select, textarea {
  width: 100%;
  padding: 16px;
  color: var(--text-form) !important;
  background: var(--panel) !important;
  border: 2px solid var(--border) !important;
  border-radius: 12px;
  outline: none;
  transition: all 0.2s ease;
  font-size: 16px; /* Prevents zoom on iOS */
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  position: relative;
  min-height: 44px; /* iOS recommended touch target */
  -webkit-appearance: none;
  appearance: none;
}

input::placeholder, textarea::placeholder { 
  color: var(--muted-form); 
  opacity: 0.8; 
  font-weight: 400;
}

textarea { 
  resize: vertical; 
  min-height: 120px; 
  line-height: 1.6;
  font-family: inherit;
}

@media (min-width: 768px) {
  textarea { 
    min-height: 100px; 
  }
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus) !important;
  box-shadow: 0 0 0 4px var(--border-focus), var(--shadow-md);
  transform: translateY(-1px);
}

input:hover, select:hover, textarea:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
}

/* Specific styling for date and time inputs */
input[type="date"], input[type="time"] {
  font-family: inherit;
  cursor: pointer;
}

/* Date picker icon styling */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3e%3cpath fill-rule='evenodd' d='M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z' clip-rule='evenodd' /%3e%3c/svg%3e");
  background-size: 20px;
  background-repeat: no-repeat;
  background-position: center;
  width: 20px;
  height: 20px;
  margin-left: 8px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

input[type="time"]::-webkit-calendar-picker-indicator {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3e%3cpath fill-rule='evenodd' d='M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z' clip-rule='evenodd' /%3e%3c/svg%3e");
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* Mobile specific adjustments */
@media (max-width: 767px) {
  input[type="date"], input[type="time"] {
    font-size: 16px; /* Prevent zoom on iOS */
    min-height: 56px; /* Larger touch target on mobile */
    padding: 18px 16px;
  }
  
  input[type="date"]::-webkit-calendar-picker-indicator,
  input[type="time"]::-webkit-calendar-picker-indicator {
    width: 24px;
    height: 24px;
    background-size: 24px;
    margin-left: 12px;
  }
}

/* Desktop specific adjustments */
@media (min-width: 768px) {
  input[type="date"], input[type="time"] {
    min-height: 44px;
    padding: 14px 16px;
  }
}

.actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

@media (min-width: 768px) {
  .actions {
    flex-direction: row;
    align-items: center;
    gap: 20px;
    margin-top: 32px;
    padding-top: 0;
    border-top: none;
  }
}

button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 18px 24px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
  width: 100%;
  min-height: 56px; /* Large touch target for mobile */
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.6s;
}

button:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-sm);
}

button:hover::before {
  left: 100%;
}

/* Desktop button styling */
@media (min-width: 768px) {
  button {
    width: auto;
    padding: 16px 32px;
    border-radius: 16px;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    min-height: auto;
  }
  
  button:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px);
  }
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--shadow-sm);
}

button:disabled::before {
  display: none;
}

.status {
  color: var(--muted-outside);
  min-height: 1.2em;
  font-size: 1rem;
  margin-left: auto;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  white-space: pre-line;
  text-align: right;
  line-height: 1.5;
}

@media (max-width: 767px) {
  .status {
    margin-left: 0;
    text-align: center;
    margin-top: 12px;
  }
}

.status.success { 
  color: var(--success); 
  font-weight: 600; 
  animation: slideInSuccess 0.5s ease-out;
  background: rgba(5, 150, 105, 0.1);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(5, 150, 105, 0.2);
  font-size: 1rem;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 767px) {
  .status.success {
    padding: 20px 16px;
    font-size: 1rem;
    margin-top: 16px;
  }
}

.status.error { 
  color: var(--error); 
  font-weight: 600; 
  animation: slideInError 0.5s ease-out;
}

@keyframes slideInSuccess {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInError {
  from {
    opacity: 0;
    transform: translateX(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* Add fade-in animation for the entire form */
form {
  animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Add stagger animation for form fields - disabled on mobile for performance */
@media (min-width: 768px) {
  .field {
    animation: fadeInField 0.6s ease-out both;
  }

  .field:nth-child(1) { animation-delay: 0.1s; }
  .field:nth-child(2) { animation-delay: 0.2s; }
  .field:nth-child(3) { animation-delay: 0.3s; }
  .field:nth-child(4) { animation-delay: 0.4s; }
}

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

/* Mobile orientation support */
@media screen and (max-height: 600px) and (orientation: landscape) {
  .container {
    min-height: auto;
    padding: 12px;
    justify-content: flex-start;
  }
  
  form {
    padding: 16px;
  }
  
  section {
    margin: 16px 0 20px;
  }
}

.visually-hidden {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

.hidden-iframe { display: none; }


