/* ── ConvertIt — Dark theme with cyan-orange gradient accent ── */

:root {
  --bg-primary: #0b0d12;
  --bg-secondary: #12151e;
  --bg-card: #181c2a;
  --bg-card-hover: #1e2338;
  --border: #272b40;
  --border-light: #343956;
  --text: #e6e8f0;
  --text-muted: #8a8fa6;
  --text-dim: #585d78;
  --accent: #0ea5e9;
  --accent-light: #67d4fc;
  --accent-glow: rgba(14, 165, 233, 0.3);
  --secondary: #f59e0b;
  --secondary-light: #fbbf24;
  --success: #10b981;
  --success-light: #6ee7b7;
  --danger: #ef4444;
  --warning: #f59e0b;
  --gradient: linear-gradient(135deg, #0ea5e9, #f59e0b);
  --gradient-cool: linear-gradient(135deg, #0ea5e9, #8b5cf6);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 4px 30px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 40px rgba(14, 165, 233, 0.15);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Subtle animated background */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 25% 15%, rgba(14,165,233,0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 75% 85%, rgba(245,158,11,0.04) 0%, transparent 50%);
  animation: bgDrift 25s ease-in-out infinite alternate;
  z-index: -1;
  pointer-events: none;
}

@keyframes bgDrift {
  0%   { transform: translate(0, 0) }
  100% { transform: translate(-3%, 3%) }
}

/* ── Header ── */
header {
  text-align: center;
  padding: 3rem 1.5rem 1.5rem;
}

.logo {
  font-size: 3.2rem;
  margin-bottom: 0.5rem;
  display: inline-block;
  animation: spin-float 4s ease-in-out infinite;
}

@keyframes spin-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-6px) rotate(10deg); }
  50% { transform: translateY(0) rotate(0deg); }
  75% { transform: translateY(-4px) rotate(-10deg); }
}

header h1 {
  font-size: 2.4rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-top: 0.4rem;
}

/* ── Main ── */
main {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
}

/* ── Format Badges ── */
.format-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.badge {
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-image { background: rgba(14,165,233,0.15); color: var(--accent-light); border: 1px solid rgba(14,165,233,0.3); }
.badge-video { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.badge-audio { background: rgba(245,158,11,0.15); color: var(--secondary-light); border: 1px solid rgba(245,158,11,0.3); }
.badge-doc { background: rgba(16,185,129,0.15); color: var(--success-light); border: 1px solid rgba(16,185,129,0.3); }
.badge-ocr { background: rgba(139,92,246,0.15); color: #c4b5fd; border: 1px solid rgba(139,92,246,0.3); }

/* ── Drop Zone ── */
.drop-zone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient);
  opacity: 0;
  transition: opacity 0.3s;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.drop-zone:hover::before, .drop-zone.dragover::before {
  opacity: 0.05;
}

.drop-zone-inner {
  position: relative;
  z-index: 1;
}

.drop-icon {
  color: var(--text-dim);
  margin-bottom: 1rem;
  transition: var(--transition);
}

.drop-zone:hover .drop-icon { color: var(--accent-light); transform: translateY(-4px); }

.drop-text {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.browse-link {
  color: var(--accent-light);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.browse-link:hover { color: #fff; }

.drop-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ── Progress ── */
.progress-bar {
  margin-top: 1.5rem;
}

.progress-track {
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s;
}

.progress-text {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ── File Card ── */
.file-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1.5rem;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.file-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.file-card-icon { font-size: 2.2rem; flex-shrink: 0; }
.file-card-info { flex: 1; min-width: 0; }

.file-card-name {
  font-weight: 600;
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-card-meta {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin-top: 0.3rem;
}

.category-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.category-tag.image { background: rgba(14,165,233,0.2); color: var(--accent-light); }
.category-tag.video { background: rgba(239,68,68,0.2); color: #fca5a5; }
.category-tag.audio { background: rgba(245,158,11,0.2); color: var(--secondary-light); }
.category-tag.document { background: rgba(16,185,129,0.2); color: var(--success-light); }

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

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon:hover { color: var(--danger); border-color: var(--danger); }

/* ── Target Format Selector ── */
.format-section {
  margin-bottom: 1.5rem;
}

.format-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.8rem;
}

.target-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.target-btn {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font);
}

.target-btn:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  background: rgba(14,165,233,0.08);
}

.target-btn.selected {
  border-color: var(--accent);
  background: rgba(14,165,233,0.15);
  color: var(--accent-light);
  box-shadow: 0 0 12px rgba(14,165,233,0.2);
}

.target-btn.audio-extract {
  border-color: rgba(245,158,11,0.4);
  color: var(--secondary-light);
}
.target-btn.audio-extract:hover,
.target-btn.audio-extract.selected {
  border-color: var(--secondary);
  background: rgba(245,158,11,0.12);
  color: var(--secondary-light);
  box-shadow: 0 0 12px rgba(245,158,11,0.2);
}

.target-btn.ocr-btn {
  border-color: rgba(139,92,246,0.4);
  color: #c4b5fd;
}
.target-btn.ocr-btn:hover,
.target-btn.ocr-btn.selected {
  border-color: #8b5cf6;
  background: rgba(139,92,246,0.12);
  color: #c4b5fd;
  box-shadow: 0 0 12px rgba(139,92,246,0.2);
}

.target-btn.frame-btn {
  border-color: rgba(16,185,129,0.4);
  color: var(--success-light);
}
.target-btn.frame-btn:hover,
.target-btn.frame-btn.selected {
  border-color: var(--success);
  background: rgba(16,185,129,0.12);
  color: var(--success-light);
  box-shadow: 0 0 12px rgba(16,185,129,0.2);
}

.target-divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 0.4rem 0;
}

.target-group-label {
  width: 100%;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 0.3rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
}

.btn-large {
  width: 100%;
  justify-content: center;
  padding: 1rem;
  font-size: 1.05rem;
}

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 30px rgba(14,165,233,0.5);
  transform: translateY(-1px);
}

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

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

.btn-success {
  background: linear-gradient(135deg, #10b981, #0ea5e9);
  color: #fff;
  box-shadow: 0 4px 20px rgba(16,185,129,0.3);
}

.btn-success:hover {
  box-shadow: 0 6px 30px rgba(16,185,129,0.5);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.7rem 1.5rem;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-light);
}

/* ── Result Card ── */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  margin-top: 1.5rem;
  animation: slideUp 0.4s ease;
}

.result-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.result-badge {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #0ea5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.8rem;
  color: #fff;
  animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

@keyframes popIn {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.result-header h3 {
  font-size: 1.4rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-details {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
}

.result-key {
  color: var(--text-muted);
  font-size: 0.9rem;
}

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

.result-val-new {
  color: var(--accent-light);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

/* ── Converting Spinner ── */
.converting {
  text-align: center;
  padding: 3rem 1rem;
  margin-top: 1.5rem;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-right-color: var(--secondary);
  border-radius: 50%;
  margin: 0 auto 1.2rem;
  animation: spin 0.8s linear infinite;
}

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

.converting-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.converting-hint {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ── Matrix Section ── */
.matrix-section {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1.5rem 3rem;
}

.matrix-section h2 {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.matrix-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.2rem;
  transition: var(--transition);
}

.matrix-group:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(14,165,233,0.1);
}

.matrix-group h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.matrix-group p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-dim);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--danger);
  color: var(--text);
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 999;
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 4px 30px rgba(239,68,68,0.2);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Utilities ── */
.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 640px) {
  header { padding: 2rem 1rem 1rem; }
  header h1 { font-size: 1.9rem; }
  main { padding: 0 1rem 2rem; }
  .drop-zone { padding: 2rem 1.2rem; }
  .matrix-grid { grid-template-columns: 1fr; }
  .target-btn { padding: 0.4rem 0.7rem; font-size: 0.78rem; }
}
