/* CSS Variables for theming */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --border-color: #dee2e6;
  --accent-color: #007bff;
  --accent-hover: #0056b3;
  --success-color: #28a745;
  --error-color: #dc3545;
  --warning-color: #ffc107;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
  --border-radius: 8px;
  --transition: all 0.3s ease;
}

/* Dark mode variables */
[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-tertiary: #3a3a3a;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --border-color: #4a4a4a;
  --accent-color: #4dabf7;
  --accent-hover: #339af0;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: var(--transition);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
  position: relative;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.subtitle {
  position: absolute;
  top: 60px;
  left: 0;
  font-size: 1rem;
  color: var(--text-secondary);
  font-style: italic;
}

.theme-toggle {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 10px 15px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1.2rem;
}

.theme-toggle:hover {
  background: var(--bg-tertiary);
  box-shadow: var(--shadow);
}

/* Main content */
main {
  flex: 1;
}

/* Upload section */
.upload-section {
  margin-bottom: 40px;
}

.drop-zone {
  border: 3px dashed var(--border-color);
  border-radius: var(--border-radius);
  padding: 60px 40px;
  text-align: center;
  background: var(--bg-secondary);
  transition: var(--transition);
  cursor: pointer;
}

.drop-zone:hover {
  border-color: var(--accent-color);
  background: var(--bg-tertiary);
}

.drop-zone.dragover {
  border-color: var(--accent-color);
  background: var(--bg-tertiary);
  box-shadow: var(--shadow-hover);
}

.drop-zone-content h2 {
  font-size: 1.8rem;
  margin: 20px 0 10px;
  color: var(--text-primary);
}

.drop-zone-content p {
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.upload-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.file-info {
  font-size: 0.9rem;
  font-style: italic;
}

.upload-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: var(--accent-color);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  box-shadow: var(--shadow);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* File list */
.file-list {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 30px;
  margin-top: 30px;
  box-shadow: var(--shadow);
}

.file-list h3 {
  margin-bottom: 20px;
  color: var(--text-primary);
}

#files {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  margin-bottom: 10px;
  border: 1px solid var(--border-color);
}

.file-name {
  font-weight: 500;
  color: var(--text-primary);
}

.file-size {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.file-resolution {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 2px;
}

.file-resolution.resize {
  color: var(--accent-color);
  font-weight: 500;
}

.file-resolution.original {
  color: var(--success-color);
}

.file-resolution.error {
  color: var(--error-color);
  font-style: italic;
}

.file-remove {
  background: var(--error-color);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: var(--transition);
}

.file-remove:hover {
  opacity: 0.8;
}

/* Conversion Options */
.conversion-options {
  margin: 30px 0;
  padding: 25px;
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.conversion-options h4 {
  margin-bottom: 20px;
  color: var(--text-primary);
  font-size: 1.2rem;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.option-group {
  display: flex;
  flex-direction: column;
}

.option-group label {
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.option-group small {
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.form-select {
  padding: 10px 12px;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: var(--transition);
}

.form-select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.quality-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  outline: none;
  -webkit-appearance: none;
  transition: var(--transition);
}

.quality-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.quality-slider::-webkit-slider-thumb:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-hover);
}

.quality-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow);
}

.quality-slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  border: none;
}

.upload-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
}

/* Progress section */
.progress-section {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 30px;
  text-align: center;
  box-shadow: var(--shadow);
}

.progress-container {
  max-width: 500px;
  margin: 0 auto;
}

.progress-bar {
  width: 100%;
  height: 20px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  overflow: hidden;
  margin: 20px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color), var(--success-color));
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 10px;
}

.current-file {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 10px;
}

/* Result section */
.result-section,
.error-section {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow);
}

.result-section p,
.error-section p {
  white-space: pre-line;
  text-align: left;
  max-width: 600px;
  margin: 20px auto;
  line-height: 1.6;
}

.result-content,
.error-content {
  max-width: 500px;
  margin: 0 auto;
}

.success-icon,
.error-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.result-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
}

/* Footer */
footer {
  margin-top: 40px;
  padding: 20px;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.privacy-notice p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0;
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .subtitle {
    position: static;
    margin-top: 5px;
  }
  
  header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  
  .drop-zone {
    padding: 40px 20px;
  }
  
  .upload-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .upload-actions,
  .result-actions {
    flex-direction: column;
  }
  
  .options-grid {
    grid-template-columns: 1fr;
  }
  
  .file-item {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
  
  .info-section {
    grid-template-columns: 1fr;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}
