:root {
  /* Dark theme (default) */
  --primary-color: #2196f3;
  --success-color: #4caf50;
  --danger-color: #f44336;
  --warning-color: #ff9800;
  --info-color: #2196f3;
  --bg-dark: #1a1a1a;
  --bg-darker: #1e1e1e;
  --bg-darkest: #2c2c2c;
  --text-light: #e0e0e0;
  --text-lighter: #b0bec5;
  --border-color: #444;
  font-weight: 900;
  --border-light: rgba(255, 255, 255, 0.1);
  --card-dark: #2a2a2a;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

:root[data-theme="light"] {
  --primary-color: #138dff;
  --success-color: #2e7d32;
  --danger-color: #c62828;
  --warning-color: #f57c00;
  --info-color: #1565c0;
  --bg-dark: #f5f5f5;
  --bg-darker: #e0e0e0;
  --bg-darkest: #ffffff;
  --text-light: #212121;
  --text-lighter: #424242;
  --border-color: #bdbdbd;
  --border-light: rgba(0, 0, 0, 0.1);
  --card-dark: #ffffff;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  font-weight: 900;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-light);
  font-family: 'Roboto Mono', monospace;
  min-height: 100vh;
  opacity: 0;
  transition: opacity 0.6s ease;
  position: relative;
  font-weight: 900;
}

body.loaded {
  opacity: 1;
}

.background-pattern {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(100, 181, 246, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  z-index: -1;
  opacity: 0.3;
}

header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 15px 40px;
  background: linear-gradient(135deg, var(--bg-darker), var(--bg-darkest));
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
  border-bottom: 1px solid var(--border-light);
}

.header-title-wrapper {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

h1 {
  color: var(--primary-color);
  font-size: clamp(1.5rem, 4vw, 2rem);
  text-align: center;
  margin: 0;
  text-shadow: 0 0 5px rgba(33, 150, 243, 0.3);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.popup-container {
  position: relative;
}

.setting-row {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.setting-control {
  width: 100%;
  padding: 8px;
  background: var(--bg-darker);
  color: var(--text-light);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: 'Roboto Mono', monospace;
  font-size: 14px;
}

.setting-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.keyword-input-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.keyword-input-row .btn-small {
  white-space: nowrap;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}


.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.advanced-popup {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg-darkest);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  width: 300px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 100;
  display: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.advanced-popup::before {
  content: '';
  position: absolute;
  bottom: 100%;
  right: 12px;
  border-width: 8px;
  border-style: solid;
  border-color: transparent transparent var(--bg-darkest) transparent;
  filter: drop-shadow(0 -2px 1px rgba(0, 0, 0, 0.1));
}

.advanced-popup.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.popup-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-lighter);
  cursor: pointer;
  font-size: 16px;
  padding: 2px;
}

/* Theme Toggle Button */
.theme-toggle {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.theme-toggle svg {
  width: 24px;
  height: 24px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
}

.theme-toggle .sun-icon {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
}

.theme-toggle .moon-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

[data-theme="light"] .theme-toggle .sun-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

[data-theme="light"] .theme-toggle .moon-icon {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
}

/* Remove old switch styles */
.switch,
.slider,
.switch input {
  display: none;
}

main {
  padding: 35px;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 200px);
  position: relative;
}

.card {
  background: var(--card-dark);
  padding: 30px;
  border-radius: 15px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  margin-bottom: 30px;
  transition: transform 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
}

h2 {
  color: var(--primary-color);
  margin-bottom: 20px;
  font-size: clamp(1.5rem, 4vw, 2rem);
  text-align: center;
}

.flex-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.textarea-wrapper {
  display: flex;
  flex-direction: column;
}

textarea {
  width: 100%;
  height: 300px;
  resize: vertical;
  background-color: var(--bg-darkest);
  color: var(--text-light);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  font-family: 'Roboto Mono', monospace;
  font-size: 14px;
  margin-bottom: 15px;
  transition: border-color 0.2s ease;
}

textarea:focus {
  border-color: var(--primary-color);
  outline: none;
}

.center-buttons {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 30px;
  margin: 15px 0;
}

.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-family: 'Roboto Mono', monospace;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: white;
  font-weight: 800;
}

.btn-small {
  padding: 10px 12px !important;
  font-size: 14px !important;
}

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

.btn-primary:hover {
  background-color: #42a5f5;
  transform: translateY(-2px);
}

.btn-success {
  background-color: #028802;
}

.btn-success:hover {
  background-color: #135801;
  transform: translateY(-2px);
}

.btn-danger {
  background-color: #d10101;
}

.btn-danger:hover {
  background-color: #7c0000;
  transform: translateY(-2px);
}

.btn-copy {
  background-color: #0a73c9;
}

.btn-copy:hover {
  background-color: #03569b;
  transform: translateY(-2px);
}

[data-theme="light"] .btn-copy {
  background-color: #138dff;
}

[data-theme="light"] .btn-copy:hover {
  background-color: rgb(24, 123, 204);
}

.progress-bar {
  width: 100%;
  height: 32px;
  background: var(--bg-darkest);
  border-radius: 4px;
  margin: 20px 0;
  overflow: hidden;
  border: 1px solid var(--border-color);
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--success-color);
  transition: width 0.3s ease;
  opacity: 0.8;
}

.current-path {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-light);
  font-family: 'Roboto Mono', monospace;
  font-size: 14px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90%;
  z-index: 2;
  pointer-events: none;
}

/* Toast notification styles */
#toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--bg-darker);
  color: var(--text-light);
  padding: 16px 32px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  font-size: 16px;
  font-weight: 500;
  border: 1px solid var(--border-color);
  min-width: 250px;
  text-align: center;
  backdrop-filter: blur(8px);
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, -50%);
}

#toast.error {
  background-color: rgba(255, 59, 48, 0.9);
  color: white;
  border-color: rgba(255, 59, 48, 0.5);
}

#toast.info {
  background-color: rgba(0, 122, 255, 0.9);
  color: white;
  border-color: rgba(0, 122, 255, 0.5);
}

#toast.success {
  background-color: rgba(52, 199, 89, 0.9);
  color: white;
  border-color: rgba(52, 199, 89, 0.5);
}

/* Animation for toast appearance */
@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

#toast.show {
  animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#keywordList {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.keyword-tag {
  background: var(--primary-color);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.keyword-tag button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  margin-left: 5px;
}

#collisionSettings {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

#collisionSettings h4 {
  margin-bottom: 8px;
  font-size: 16px;
}

#downloadDuplicates {
  display: none;
  color: var(--primary-color);
  text-decoration: underline;
  cursor: pointer;
  margin-top: 10px;
  transition: color 0.2s ease;
}

#downloadDuplicates:hover {
  color: #42a5f5;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.6s ease-out;
}

@media (min-width: 992px) {
  .flex-container {
    flex-direction: row;
    align-items: stretch;
  }

  .textarea-wrapper {
    width: calc(50% - 10px);
  }

  textarea {
    height: 400px;
  }

  .center-buttons {
    flex-direction: column;
    width: 160px;
    margin: auto 10px;
  }

  .center-buttons .btn {
    height: 80px;
    padding: 10px;
  }
}

@media (max-width: 768px) {
  header {
    padding: 15px 20px;
  }

  .btn {
    padding: 10px 15px;
  }

  .center-buttons .btn {
    height: auto;
  }
}

/* Update background pattern for light theme */
[data-theme="light"] .background-pattern {
  background: radial-gradient(circle, rgba(25, 118, 210, 0.05) 1px, transparent 1px);
  opacity: 0.2;
}

/* Update header for light theme */
[data-theme="light"] header {
  background: linear-gradient(135deg, var(--bg-darker), var(--bg-darkest));
  border-bottom: 1px solid var(--border-color);
}

/* Update cards for light theme */
[data-theme="light"] .card {
  background: var(--card-dark);
  border: 1px solid var(--border-color);
}

/* Update textareas for light theme */
[data-theme="light"] textarea {
  background: var(--bg-darkest);
  color: var(--text-light);
  border: 1px solid var(--border-color);
}

/* Update buttons for light theme */
[data-theme="light"] .btn {
  color: var(--text-light);
}

[data-theme="light"] .btn-primary {
  background: #2196f3; /* Brighter blue */
}

[data-theme="light"] .btn-primary:hover {
  background: #1976d2;
  transform: translateY(-2px);
}

[data-theme="light"] .btn-success {
  background: #51d331; /* Brighter green */
}

[data-theme="light"] .btn-success:hover {
  background: #388e3c;
  transform: translateY(-2px);
}

[data-theme="light"] .btn-danger {
  background: #fa4f43; /* Brighter red */
}

[data-theme="light"] .btn-danger:hover {
  background: #9e1e1e;
  transform: translateY(-2px);
}

/* Update toast for light theme */
[data-theme="light"] .toast {
  background: var(--bg-darkest);
  color: var(--text-light);
  border: 1px solid var(--border-color);
}

/* Update advanced popup for light theme */
[data-theme="light"] .advanced-popup {
  background: var(--bg-darkest);
  border: 1px solid var(--border-color);
}

[data-theme="light"] .advanced-popup::before {
  border-color: transparent transparent var(--bg-darkest) transparent;
}

/* Update setting controls for light theme */
[data-theme="light"] .setting-control {
  background: var(--bg-darkest);
  color: var(--text-light);
  border: 1px solid var(--border-color);
}

/* Update progress bar for light theme */
[data-theme="light"] .progress-bar {
  background: var(--bg-darker);
}

[data-theme="light"] .progress-fill {
  background: var(--primary-color);
}

/* Bug Report Form Styles */
.bug-report-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.bug-report-form {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1001;
  width: 90%;
  max-width: 500px;
  background-color: var(--bg-darkest);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.bug-report-content {
  padding: 24px;
}

.bug-report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.bug-report-header h3 {
  margin: 0;
  color: var(--text-light);
  font-size: 1.25rem;
  font-weight: 500;
}

.close-button {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-lighter);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-button:hover {
  color: var(--text-light);
  background-color: rgba(255, 255, 255, 0.1);
}

.bug-report-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#bugDescription {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--bg-darker);
  color: var(--text-light);
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
}

#bugDescription:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.2);
}

#bugDescription::placeholder {
  color: var(--text-lighter);
  opacity: 0.7;
}

/* Bug Report Form Buttons */
.bug-report-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
  font-weight: 800;
}

.bug-report-buttons .btn {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 6px;
  font-weight: 800;
}

/* Bug Report Submit Button */
.bug-report-buttons .btn-primary {
  background-color: var(--primary-color);
color: var(--text-light);
}

/* Bug Report Cancel Button */
.bug-report-buttons .btn-secondary {
  background-color: var(--bg-darker);
  color: var(--text-light);
  border: 1px solid var(--border-color);
}

/* Animation for form appearance */
@keyframes bugReportFadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.bug-report-form {
  animation: bugReportFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.version-badge {
  font-size: 0.8em;
  color: var(--text-light);
  margin-left: 10px;
  vertical-align: middle;
  font-weight: 500;
}

.header-controls .version-badge {
  margin-left: 15px;
  font-size: 0.9em;
  color: var(--text-lighter);
}

h1 .version-badge {
  font-size: 0.6em;
  padding: 2px 6px;
  margin-left: 8px;
  position: relative;
  top: -2px;
}

.bug-report-button {
  width: 100%;
  margin-top: 15px;
  padding: 10px;
  background-color: #0a73c9;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Roboto Mono', monospace;
  font-size: 18px;
  transition: all 0.2s ease;
}

.bug-report-button:hover {
  background: #be7200;
  transform: translateY(-1px);
}

.bug-report-button:disabled {
  background: var(--text-lighter);
  cursor: not-allowed;
  transform: none;
}

[data-theme="light"] .bug-report-button {
  background: var(--warning-color);
  color: var(--text-light);
}

[data-theme="light"] .bug-report-button:hover {
  background: #ca7300;
}

[data-theme="light"] .bug-report-button:disabled {
  background: var(--text-lighter);
}

/* =============================================
   Button Styles
   ============================================= */

/* Convert Button */
.btn-primary {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Roboto Mono', monospace;
  font-size: 14px;
  transition: all 0.2s ease;
}

/* Clear Button */
.btn-secondary {
  background-color: var(--bg-darker);
  color: var(--text-light);
  border: 1px solid var(--border-color);
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Roboto Mono', monospace;
  font-size: 14px;
  transition: all 0.2s ease;
}

/* Copy Button */
.btn-small {
  background-color: var(--bg-darker);
  color: var(--text-light);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
  transition: all 0.2s ease;
}

/* Theme Switch Button */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 30px;
}

/* Close Button (Popup) */
.popup-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-lighter);
  cursor: pointer;
  font-size: 16px;
  padding: 2px;
}

/* Icon Buttons (Settings, etc.) */
.icon-btn {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

footer {
  text-align: center;
  padding: 18px;
  background: linear-gradient(135deg, var(--bg-darker), var(--bg-darkest));
  border-top: 1px solid var(--border-light);
  position: absolute;
  bottom: 0;
  z-index: 1;
  width: 100%;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.nav-link {
  color: var(--text-color);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.nav-link:hover {
  background-color: var(--primary-color);
  color: white;
}

[data-theme="dark"] .nav-link {
  color: var(--text-color);
}

[data-theme="dark"] .nav-link:hover {
  background-color: var(--primary-color);
  color: white;
}
