/* Theme Variables */
:root {
  /* Light theme (default) */
  --bg-primary: #ffffff;
  --bg-secondary: #f8d8dc;
  --text-primary: #050404;
  --text-secondary: #444;
  --accent-primary: #e34c5c;
  --accent-secondary: #eea2ac;
  --border-color: #f8d8dc;
  --disabled-color: #888;
  --shadow-color: rgba(227, 76, 92, 0.2);

  /* Add new emphasis variables */
  --emphasis-shadow: 0 4px 20px rgba(227, 76, 92, 0.3);
  --emphasis-border: 3px solid #e34c5c;
  --subdued-opacity: 0.4;
  --disabled-opacity: 0.2;
  --converting-bg: #888;
  --converting-text: #fff;
  --converting-shadow: 0 2px 10px rgba(136, 136, 136, 0.3);
}

/* Dark theme */
[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --accent-primary: #e34c5c;
  --accent-secondary: #eea2ac;
  --border-color: #444;
  --disabled-color: #666;
  --shadow-color: rgba(227, 76, 92, 0.3);

  /* Dark theme specific emphasis */
  --emphasis-shadow: 0 4px 25px rgba(227, 76, 92, 0.45);
  --emphasis-border: 3px solid #e34c5c;
  --subdued-opacity: 0.25;
  --disabled-opacity: 0.1;
  --converting-bg: #4a4a4a;
  --converting-text: #eea2ac;
  --converting-shadow: 0 2px 15px rgba(238, 162, 172, 0.2);
}

/* Theme Toggle Button */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.theme-toggle button {
  background: var(--accent-primary);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  transition: all 0.3s ease;
  box-shadow: var(--emphasis-shadow);
}

.theme-toggle button:hover {
  background: var(--accent-secondary);
  transform: scale(1.1) rotate(15deg);
}

.theme-toggle svg {
  width: 24px;
  height: 24px;
  fill: var(--bg-primary);
}

.theme-toggle .sun-icon {
  display: none;
}

[data-theme="dark"] .sun-icon {
  display: block;
}

[data-theme="dark"] .moon-icon {
  display: none;
}

/* Update existing styles with CSS variables */
body {
  font-family: "Segoe UI", Arial, sans-serif;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

h1 {
  text-align: center;
  color: var(--text-primary);
  margin-bottom: 10px;
  font-size: 2.5em;
  font-weight: 600;
}

p {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 30px;
}

input,
button {
  padding: 12px 20px;
  font-size: 16px;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.3s;
}

input[type="file"] {
  display: none;
}

/* Drop Zone */
.drop-zone {
  border: var(--emphasis-border);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  transition: all 0.3s ease;
  background: var(--bg-primary);
  cursor: pointer;
  margin-bottom: 20px;
  box-shadow: var(--emphasis-shadow);
}

.drop-zone:hover {
  box-shadow: var(--emphasis-shadow);
  transform: translateY(-2px);
}

.drop-zone.hover {
  border-style: solid;
  border-color: var(--accent-primary);
  box-shadow: var(--emphasis-shadow);
  transform: translateY(-2px);
  opacity: 1;
}

.drop-zone.disabled {
  border: 2px dashed var(--disabled-color);
  opacity: var(--disabled-opacity);
  cursor: not-allowed;
  box-shadow: none;
}

.drop-zone.disabled:hover {
  transform: none;
  box-shadow: none;
}

.drop-zone-content {
  pointer-events: none;
}

.drop-zone .icon {
  font-size: 48px;
  margin-bottom: 15px;
  color: var(--accent-primary);
}

.drop-zone p {
  margin: 5px 0;
  color: var(--text-secondary);
}

/* Browse Button */
.browse-btn {
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-top: 10px;
  box-shadow: 0 2px 4px var(--shadow-color);
}

.browse-btn:hover {
  background: var(--accent-secondary);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(227, 76, 92, 0.3);
}

/* File List */
.file-list-container {
  margin: 20px 0;
  max-height: 200px;
  overflow-y: auto;
  padding: 0 5px;
}

#fileList {
  list-style: none;
  padding: 0;
}

/* ИСПРАВЛЕННЫЕ СТИЛИ ДЛЯ FILE LIST ITEMS */
#fileList li {
  position: relative;
  padding: 12px 50px 12px 16px;
  background: white;
  margin-bottom: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 4px rgba(136, 136, 136, 0.1);
  color: var(--text-secondary);
  font-size: 0.95em;
  border: 1px solid var(--bg-secondary);
  border-left: 3px solid var(--accent-primary);
  transition: all 0.3s ease;
  overflow: hidden;
  min-height: 45px;
}

/* Иконка файла */
#fileList li:before {
  content: "📄";
  margin-right: 10px;
  position: relative;
  z-index: 2;
}

/* File name */
#fileList li .file-name {
  position: relative;
  z-index: 2;
  flex: 1;
  word-break: break-word;
}

/* Progress text */
#fileList li .file-progress-text {
  position: relative;
  z-index: 2;
  font-size: 12px;
  color: var(--accent-primary);
  font-weight: 600;
  margin-left: 8px;
  white-space: nowrap;
}

/* Progress background - зеленая заливка */
.file-progress-bg {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(
    90deg,
    rgba(76, 175, 80, 0.25),
    rgba(139, 195, 74, 0.25)
  );
  transition: width 0.5s ease;
  z-index: 1;
  pointer-events: none;
}

/* Remove button */
.remove-file {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  z-index: 3;
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 20px;
  cursor: pointer;
  padding: 0 8px;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.remove-file:hover {
  opacity: 1;
}

.remove-file.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* File complete state */
.file-complete .file-progress-bg {
  background: linear-gradient(
    90deg,
    rgba(76, 175, 80, 0.4),
    rgba(139, 195, 74, 0.4)
  );
}

.file-complete .file-progress-text {
  color: #4CAF50;
}

/* Convert Button Container */
.convert-container {
  position: sticky;
  bottom: 20px;
  background: linear-gradient(to top, var(--bg-primary) 80%, transparent);
  padding: 20px 0;
  text-align: center;
  z-index: 100;
}

/* Convert Button */
.convert-btn {
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: 14px 36px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: var(--emphasis-shadow);
  margin: 0 auto;
  opacity: 1;
}

.convert-btn:not(:disabled) {
  background: var(--accent-primary);
}

.convert-btn:not(:disabled):hover {
  background: var(--accent-secondary);
  transform: translateY(-2px);
  box-shadow: var(--emphasis-shadow);
}

.convert-btn:disabled {
  background: var(--converting-bg);
  color: var(--converting-text);
  opacity: 0.9;
  box-shadow: var(--converting-shadow);
  cursor: not-allowed;
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--converting-text);
  border-top: 3px solid transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Toast Notifications */
.toastify {
  padding: 16px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--emphasis-shadow);
}

.toastify.success {
  background: var(--accent-primary) !important;
}

.toastify.error {
  background: var(--accent-secondary) !important;
  color: var(--text-primary) !important;
}

/* Rating Stars Section */
.full-stars {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--bg-secondary);
}

.full-stars .rating-group {
  display: inline-flex;
  gap: 4px;
}

.full-stars label a svg {
  width: 32px;
  height: 32px;
  transition: all 0.3s ease;
}

.full-stars label:hover a svg {
  transform: scale(1.1);
}

/* Disabled state for rating during conversion */
.full-stars.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Drop zone states */
.drop-zone.subdued {
  border: 2px dashed var(--border-color);
  opacity: var(--subdued-opacity);
  box-shadow: none;
  background: var(--bg-secondary);
}

.drop-zone.subdued:hover {
  opacity: calc(var(--subdued-opacity) + 0.2);
  border-color: var(--accent-secondary);
  box-shadow: 0 2px 10px var(--shadow-color);
  transform: translateY(-1px);
}

/* Dark theme specific adjustments */
[data-theme="dark"] #fileList li {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .file-progress-bg {
  background: linear-gradient(
    90deg,
    rgba(76, 175, 80, 0.35),
    rgba(139, 195, 74, 0.35)
  );
}

[data-theme="dark"] .file-complete .file-progress-bg {
  background: linear-gradient(
    90deg,
    rgba(76, 175, 80, 0.5),
    rgba(139, 195, 74, 0.5)
  );
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* Responsive Design */
@media (max-width: 600px) {
  body {
    padding: 15px;
  }

  h1 {
    font-size: 2em;
  }

  .drop-zone {
    padding: 30px 15px;
  }

  .convert-btn {
    width: 90%;
    padding: 12px 24px;
  }
  
  #fileList li {
    padding-right: 40px;
  }
}