/* ================================
   FLink — Stylesheet
   ================================ */

:root {
  --bg: #0a0a0f;
  --bg-2: #12121a;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);
  --text: #f5f5f7;
  --text-muted: #8b8b9a;
  --text-dim: #5a5a6a;
  --primary: #8b5cf6;
  --primary-2: #6366f1;
  --primary-glow: rgba(139, 92, 246, 0.4);
  --accent: #ec4899;
  --success: #10b981;
  --danger: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: #f7f7fb;
  --bg-2: #ffffff;
  --surface: rgba(0, 0, 0, 0.02);
  --surface-hover: rgba(0, 0, 0, 0.04);
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.18);
  --text: #0a0a0f;
  --text-muted: #6b6b7a;
  --text-dim: #9a9aaa;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Background Orbs */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.35;
  animation: float 20s ease-in-out infinite;
}

.orb-1 {
  width: 500px; height: 500px;
  background: var(--primary);
  top: -150px; left: -100px;
}

.orb-2 {
  width: 400px; height: 400px;
  background: var(--accent);
  bottom: -100px; right: -100px;
  animation-delay: -7s;
}

.orb-3 {
  width: 350px; height: 350px;
  background: var(--primary-2);
  top: 40%; left: 50%;
  animation-delay: -14s;
}

[data-theme="light"] .orb { opacity: 0.15; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(50px, -50px) scale(1.1); }
  66% { transform: translate(-30px, 30px) scale(0.95); }
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 1.25rem;
}

.logo-mark {
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  color: white;
  box-shadow: 0 4px 20px var(--primary-glow);
}

.logo-mark svg { width: 20px; height: 20px; }

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav a:hover {
  color: var(--text);
  background: var(--surface);
}

.theme-toggle {
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* Hero */
.hero {
  padding: 80px 0 40px;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero-title {
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto;
}

.hero-subtitle code {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.9em;
  color: var(--primary);
}

/* Upload Section */
.upload-section {
  padding: 40px 0;
}

.dropzone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 60px 24px;
  background: var(--surface);
  transition: var(--transition);
  cursor: pointer;
  overflow: hidden;
}

.dropzone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, var(--primary-glow), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.dropzone.dragover::before,
.dropzone:hover::before {
  opacity: 0.3;
}

.dropzone.dragover {
  transform: scale(1.01);
}

.dropzone-inner {
  position: relative;
  text-align: center;
  z-index: 1;
}

.dropzone-icon {
  width: 72px; height: 72px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  box-shadow: 0 8px 32px var(--primary-glow);
  animation: bounce 3s ease-in-out infinite;
}

.dropzone-icon svg { width: 32px; height: 32px; }

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.dropzone h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.dropzone p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.dropzone-hint {
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px var(--primary-glow);
}

.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 14px;
  font-size: 0.85rem;
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-hover);
}

.btn-block { width: 100%; }

/* Queue */
.queue {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.queue-thumb {
  width: 44px; height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg-2);
  flex-shrink: 0;
}

.queue-info {
  flex: 1;
  min-width: 0;
}

.queue-name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.queue-progress {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.queue-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 999px;
}

.queue-status {
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}

.queue-status.success { color: var(--success); }
.queue-status.error { color: var(--danger); }
.queue-status.loading { color: var(--primary); }

/* Results Section */
.results-section {
  padding: 60px 0 80px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Result Card */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.result-preview {
  aspect-ratio: 16 / 10;
  background: var(--bg-2);
  position: relative;
  overflow: hidden;
}

.result-preview img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.result-card:hover .result-preview img {
  transform: scale(1.05);
}

.result-badge {
  position: absolute;
  top: 10px; right: 10px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
}

.result-body {
  padding: 14px 16px 16px;
}

.result-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.result-size {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.result-link {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 10px;
}

.result-link input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: 'SF Mono', Monaco, monospace;
  outline: none;
  min-width: 0;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 40px;
  gap: 6px;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.action-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

.action-btn svg { width: 14px; height: 14px; }

.action-btn.danger {
  padding: 9px;
  color: var(--text-muted);
}

.action-btn.danger:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* Footer */
.footer {
  padding: 32px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}

.footer a:hover { text-decoration: underline; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow);
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  transition: var(--transition);
}

.modal-close:hover { color: var(--text); }

.modal-content h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.modal-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  word-break: break-all;
}

.qr-wrapper {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  display: inline-block;
}

.qr-wrapper canvas {
  display: block;
  width: 220px !important;
  height: 220px !important;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  font-weight: 500;
  animation: slideInRight 0.3s ease;
  max-width: 340px;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--primary); }

/* Responsive */
@media (max-width: 640px) {
  .container { padding: 0 18px; }
  .hero { padding: 50px 0 30px; }
  .dropzone { padding: 40px 18px; }
  .dropzone-icon { width: 60px; height: 60px; }
  .dropzone h3 { font-size: 1.1rem; }
  .results-grid { grid-template-columns: 1fr; }
  .toast-container { left: 18px; right: 18px; bottom: 18px; }
  .toast { max-width: 100%; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .nav a { display: none; }
}