/* Base Reset and Theme */
body {
  font-family: system-ui, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f9f9f9;
  color: #222;
  transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
  background-color: #121212;
  color: #f9f9f9;
}

/* Container */
.container {
  max-width: 600px;
  margin: auto;
  padding: 2rem;
}

/* Typography and Headings */
h1 {
  text-align: center;
  margin-bottom: 1.5rem;
}

/* Labels and Fields */
label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

input,
select,
textarea {
  display: block;
  width: 100%;
  padding: 0.6rem;
  margin-bottom: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  background-color: white;
  color: #222;
  box-sizing: border-box;
}

input,
select {
  height: 42px;
  line-height: normal;
}

/* Select Styling Consistency */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg fill='black' viewBox='0 0 24 24' width='24' height='24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 1rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #007bff;
}

/* Dark Mode Fields */
body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select {
  background-color: #1f1f1f;
  color: #f9f9f9;
  border: 1px solid #555;
}

body.dark-mode select {
  background-image: url("data:image/svg+xml,%3Csvg fill='white' viewBox='0 0 24 24' width='24' height='24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}

/* Validation Styling */
body.dark-mode input:invalid,
body.dark-mode textarea:invalid,
body.dark-mode select:invalid {
  border: 2px solid #ff4d4d !important;
  box-shadow: 0 0 5px 1px #ff4d4d;
  outline: none;
}

/* Buttons */
button {
  background-color: #007bff;
  color: white;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  margin-right: 0.5rem;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: #0056b3;
}

button.processing {
  background-color: #999 !important;
  animation: pulse 1s ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* QR Code Container */
#qrcode {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
}

/* API Preview Section */
.api-preview {
  margin-top: 2rem;
  font-family: monospace;
}

#api-syntax {
  display: block;
  background-color: #eee;
  padding: 0.8rem;
  border-radius: 5px;
  cursor: pointer;
  word-break: break-word;
  margin-top: 0.5rem;
}

body.dark-mode #api-syntax {
  background-color: #2a2a2a;
  color: #ddd;
}

.toggle-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.toggle-description {
  flex: 1 1 auto;
}

/* Toggle Switches */
.dark-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  top: 0; left: 0;
  right: 0; bottom: 0;
  background-color: #ccc;
  border-radius: 24px;
  transition: 0.4s;
  cursor: pointer;
}

.slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.4s;
}

.switch input:checked + .slider {
  background-color: #007bff;
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
}
