/* Base Styles */
:root {
  --bg-color: #ffffff;
  --text-color: #333333;
  --border-color: #e0e0e0;
  --link-color: #0066cc;
  --link-hover: #004499;
  --section-bg: #f9f9f9;
  --progress-bg: #eee;
  --progress-fill: rgba(0, 123, 255, 0.8);
  --transition-time: 0.5s;
}
.dark-mode {
  --bg-color: #1a1a1a;
  --text-color: #f0f0f0;
  --border-color: #404040;
  --link-color: #66b3ff;
  --link-hover: #99ccff;
  --section-bg: #252525;
  --progress-bg: #333;
  --progress-fill: rgba(77, 171, 255, 0.8);
}
body {
  font-family: "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color var(--transition-time), color var(--transition-time);
}
.container {
  width: 100%;
  max-width: 580px;
  margin: 50px auto;
  padding: 15px;
  background: var(--bg-color);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: background-color var(--transition-time);
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
h1 {
  margin: 0;
  font-size: 2rem;
}

/* Links */
a {
  color: var(--link-color);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}
a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* Form Elements */
fieldset {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  background: var(--section-bg);
}
legend {
  padding: 0 10px;
  font-weight: bold;
}

/* Dropzone */
#dropzone {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--section-bg);
}
#dropzone:hover, #dropzone.dragging {
  border-color: var(--link-color);
  background: var(--bg-color);
}

/* Summary Section */
#summary {
  background: var(--section-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-top: 1rem;
  transition: background-color var(--transition-time), border-color var(--transition-time);
  min-height: 15px;
}
#summary h2 {
  margin: -0.2rem 0 -0.2rem;
  color: var(--text-color);
}
#summary p {
  margin: 0.25rem 0;
  font-family: monospace;
  white-space: pre;
  text-wrap: auto;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 24px;
  background: var(--progress-bg);
  position: relative;
  overflow: hidden;
  margin: 0.5rem 0;
  transition: background-color var(--transition-time);
  border: solid 1px #83bef7;
  border-radius: 4px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--progress-fill);
  width: 0%;
  transition: width 0.3s ease, background-color var(--transition-time);
}
.progress-text {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  color: var(--text-color);
  font-size: 0.9rem;
}

/* Download Button */
#downloadButton {
  display: inline-block;
  margin: 0;
  padding: 3px 10px;
  color: #ffffff !important;
  background-color: var(--progress-fill) !important;
  text-align: center;
  text-decoration: none;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
  width: auto;
}

#downloadButton:hover {
  background-color: var(--link-hover);
  transform: translateY(-1px);
}

#downloadButton:active {
  transform: translateY(1px);
}

/* Theme Toggle */
#themeToggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: background-color 0.3s, transform 0.2s;
}
#themeToggle:hover {
  background-color: var(--section-bg);
  transform: scale(1.1);
}

/* Log Section Styles */
.log-container {
  margin-top: 15px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}
.log-header {
  padding: 10px;
  background: var(--section-bg);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.log-header:hover {
  background: var(--bg-color);
}
.log-content {
  padding: 10px;
  max-height: 300px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.9em;
  background: var(--section-bg);
}
.log-content.collapsed {
  max-height: 0;
  padding: 0;
  overflow: hidden;
}
.log-entry {
  margin: 4px 0;
  padding: 4px;
  border-left: 3px solid var(--border-color);
}

.log-entry.info { border-left-color: var(--link-color); }
.log-entry.warn { border-left-color: #f0ad4e; }
.log-entry.error { border-left-color: #d9534f; }

/* Dark Mode Elements */
.dark-mode #dropzone,
.dark-mode fieldset,
.dark-mode #summary,
.dark-mode .log-container {
  background-color: #202020 !important;
}

/* Dark Mode Styles */
body.dark-mode {
  background-color: var(--bg-color);
  color: var(--text-color);
}
body.dark-mode .container {
  background-color: var(--section-bg);
  color: var(--text-color);
}
body.dark-mode .dropzone {
  background-color: var(--section-bg);
  border-color: var(--border-color);
  color: var(--text-color);
}
body.dark-mode .dropzone.dragging {
  border-color: var(--link-color);
  color: var(--text-color);
}
body.dark-mode #summary {
  background-color: var(--section-bg);
  border-color: var(--border-color);
}
body.dark-mode #summary a {
  color: var(--link-color);
}
body.dark-mode #themeToggle:hover {
  background-color: var(--border-color);
}

/* Tooltip Styles */
.tooltip {
  position: relative;
  cursor: pointer;
}
.tooltip::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #333;
  color: #fff;
  padding: 5px;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 12px;
  opacity: 0;
  visibility: hidden;
  padding: 5px 7px;
  transition: opacity 0.2s ease-in-out;
  z-index: 1000;
  border: solid 1px #ccc;
}
.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}
label[title]:hover::after {
  content: attr(title);
  position: absolute;
  background: #333;
  color: #fff;
  padding: 5px;
  border-radius: 5px;
  font-size: 12px;
  z-index: 10;
}