/* --- NEW DARK THEME PALETTE --- */
:root {
  --primary-green: #4caf50;
  --background-dark: #1a1a1a;
  --container-bg: #2a2a2a;
  --text-light: #f0f0f0;
  --text-secondary: #aaa;
  --error-red: #f44336;
  --border-color: #444;
  --shadow-color: rgba(0, 0, 0, 0.3);
}

/* --- BASE STYLES --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  background-color: var(--background-dark);
  color: var(--text-light);
  display: flex;
  justify-content: center;
  padding: 24px;
  min-height: 100vh;
}

/* --- MAIN CONTAINER --- */
.container {
  width: 100%;
  max-width: 420px;
  background-color: var(--container-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 12px var(--shadow-color);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--primary-green);
}

.leaf-icon {
  width: 28px;
  height: 28px;
}

h1 {
  font-size: 2rem;
  font-weight: 600;
}

.description {
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* --- INPUTS & BUTTONS --- */
textarea {
  width: 100%;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background-color: #333;
  color: var(--text-light);
  font-size: 1rem;
  resize: vertical;
  color-scheme: dark;
}

textarea:focus {
  outline: none;
  border-color: var(--primary-green);
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}

button,
.button {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 6px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

button:active,
.button:active {
  transform: scale(0.98);
}

#checkButton {
  background-color: var(--primary-green);
  color: white;
}

#checkButton:hover {
  background-color: #5cb85c;
}

/* --- RESULTS & QR CODE --- */
.results-container {
  font-size: 1rem;
  text-align: center;
}

.error-message {
  font-weight: bold;
  margin-bottom: 8px;
  color: var(--error-red);
}

.error-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.error-list li {
  background-color: var(--error-red);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 500;
}

.qr-container {
  text-align: center;
  margin-top: 1rem;
  background-color: var(--container-bg);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.qr-container h2 {
  font-size: 1.2rem;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

/* IMPORTANT: QR code itself must have a white background for scanners */
#qrcode {
  background-color: white;
  padding: 16px; /* This padding is visual only */
  border-radius: 8px;
  display: inline-block; /* Ensures padding wraps the canvas */
}

.button-group {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.share-button {
  background-color: var(--primary-green);
  color: white;
}
.download-button {
  background-color: #424242; /* Neutral Grey */
  color: var(--text-light);
}

.hidden {
  display: none;
}
/* Style for the button when it's processing a request */
#checkButton:disabled {
  background-color: #555;
  cursor: not-allowed;
  transform: none; /* Disable the active:scale effect */
}

/* --- NEW CHOICE SECTION STYLES --- */
.choice-section fieldset {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 8px;
}

.choice-section legend {
  padding: 0 10px;
  color: var(--text-secondary);
}

.radio-group {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.radio-option {
  display: flex;
  align-items: center;
}

.radio-option label {
  font-size: 1.1rem;
  padding-left: 10px;
  cursor: pointer;
}

/* Custom Radio Button Styles */
.radio-option input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--background-dark);
  margin: 0;
  font: inherit;
  color: var(--border-color);
  width: 1.5em;
  height: 1.5em;
  border: 0.15em solid var(--border-color);
  border-radius: 50%;
  transform: translateY(-0.075em);
  display: grid;
  place-content: center;
  cursor: pointer;
}

.radio-option input[type="radio"]::before {
  content: "";
  width: 0.8em;
  height: 0.8em;
  border-radius: 50%;
  transform: scale(0);
  transition: 120ms transform ease-in-out;
  box-shadow: inset 1em 1em var(--primary-green);
}

.radio-option input[type="radio"]:checked::before {
  transform: scale(1);
}

.radio-option input[type="radio"]:focus {
  outline: 2px solid var(--primary-green);
  outline-offset: 2px;
}

/* --- NEW DYNAMIC INPUTS GRID --- */
.inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Two columns on larger screens */
  gap: 12px;
}

/* Single column on mobile phones */
@media (max-width: 480px) {
  .inputs-grid {
    grid-template-columns: 1fr;
  }
}

.id-input {
  width: 100%;
  padding: 12px;
  border-radius: 6px;
  padding-left: 28px !important;
  border: 1px solid var(--border-color);
  background-color: #333;
  color: var(--text-light);
  font-size: 1rem;
  color-scheme: dark;
}

.id-input:focus {
  outline: none;
  border-color: var(--primary-green);
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}

.id-input.has-duplicate-error {
  border-color: var(--error-red) !important;
  background-color: rgba(244, 67, 54, 0.1) !important;
  box-shadow: 0 0 8px rgba(244, 67, 54, 0.4) !important;
}

.input-with-prefix {
  position: relative;
  display: flex;
  align-items: center;
}

.prefix {
  position: absolute;
  left: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  pointer-events: none; /* Allows clicks to go through to the input */
}

/* --- NEW DROPDOWN STYLES --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: 500;
  color: var(--text-secondary);
}

select {
  width: 100%;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background-color: #333;
  color: var(--text-light);
  font-size: 1rem;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 1.2em;
}

select:focus {
  outline: none;
  border-color: var(--primary-green);
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}