/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700&family=Poppins:wght@700&display=swap');

/* Light Mode Variables */
:root {
  --bg-color: #ffffff;              /* Pure white background */
  --container-bg: #fff8f0;          /* Warm, off-white container */
  --text-color: #333333;            /* Dark text for high contrast */
  --text-muted: #666666;
  --heading-color: #111111;         /* Nearly black for headings */
  --accent-color: #ff5722;          /* Vibrant deep orange accent */
  --step-bg: #e0e0e0;               /* Neutral for inactive steps */
  --step-completed-bg: var(--accent-color);
  --option-bg: #fff8f0;
  --option-border: #e0dcd0;
  --option-hover: #ffe0cc;
  --input-border: #000000;
  --option-checked-bg: var(--accent-color);
  --option-checked-color: #ffffff;
  --button-secondary-bg: #f0dcd0;
  --button-secondary-color: #333333;
  --button-primary-bg: var(--accent-color);
  --button-primary-color: #ffffff;
  --law-bg: #fef3e0;
  --law-border: var(--accent-color);
  --organization-bg: #fff0e6;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --border-color: #e0dcd0;
}

/* Dark Mode Variables */
[data-theme="dark"] {
  --bg-color: #121212;
  --container-bg: #1e1e1e;
  --text-color: #f5f5f5;
  --text-muted: #cccccc;
  --heading-color: #f5f5f5;
  --accent-color: #ff5722; /* Use the same vibrant accent */
  --step-bg: #333333;
  --step-completed-bg: var(--accent-color);
  --option-bg: #1e1e1e;
  --option-border: #444444;
  --option-hover: #2a2a2a;
  --input-border: #ffffff;
  --option-checked-bg: var(--accent-color);
  --option-checked-color: #ffffff;
  --button-secondary-bg: #333333;
  --button-secondary-color: #f5f5f5;
  --button-primary-bg: var(--accent-color);
  --button-primary-color: #ffffff;
  --law-bg: #2a2a2a;
  --law-border: var(--accent-color);
  --organization-bg: #1a1a1a;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --border-color: #444444;
}

[data-theme="dark"] .input-field input[type="text"],
[data-theme="dark"] .input-field select,
[data-theme="dark"] .country-selector select {
  box-shadow: 5px 5px 2px rgba(75, 74, 74, 0.71);
}

/* Base Styles */
html {
  font-size: 100%;
}

body {
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  margin: 0;
  padding: 1.25rem;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Poppins', sans-serif;
  color: var(--heading-color);
  margin: 0 0 0.5rem 0;
}

/* Container */
.container {
  max-width: 50rem;
  margin: 0 auto;
  background: var(--container-bg);
  padding: 1.875rem;
  border-radius: 0.5rem;
  box-shadow: 0 0.125rem 0.625rem var(--shadow-color);
}

/* Header */
header {
  text-align: left;
  margin-bottom: 2rem;
  position: relative;
}

.theme-toggle {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background-color: var(--button-secondary-bg);
  color: var(--button-secondary-color);
  border: none;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Focus Indicators */
a:focus,
button:focus,
input:focus,
select:focus {
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}

/* Progress Bar */
.progress {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3rem;
  position: relative;
}

.progress::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  height: 2px;
  background: var(--step-bg);
  width: 100%;
  z-index: 1;
}

.step {
  position: relative;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  background: var(--step-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
}

.step-label {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 50%;
  transform: translateX(-50%);
  margin-top: 0.25rem;
  font-size: 0.75rem;
  white-space: nowrap;
  color: var(--text-muted);
}

.step.active {
  background: var(--accent-color);
  color: var(--button-primary-color);
}

.step.completed {
  background: var(--accent-color);
  color: var(--button-primary-color);
}

/* Form Sections */
.form-section {
  display: none;
}

.form-section.active {
  display: block;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.question {
  margin-bottom: 1.5rem;
}

/* Input Fields */
.input-field {
  margin-bottom: 1rem;
}

.input-field label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.input-field input[type="text"],
.input-field select,
.country-selector select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  font-size: 16px;
  background-color: var(--container-bg);
  color: var(--text-color);
  box-shadow: 5px 5px 2px rgb(255, 87, 34, 0.3);
  transition: box-shadow 0.2s ease;
}

.input-field input[type="text"]:focus,
.input-field select:focus,
.country-selector select:focus {
  /* Emphasize focus with a stronger, colored shadow */
  box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.3);
  
}

/* Options */
.options {
  margin: 1.25rem 0;
}

.option {
  margin-bottom: 0.75rem;
}

.option label {
  display: block;
  padding: 0.75rem 1rem;
  background: var(--option-bg);
  border: 1px solid var(--option-border);
  border-radius: 0.25rem;
  cursor: pointer;
  transition: background 0.2s;
}

.option label:hover {
  background: var(--option-hover);
}

.option input[type="radio"]:checked + label,
.option input[type="checkbox"]:checked + label {
  background: var(--option-checked-bg);
  color: var(--option-checked-color);
  border-color: var(--option-checked-bg);
}

/* Buttons */
.buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
}

button {
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
}

button.next {
  background: var(--button-primary-bg);
  color: var(--button-primary-color);
}

button.prev {
  background: var(--button-secondary-bg);
  color: var(--button-secondary-color);
}

button:hover {
  opacity: 0.9;
}

/* Results Section */
#resultsSection {
  display: none;
}

.organization-details {
  background-color: var(--organization-bg);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--accent-color);
}

.organization-details h3 {
  margin-top: 0;
}

/* Error Summary Styling */
.error-summary {
    border: 1px solid var(--accent-color);
    background-color: rgba(255, 87, 34, 0.1); /* light tint in light mode */
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.25rem;
  }
  
  .error-summary h2 {
    margin-top: 0;
    color: var(--heading-color); /* same as other headings */
    font-size: 1rem;
  }
  
  .error-summary ul {
    margin: 0;
    padding-left: 1.25rem;
  }
  
  /* Links in the error summary: default to black in light mode */
  .error-summary li a {
    color: #000000;
    text-decoration: underline;
  }
  
  /* Dark mode overrides for error summary */
  [data-theme="dark"] .error-summary {
    background-color: var(--accent-color); /* use vibrant accent */
  }
  
  [data-theme="dark"] .error-summary li a {
    color: #ffffff; /* white links in dark mode */
  }
  
  /* Remove hover effects; only focus styles are needed.
     Use a box-shadow to create a rounded focus indicator. */
  .error-summary li a:hover {
    text-decoration: underline;
  }
  
  .error-summary li a:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-color);
    border-radius: 0.25rem;
  }
  
  /* Increase inline error message size */
  .error-message {
    color: var(--accent-color);
    font-size: 1rem;
    margin-top: 0.5rem;
    display: block;
  }
  

/* Footer */
footer {
  text-align: left;
  margin-top: 2rem;
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 1rem;
  background-color: var(--container-bg);
}
footer a {
  color: var(--accent-color);
  text-decoration: underline;
}
footer a:focus,
footer a:hover {
  text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  body {
    font-size: 1.125rem;
  }

  .container {
    padding: 1.25rem;
  }
  .step-label {
    font-size: 0.65rem;
  }

  header {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: static;
  }
  
  .theme-toggle {
    position: static;
    margin-bottom: 1rem;
  }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  
  .skip-link {
    position: absolute;
    left: -999px;   /* Hidden off-screen by default */
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: -1;
  }
  
  /* Skip Link when focused */
  .skip-link:focus {
    position: static;
    left: auto;
    top: auto;
    width: auto;
    height: auto;
    padding: 1rem 1.5rem;  /* Increase padding so text is fully visible */
    background: var(--accent-color);
    color: #ffffff;
    margin-bottom: 1rem;
    border-radius: 0.25rem;
    display: inline-block;
    font-size: 1rem;
  }

  