:root {
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --red-500: #ef4444;
  --green-500: #10b981;

  --primary: #4f46e5;
  --primary-hover: #4338ca;

  --bg-body: linear-gradient(135deg, #f5f7fa 0%, #eef1f5 100%);
  --bg-card: #ffffff;
  --bg-upload: transparent;
  --bg-upload-hover: var(--gray-50);
  --bg-input: #ffffff;
  --bg-output: var(--gray-100);

  --text-main: var(--gray-800);
  --text-muted: var(--gray-700);
  --text-placeholder: var(--gray-500);

  --border-color: var(--gray-200);
  --border-input: var(--gray-300);
  --border-upload: var(--gray-300);

  --shadow-card: 0 10px 25px rgba(0, 0, 0, 0.05);

  --bg-btn-disabled: var(--gray-200);
  --text-btn-disabled: var(--gray-700);
}

[data-theme="dark"] {
  --primary: #6366f1;
  --primary-hover: #818cf8;

  --bg-body: #0a0a0a;
  --bg-card: #171717;
  --bg-upload: rgba(255, 255, 255, 0.03);
  --bg-upload-hover: rgba(255, 255, 255, 0.08);
  --bg-input: #171717;
  --bg-output: #0a0a0a;

  --text-main: #ededed;
  --text-muted: #a1a1aa;
  --text-placeholder: #71717a;

  --border-color: #27272a;
  --border-input: #27272a;
  --border-upload: #27272a;

  --shadow-card:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

  --bg-btn-disabled: #27272a;
  --text-btn-disabled: #52525b;
}

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

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  line-height: 1.5;
  transition:
    background 0.3s,
    color 0.3s;
}

.container {
  display: flex;
  max-width: 900px;
  width: 90%;
  background-color: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-top: auto;
  margin-bottom: 1rem;
  transition:
    background-color 0.3s,
    box-shadow 0.3s;
}

.panel {
  flex: 1;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
}

.divider {
  width: 1px;
  background-color: var(--border-color);
}

h2 {
  font-weight: 600;
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-main);
}

.upload-area {
  background-color: var(--bg-upload);
  border: 2px dashed var(--border-upload);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  margin-bottom: 1.5rem;
  transition: all 0.2s;
  cursor: pointer;
  height: 180px;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--primary);
  background-color: var(--bg-upload-hover);
}

.upload-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.file-input {
  display: none;
}

.button {
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s;
  width: 100%;
}

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

.button:disabled,
.button[disabled] {
  background-color: var(--bg-btn-disabled);
  color: var(--text-btn-disabled);
  cursor: not-allowed;
}

.button:disabled:hover,
.button[disabled]:hover {
  background-color: var(--bg-btn-disabled);
  color: var(--text-btn-disabled);
}

.output {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 8px;
  background-color: var(--bg-output);
  color: var(--text-main);
  height: 6rem;
  max-height: 6rem;
  overflow-y: auto;
  white-space: pre-wrap;
  font-size: 0.9rem;
}

.success {
  color: var(--green-500);
  font-weight: 500;
}

.error {
  color: var(--red-500);
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-input);
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.loading {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.progress-container {
  display: none;
  margin-top: 1rem;
}

.progress-track {
  width: 100%;
  height: 8px;
  background-color: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  border-radius: 4px;
  transition: width 0.15s ease;
  position: relative;
}

.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.prefix-group {
  margin-bottom: 1rem;
}

.prefix-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.prefix-optional {
  font-weight: 400;
  color: var(--text-placeholder);
}

.prefix-input {
  margin-bottom: 0.5rem;
}

.prefix-hint {
  font-size: 0.8rem;
  color: var(--text-placeholder);
}

.prefix-hint strong {
  color: var(--primary);
  font-weight: 600;
}

.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  transition: all 0.2s;
}

.theme-toggle:hover {
  background: var(--bg-upload-hover);
  transform: translateY(-1px);
}

.moon-icon {
  display: none;
}

.sun-icon {
  display: block;
}

[data-theme="dark"] .moon-icon {
  display: block;
}

[data-theme="dark"] .sun-icon {
  display: none;
}

footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: auto;
  width: 100%;
}

footer a {
  color: var(--primary);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .container {
    flex-direction: column;
    width: 95%;
    margin-top: 1rem;
    margin-bottom: 1rem;
  }

  .panel {
    padding: 1.5rem;
  }

  .divider {
    width: 100%;
    height: 1px;
  }
}
