/* ===== Google Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ===== CSS Variables ===== */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-glass: rgba(255, 255, 255, 0.08);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --success: #22c55e;
  --success-glow: rgba(34, 197, 94, 0.2);
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ===== Background Gradient Orbs ===== */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.4;
  z-index: 0;
  pointer-events: none;
}

body::before {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-primary), transparent 70%);
  top: -200px;
  right: -100px;
}

body::after {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-secondary), transparent 70%);
  bottom: -150px;
  left: -100px;
}

/* ===== App Container ===== */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

/* ===== Header ===== */
.header {
  text-align: center;
  margin-bottom: 48px;
}

.header__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  box-shadow: 0 0 30px var(--accent-glow);
  margin-bottom: 20px;
  font-size: 32px;
  animation: float 3s ease-in-out infinite;
}

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

.header__title {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #f1f5f9 0%, #6366f1 50%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.header__subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ===== Card ===== */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(99, 102, 241, 0.15);
}

.card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card__title span {
  font-size: 1.1rem;
}

/* ===== Drop Zone ===== */
.drop-zone {
  position: relative;
  border: 2px dashed rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-glass);
  overflow: hidden;
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
  opacity: 0;
  transition: var(--transition);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent-primary);
  transform: scale(1.01);
}

.drop-zone:hover::before,
.drop-zone.drag-over::before {
  opacity: 1;
}

.drop-zone.drag-over {
  box-shadow: 0 0 30px var(--accent-glow);
}

.drop-zone__icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
  transition: var(--transition);
}

.drop-zone:hover .drop-zone__icon {
  transform: translateY(-4px);
}

.drop-zone__text {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.drop-zone__hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.drop-zone__input {
  display: none;
}

/* ===== Settings ===== */
.settings {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.setting-row__label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-row__value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-primary);
  min-width: 40px;
  text-align: right;
}

/* ===== Range Slider ===== */
.slider-wrapper {
  flex: 1;
  max-width: 300px;
  display: flex;
  align-items: center;
  gap: 12px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--accent-primary) 0%, var(--accent-primary) var(--value, 80%), rgba(255,255,255,0.1) var(--value, 80%), rgba(255,255,255,0.1) 100%);
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-glow);
  cursor: pointer;
  transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 20px var(--accent-glow);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-glow);
  cursor: pointer;
  border: none;
}

/* ===== File List ===== */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  animation: slideIn 0.3s ease-out forwards;
  opacity: 0;
  transform: translateY(10px);
}

@keyframes slideIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.file-item__preview {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

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

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

.file-item__size {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.file-item__status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.file-item__status--pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.file-item__status--done {
  background: var(--success-glow);
  color: var(--success);
}

.file-item__status--error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.file-item__remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
  border-radius: 50%;
  transition: var(--transition);
  flex-shrink: 0;
  line-height: 1;
}

.file-item__remove:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* ===== Buttons ===== */
.btn-group {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

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

.btn--primary {
  flex: 1;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn--primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(99, 102, 241, 0.4);
}

.btn--primary:active:not(:disabled) {
  transform: translateY(0);
}

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

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

.btn--secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* ===== Progress ===== */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 16px;
  display: none;
}

.progress-bar.active {
  display: block;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

/* ===== Stats ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.stat {
  text-align: center;
  padding: 16px 8px;
  background: var(--bg-glass);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.stat__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 4px;
}

.stat__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.4s ease-out;
  min-width: 280px;
  max-width: 400px;
}

.toast--success {
  border-left: 3px solid var(--success);
}

.toast--error {
  border-left: 3px solid var(--danger);
}

.toast--info {
  border-left: 3px solid var(--accent-primary);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast-exit {
  animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.empty-state__icon {
  font-size: 2rem;
  margin-bottom: 8px;
  display: block;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .app-container {
    padding: 24px 16px 40px;
  }

  .header__title {
    font-size: 1.8rem;
  }

  .card {
    padding: 20px;
  }

  .drop-zone {
    padding: 32px 16px;
  }

  .setting-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .slider-wrapper {
    max-width: 100%;
    width: 100%;
  }

  .stats {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn--primary {
    width: 100%;
  }
}

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

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ===== Pulse Animation for Convert Button ===== */
.btn--primary.ready {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 20px var(--accent-glow); }
  50% { box-shadow: 0 4px 30px rgba(99, 102, 241, 0.5); }
}

/* ===== Converting Spinner ===== */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
