:root {
    --background: #ffffff;
    --foreground: #020817;
    --card: #ffffff;
    --card-foreground: #020817;
    --popover: #ffffff;
    --popover-foreground: #020817;
    --primary: #1a73e8;
    --primary-foreground: #f8f9fa;
    --secondary: #f1f3f5;
    --secondary-foreground: #202124;
    --muted: #f8f9fa;
    --muted-foreground: #5f6368;
    --accent: #f1f3f5;
    --accent-foreground: #202124;
    --destructive: #d93025;
    --destructive-foreground: #f8f9fa;
    --border: #e0e0e0;
    --input: #e0e0e0;
    --ring: #1a73e8;
    --radius: 0.5rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    margin: 0;
    padding: 1rem;
}

.container {
    width: 100%;
    max-width: 450px;
    margin: auto;
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    position: relative;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--card-foreground);
}

.form-group, .dynamic-section {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.input {
    display: block;
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    border: 1px solid var(--input);
    border-radius: calc(var(--radius) - 2px);
    background-color: var(--background);
    color: var(--foreground);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box; /* Ensures padding doesn't affect width */
}

.input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

/* Fix input and Choices.js field background/text color for dark mode */
.input,
.choices,
.choices__inner,
.choices__input {
  background-color: var(--background) !important;
  color: var(--foreground) !important;
  border-color: var(--input) !important;
}

.choices__list--multiple .choices__item {
  background-color: var(--primary) !important;
  color: var(--primary-foreground) !important;
  border-color: var(--primary) !important;
}

.choices__list--dropdown,
.choices__list[aria-expanded] {
  background-color: var(--background) !important;
  color: var(--foreground) !important;
}

.choices__item--selectable.is-highlighted {
  background-color: var(--primary) !important;
  color: var(--primary-foreground) !important;
}

.choices,
.choices__inner {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

.choices[data-type*="select-multiple"] .choices__inner {
    padding-bottom: 0.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

.btn-primary:hover {
    background-color: #1868cf;
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: #e8eaed;
}

.dynamic-input-group {
    position: relative;
    padding: 1.5rem 1rem 1rem 1rem; /* Added top padding for the button */
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.dynamic-input-group > *:not(.btn-remove) {
    margin-bottom: 0.75rem;
}

.btn-remove {
    position: absolute;
    top: 0.05rem; /* Adjusted position */
    right: 0.5rem; /* Adjusted position */
    width: 24px;   /* Added fixed size */
    height: 24px;  /* Added fixed size */
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--muted-foreground);
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.btn-remove:hover {
    color: var(--destructive);
}


.description {
    font-size: 0.8rem;
    color: var(--muted-foreground);
    margin-top: -0.25rem;
    padding: 0.5rem;
    background-color: var(--muted);
    border-radius: calc(var(--radius) - 4px);
}

.output-display {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: var(--muted);
    border-radius: var(--radius);
    font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
    font-size: 0.875rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid var(--border);
}

.is-invalid .choices__input {
    background-color: #fff0f0; /* Light red background on validation error */
}

/* Light/Dark mode toggle styles */
.mode-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  z-index: 10;
  transition: background 0.2s, color 0.2s;
  overflow: visible;
}
.mode-toggle:hover {
  background: var(--primary);
  color: var(--primary-foreground);
}
.mode-toggle svg {
  display: block;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  overflow: visible;
}

.error-message {
    color: var(--destructive);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}