
:root {
  --primary-green: #01764F;
  --primary-orange: #F18A1F;
  --black: #333;
  --white: #FFFFFF;
  --gray: #ccc;
  --light-gray: #f5f5f5;
  /* Dark mode variables */
  --dm-bg: #181c1f;
  --dm-container: #23272b;
  --dm-text: #f5f5f5;
  --dm-gray: #444;
  --dm-primary-green: #1ecb8b;
  --dm-primary-orange: #ffb86b;
}

*{
	box-sizing: border-box;
	padding: 0;
	margin: 0;
	font-family: 'poppins', sans-serif;
	font-size: 16px;
}
body{
	height: 100%;
    padding: 40px 0;
	display: flex;
	align-items: center;
	justify-content: center;
    background-color: var(--light-gray);
    transition: background 0.3s;
}
.container{
	width: 100%;
	max-width: 1100px;
	padding: 30px;
	border: 1px solid var(--gray);
	border-radius: 10px;
	background-color: var(--white);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: background 0.3s, border 0.3s;
}
h4{
	margin-bottom: 20px;
	font-size: 28px;
	color: var(--primary-green);
    text-align: center;
    grid-column: 1 / -1;
}

/* Stepper */
.stepper {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0 0 16px 0;
  padding: 0;
}
.stepper .step {
  text-align: center;
  padding: 10px 8px;
  border-radius: 8px;
  background: #2a2f35;
  color: #b0bec5;
  border: 1px solid #3a434c;
  font-weight: 600;
  font-size: 14px;
}
.stepper .step.current {
  background: #1e2a24;
  color: #e8f5e9;
  border-color: var(--dm-primary-green);
}
.stepper .step.completed {
  background: #20322a;
  color: #c8e6c9;
  border-color: rgba(30,203,139,0.6);
}
input, select, textarea {
	width: 100%;
	padding: 10px 15px;
	margin-bottom: 10px;
    border: 1px solid var(--gray);
    border-radius: 5px;
    color: var(--black);
    background: var(--white);
    transition: background 0.3s, color 0.3s, border 0.3s;
}
textarea{
	width: 100%;
	padding: 10px;
    resize: vertical;
}
#submit{
	border: none;
	background-color: var(--primary-orange);
	color: var(--white);
	width: 100%;
	margin-top: 10px;
	border-radius: 5px;
    padding: 12px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s;
    grid-column: 1 / -1;
}
#submit:hover{
	background-color: #d87916;
}
fieldset {
    border: 1px solid var(--gray);
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 0;
    background: none;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
legend {
    padding: 0 10px;
    font-weight: bold;
    color: var(--primary-green);
    font-size: 20px;
}
select:required:invalid {
  color: #757575;
}
option {
  color: var(--black);
}

form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

/* Security notice spans full width */
.security-notice {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.security-notice::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.security-notice i {
  margin-right: 8px;
  color: #fff;
}

/* Wizard steps */
.form-step { display: none; grid-column: 1 / -1; }
.form-step.active { display: flex; }

/* Wizard actions */
.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  justify-content: space-between; /* space left/right */
  align-items: center;
  margin-top: 8px;
}
.nav-btn {
  appearance: none;
  border: 1px solid #586574;
  background: #2c3137;
  color: #e1e5e8;
  padding: 12px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.nav-btn:hover { filter: brightness(1.1); }
.submit-btn { display: none; }

/* Ensure consistent button alignment on mobile */
@media (max-width: 600px) {
  .form-actions { gap: 10px; }
  .nav-btn, #submit.submit-btn { flex: 0 0 auto; }
}

/* Responsive: stack fieldsets vertically on mobile */
@media (max-width: 900px) {
  .container {
    max-width: 98vw;
    padding: 10px;
  }
  form {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  h4 {
    font-size: 22px;
  }
  legend {
    font-size: 16px;
  }
  .stepper { grid-template-columns: repeat(4, 1fr); }
}

/* Dark mode styles */
body {
  background-color: var(--dm-bg);
}
.container {
  background-color: var(--dm-container);
  border-color: var(--dm-gray);
}
h4 {
  color: var(--dm-primary-green);
}
fieldset {
  border-color: var(--dm-gray);
}
legend {
  color: var(--dm-primary-green);
}
input,
select,
textarea {
  background: #23272b;
  color: var(--dm-text);
  border-color: var(--dm-gray);
}
option {
  color: var(--dm-text);
}
#submit {
  background-color: var(--dm-primary-orange);
  color: var(--black);
}
#submit:hover {
  background-color: #ff9900;
}
.back-btn {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 1000;
  color: #fff !important;
  border: 2px solid #01764F !important;
  background: transparent !important;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 6px;
  font-size: 16px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.back-btn:hover {
  background: #01764F !important;
  color: #fff !important;
  border-color: #fff !important;
}

/* Enhanced registration form styles with security features */

/* Security and submission state styles */
.submission-notice {
    background: #e3f2fd;
    border: 1px solid #2196f3;
    color: #1976d2;
    padding: 15px;
    margin: 15px 0;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.1);
}

/* Accessibility and mobile high-contrast tweaks */

/* Lighter placeholder text for readability on dark inputs */
input::placeholder,
textarea::placeholder {
  color: #cfd8dc; /* light gray-blue for contrast */
  opacity: 1;     /* ensure consistent across browsers */
}

/* Improve not-selected state color of selects */
select:required:invalid {
  color: #cfd8dc;
}

/* High-contrast focus ring */
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--dm-primary-green);
  box-shadow: 0 0 0 3px rgba(30, 203, 139, 0.25);
}

/* Slightly brighter fieldset background to separate groups on mobile */
@media (max-width: 600px) {
  .container {
    padding: 16px;
  }
  fieldset {
    background: rgba(255, 255, 255, 0.03);
    border-color: #5c6977;
    border-width: 1.5px;
    padding: 14px 14px;
    gap: 10px;
  }
  legend {
    color: var(--dm-primary-green);
    font-size: 18px;
    letter-spacing: 0.2px;
  }
  input,
  select,
  textarea {
    font-size: 16px; /* prevents mobile zoom */
    padding: 14px 16px;
    border-radius: 8px;
    border-color: #6b7a88;
    color: #f7f9fa;
  }
  #submit {
    font-size: 17px;
    padding: 14px;
  }
  .security-notice {
    font-size: 13.5px;
  }
}

.submission-notice i {
    margin-right: 8px;
    color: #1976d2;
}

/* Cooldown notice styling */
.cooldown-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 12px;
    margin: 10px 0;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(255, 193, 7, 0.1);
    animation: fadeIn 0.3s ease-in;
    opacity: 0.9;
}

.cooldown-notice i {
    margin-right: 6px;
    color: #856404;
    font-size: 13px;
}

.cooldown-notice small {
    opacity: 0.7;
    font-size: 11px;
    margin-top: 3px;
    display: block;
    font-weight: normal;
}

.cooldown-notice strong {
    color: #856404;
    font-weight: 600;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 0.9; transform: translateY(0); }
}

/* Submit button states */
#submit:disabled {
    background-color: #ccc !important;
    color: #666 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

#submit:disabled:hover {
    background-color: #ccc !important;
    transform: none !important;
}

/* Rate limiting indicator */
.rate-limit-indicator {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
}

/* Error styling for real-time validation */
input.error, select.error, textarea.error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

/* Success styling for valid fields */
input.valid, select.valid, textarea.valid {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

/* Specific styling for car year field */
input[name="car-year"]:focus {
    border-color: var(--dm-primary-green);
    box-shadow: 0 0 0 3px rgba(30, 203, 139, 0.25);
}

/* Field help text styling */
.field-help {
    background: rgba(30, 203, 139, 0.1);
    border: 1px solid rgba(30, 203, 139, 0.3);
    border-radius: 6px;
    padding: 10px;
    margin: 8px 0;
    font-size: 12px;
    color: var(--dm-text);
}

.field-help small {
    display: block;
    margin: 2px 0;
    opacity: 0.9;
}

/* Security token indicator (hidden but accessible) */
input[name="form_token"] {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

/* Loading state for submit button */
#submit.loading {
    background: linear-gradient(45deg, #4CAF50, #45a049) !important;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Form validation feedback */
.field-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

.field-success {
    color: #28a745;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

/* Submission counter display (optional) */
.submission-counter {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #6c757d;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
    margin: 10px 0;
}

/* Responsive adjustments for security features */
@media (max-width: 768px) {
    .submission-notice {
        padding: 12px;
        font-size: 14px;
    }
    
    .cooldown-notice {
        padding: 12px;
        font-size: 14px;
    }
    
    .security-notice {
        padding: 12px;
        font-size: 14px;
    }
    
    .rate-limit-indicator {
        padding: 8px;
        font-size: 13px;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .security-notice::before {
        animation: none;
    }
    
    #submit.loading {
        animation: none;
    }
    
    .cooldown-notice {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .submission-notice {
        border-width: 2px;
    }
    
    .cooldown-notice {
        border-width: 2px;
    }
    
    .security-notice {
        border: 2px solid #fff;
    }
    
    input.error, select.error, textarea.error {
        border-width: 2px !important;
    }
}
