:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --secondary-color: #e5e7eb;
  --secondary-hover: #d1d5db;
  --text-color: #1f2937;
  --text-light: #6b7280;
  --background-color: #ffffff;
  --background-alt: #f9fafb;
  --border-color: #e5e7eb;
  --error-color: #ef4444;
  --success-color: #10b981;
  --radius: 0.5rem;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --transition: all 0.2s ease-in-out;
}

/* Dark theme */
.dark-theme {
  --primary-color: #3b82f6;
  --primary-hover: #60a5fa;
  --secondary-color: #374151;
  --secondary-hover: #4b5563;
  --text-color: #f9fafb;
  --text-light: #9ca3af;
  --background-color: #111827;
  --background-alt: #1f2937;
  --border-color: #374151;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  color: var(--text-color);
  background-color: var(--background-alt);
  line-height: 1.5;
  transition: var(--transition);
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

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

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

.subtitle {
  color: var(--text-light);
  margin-bottom: 1rem;
}

/* 右上角固定的主題切換按鈕 */
.theme-toggle-fixed {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
}

#theme-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text-color);
  padding: 0.5rem;
  border-radius: 50%;
  background-color: var(--background-color);
  box-shadow: var(--shadow);
  transition: var(--transition);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#theme-toggle-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.dark-theme .dark-icon {
  display: none;
}

.dark-theme .light-icon {
  display: inline-block;
}

.light-icon {
  display: none;
}

/* Main content */
.main-content {
  background-color: var(--background-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 2rem;
}

/* Form */
.wkt-form {
  padding: 1.5rem;
}

.format-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(59, 130, 246, 0.1);
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.format-label {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.format-desc {
  font-size: 0.875rem;
  color: var(--text-light);
}

.toggle-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-label {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Switch toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
}

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

input:checked + .slider {
  background-color: var(--primary-color);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary-color);
}

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

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Input group */
.input-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  background-color: var(--background-color);
  color: var(--text-color);
  transition: var(--transition);
  resize: vertical;
}

textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.help-text {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-light);
}

/* Conversion mode */
.conversion-mode {
  margin-bottom: 1.5rem;
}

.radio-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}

.radio-option {
  position: relative;
}

.radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-option label {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  background-color: var(--background-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.radio-option input[type="radio"]:checked + label {
  border-color: var(--primary-color);
  background-color: rgba(59, 130, 246, 0.1);
}

.radio-title {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.radio-desc {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Buttons */
.action-buttons {
  display: flex;
  gap: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1rem;
}

.btn i {
  margin-right: 0.5rem;
}

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

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

.btn-secondary {
  background-color: var(--secondary-color);
  color: var(--text-color);
}

.btn-secondary:hover {
  background-color: var(--secondary-hover);
}

.btn-icon {
  padding: 0.5rem;
  font-size: 1rem;
  border-radius: 50%;
  background-color: var(--background-alt);
}

/* Result container */
.result-container {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.result-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.result-content {
  background-color: var(--background-alt);
  border-radius: var(--radius);
  padding: 1rem;
  min-height: 100px;
}

pre {
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-all;
}

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

/* Examples */
.examples {
  margin-bottom: 2rem;
}

.examples h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  text-align: center;
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.example-card {
  background-color: var(--background-color);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.example-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.example-card p {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.example-card code {
  font-family: monospace;
  background-color: var(--background-alt);
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.8125rem;
}

/* Footer */
.footer {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-light);
  padding: 1rem 0;
}

.highlight {
  color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
  .format-toggle {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .toggle-container {
    width: 100%;
    justify-content: space-between;
  }
  
  .radio-group {
    grid-template-columns: 1fr;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .example-grid {
    grid-template-columns: 1fr;
  }
}
