/* Modern Dark Mode Design */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #141922;
  --bg-tertiary: #1e2530;
  --bg-hover: #252d3d;

  --text-primary: #e4e6eb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --accent-primary: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #60a5fa;

  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;

  --border-color: #2d3748;
  --shadow: rgba(0, 0, 0, 0.5);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-primary) 0%, #0f1419 100%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.header {
  text-align: center;
  padding: 40px 0;
  margin-bottom: 40px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px var(--shadow);
}

.header-content {
  max-width: 600px;
  margin: 0 auto;
}

.title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  background: linear-gradient(135deg, var(--accent-light), var(--accent-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.title .icon {
  width: 40px;
  height: 40px;
  stroke: var(--accent-primary);
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* Upload Section */
.upload-section {
  margin-bottom: 30px;
}

.upload-area {
  background: var(--bg-secondary);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--accent-primary);
  background: var(--bg-tertiary);
  transform: translateY(-2px);
}

.upload-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  stroke: var(--accent-primary);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.upload-area h3 {
  font-size: 1.5rem;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.upload-area p {
  color: var(--text-secondary);
}

/* Preview Container */
.preview-container {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 30px;
  margin-top: 30px;
  border: 1px solid var(--border-color);
}

.preview-container h3 {
  margin-bottom: 20px;
  color: var(--text-primary);
}

.preview-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 10px;
}

/* List view for file selection */
.preview-item-list {
  display: flex;
  align-items: center;
  gap: 15px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.preview-item-list:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
}

.file-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.file-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--accent-primary);
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
  font-weight: 500;
}

.file-size {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.file-remove {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.file-remove:hover {
  background: var(--danger);
  border-color: var(--danger);
}

.file-remove svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-secondary);
}

.file-remove:hover svg {
  stroke: white;
}

/* Options Section */
.options-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 30px;
  margin-bottom: 30px;
  border: 1px solid var(--border-color);
}

.options-section h3 {
  margin-bottom: 20px;
  color: var(--text-primary);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.input-group {
  display: flex;
  flex-direction: column;
}

.input-group label {
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

.input-group input,
.input-group select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: var(--transition);
}

.input-group input:focus,
.input-group select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

/* Buttons */
.action-buttons {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.btn {
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.btn-icon {
  width: 20px;
  height: 20px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-light));
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent-primary));
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  transform: translateY(-2px);
}

/* Progress Section */
.progress-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 30px;
  margin-bottom: 30px;
  border: 1px solid var(--border-color);
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: var(--bg-tertiary);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 15px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-light));
  border-radius: 999px;
  transition: width 0.3s ease;
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { opacity: 1; }
  50% { opacity: 0.8; }
  100% { opacity: 1; }
}

.progress-text {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Results Section */
.results-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 30px;
  border: 1px solid var(--border-color);
}

.results-section h3 {
  margin-bottom: 20px;
  color: var(--text-primary);
}

.results-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 10px;
  margin-bottom: 30px;
}

/* List view for results */
.result-item-list {
  display: flex;
  align-items: center;
  gap: 15px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 15px;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.result-item-list:hover {
  background: var(--bg-hover);
  border-color: var(--success);
}

.result-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid var(--success);
}

.result-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--success);
}

.result-info {
  flex: 1;
  min-width: 0;
}

.result-name {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 6px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.result-stats .separator {
  color: var(--border-color);
}

.result-savings {
  font-size: 0.9rem;
  font-weight: 600;
}

.result-savings.positive {
  color: var(--success);
}

.result-savings.negative {
  color: var(--warning);
}

.download-btn-compact {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--accent-primary);
  color: white;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.download-btn-compact:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.download-btn-compact svg {
  width: 20px;
  height: 20px;
}

.result-item.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
  padding: 15px;
}

.error-text {
  color: var(--danger);
  font-size: 0.9rem;
}

/* Footer */
.footer {
  text-align: center;
  padding: 30px 0;
  margin-top: 40px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
  .title {
    font-size: 2rem;
  }

  .upload-area {
    padding: 40px 20px;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

  .action-buttons {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .preview-grid,
  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

/* Back Button */
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: var(--transition);
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.back-button:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
}

.back-button svg {
  width: 18px;
  height: 18px;
}

/* Rename Preview Box */
.rename-preview-box {
  background: var(--bg-tertiary);
  border: 2px dashed var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  margin-bottom: 25px;
}

.rename-preview-box h4 {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.rename-preview-box span {
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 1.3rem;
}

/* Help Text */
.help-text {
  background: rgba(59, 130, 246, 0.1);
  border-left: 3px solid var(--accent-primary);
  padding: 15px;
  border-radius: var(--radius-sm);
  margin-top: 20px;
  margin-bottom: 20px;
}

.help-text p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.help-text p:last-child {
  margin-bottom: 0;
}

.help-text strong {
  color: var(--accent-light);
}

/* File Preview Name */
.file-preview-name {
  color: var(--accent-light) !important;
  font-size: 0.85rem !important;
  font-weight: 500;
  margin-top: 4px;
}

/* Info Banner */
.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 30px;
}

.info-banner svg {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  stroke: var(--accent-primary);
  margin-top: 2px;
}

.info-banner div {
  flex: 1;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.info-banner strong {
  color: var(--accent-light);
  font-weight: 600;
}

/* Progress Subtext */
.progress-subtext {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 8px;
  font-style: italic;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}
