/* ── FileSquish — Dark theme with vibrant gradient accent ── */

:root {
  --bg-primary: #0f1117;
  --bg-secondary: #161822;
  --bg-card: #1c1f2e;
  --bg-card-hover: #232640;
  --border: #2a2d42;
  --border-light: #363a54;
  --text: #e8e9f0;
  --text-muted: #8b8fa3;
  --text-dim: #5c6078;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --accent-glow: rgba(108, 92, 231, 0.3);
  --success: #00b894;
  --success-light: #55efc4;
  --danger: #e17055;
  --warning: #fdcb6e;
  --gradient: linear-gradient(135deg, #6c5ce7, #00b894);
  --gradient-warm: linear-gradient(135deg, #e17055, #fdcb6e);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 40px rgba(108, 92, 231, 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;
}

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

.logo {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  animation: float 3s ease-in-out infinite;
}

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

header h1 {
  font-size: 2.2rem;
  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: 560px;
  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(108, 92, 231, 0.15); color: var(--accent-light); border: 1px solid rgba(108, 92, 231, 0.3); }
.badge-video { background: rgba(225, 112, 85, 0.15); color: var(--danger); border: 1px solid rgba(225, 112, 85, 0.3); }
.badge-audio { background: rgba(253, 203, 110, 0.15); color: var(--warning); border: 1px solid rgba(253, 203, 110, 0.3); }
.badge-pdf { background: rgba(0, 184, 148, 0.15); color: var(--success-light); border: 1px solid rgba(0, 184, 148, 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(108, 92, 231, 0.2); color: var(--accent-light); }
.category-tag.video { background: rgba(225, 112, 85, 0.2); color: var(--danger); }
.category-tag.audio { background: rgba(253, 203, 110, 0.2); color: var(--warning); }
.category-tag.pdf { background: rgba(0, 184, 148, 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); }

/* ── Quality Slider ── */
.quality-section {
  margin-bottom: 1.5rem;
}

.quality-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.quality-header label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.quality-val {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-light);
  min-width: 3em;
  text-align: right;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  outline: none;
}

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

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gradient);
  cursor: pointer;
  border: 3px solid var(--bg-card);
}

.quality-hints {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
  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 {
  box-shadow: 0 6px 30px rgba(108, 92, 231, 0.5);
  transform: translateY(-1px);
}

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

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

.btn-success {
  background: linear-gradient(135deg, #00b894, #00cec9);
  color: #fff;
  box-shadow: 0 4px 20px rgba(0, 184, 148, 0.3);
}

.btn-success:hover {
  box-shadow: 0 6px 30px rgba(0, 184, 148, 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 {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--bg-secondary);
}

/* ── Compressing Spinner ── */
.compressing {
  text-align: center;
  padding: 3rem 0;
  animation: slideUp 0.3s ease;
}

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

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

.compressing-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.compressing-hint {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

/* ── 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.5s ease;
}

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

.result-circle {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto;
}

.result-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--bg-secondary);
  stroke-width: 8;
}

.ring-fg {
  fill: none;
  stroke: url(#ringGradient);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.result-percent {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.result-details {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-bottom: 1.5rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
}

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

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

.result-val-compressed { color: var(--success-light); }
.result-val-saved { color: var(--accent-light); }

.result-actions {
  display: flex;
  gap: 0.75rem;
}

.result-actions .btn-success { flex: 1; }
.result-actions .btn-ghost { flex-shrink: 0; }

/* ── Formats Section ── */
.formats-section {
  max-width: 700px;
  margin: 2rem auto 0;
  padding: 0 1.5rem 2rem;
}

.formats-section h2 {
  text-align: center;
  font-size: 1.3rem;
  margin-bottom: 1.2rem;
  color: var(--text-muted);
  font-weight: 600;
}

.formats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.format-group {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
}

.format-group h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

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

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

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 9999;
  transition: transform 0.3s ease;
  max-width: 90vw;
}

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

.toast.success { background: var(--success); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }

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

/* ── Responsive ── */
@media (max-width: 640px) {
  header { padding-top: 2rem; }
  header h1 { font-size: 1.7rem; }
  .subtitle { font-size: 0.9rem; }
  main { padding: 0 1rem 2rem; }
  .drop-zone { padding: 2rem 1rem; }
  .file-card { padding: 1rem; }
  .result-card { padding: 1.5rem 1rem; }
  .formats-grid { grid-template-columns: 1fr 1fr; }
  .result-actions { flex-direction: column; }
}

@media (max-width: 380px) {
  .format-badges { gap: 0.3rem; }
  .badge { font-size: 0.7rem; padding: 0.25rem 0.6rem; }
  .formats-grid { grid-template-columns: 1fr; }
}
