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

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #eef2ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.08);
}

body.dark-mode {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --border: #334155;
  --border-hover: #475569;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-light: #1e1b4b;
  --shadow: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.5);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(99,102,241,0.04) 0%, transparent 60%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Nav */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.navbar .logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.navbar .logo .logo-img {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  object-fit: contain;
}

.navbar .logo .logo-word {
  display: inline-flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
}

.navbar .logo .lg-accent { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  flex-shrink: 0;
}

.nav-links li {
  display: flex;
  align-items: center;
}

.nav-links a, .nav-links button {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: 0.15s;
  white-space: nowrap;
}

.nav-links a:hover, .nav-links .theme-toggle:hover { background: var(--surface-hover); color: var(--text-primary); }
.nav-links a.active { background: var(--accent-light); color: var(--accent); }

/* Main container */
.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 24px;
}

.container-wide {
  max-width: 1280px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-padded { padding: 32px; }

/* Landing hero */
.hero {
  text-align: center;
  margin-bottom: 40px;
}

.hero h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-secondary);
  font-size: 18px;
  max-width: 480px;
  margin: 0 auto;
}

/* Action cards */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: 0.2s;
}

.action-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.action-card .icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.action-card h2 {
  font-size: 20px;
  margin-bottom: 6px;
}

.action-card p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

input, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: 0.15s;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.key-row {
  display: flex;
  gap: 10px;
}

.key-row input {
  flex: 1;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 4px;
  text-align: center;
}

.key-row button {
  width: auto;
  padding: 10px 16px;
  font-size: 18px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: 0.15s;
  flex-shrink: 0;
}

.key-row button:hover {
  background: var(--border);
  color: var(--text-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: 0.15s;
}

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

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-full { width: 100%; }

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: 0.2s;
  background: var(--bg);
  margin-bottom: 24px;
  position: relative;
}

.dropzone::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  border: 2px dashed transparent;
  transition: 0.3s;
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}

@keyframes dashMove {
  to { stroke-dashoffset: -20; }
}

.dropzone.drag-over::before {
  border-color: var(--accent);
  animation: dashMove 0.5s linear infinite;
}

.dropzone .dz-icon {
  font-size: 48px;
  margin-bottom: 12px;
  transition: 0.3s;
}

.dropzone.has-file .dz-icon {
  transform: scale(0.8);
  opacity: 0.6;
}

.dropzone .dz-text {
  color: var(--text-secondary);
  font-size: 16px;
}

.dropzone .dz-text span {
  color: var(--accent);
  font-weight: 500;
}

.dropzone .dz-hint {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

.dropzone .dz-preview {
  display: none;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: left;
}

.dropzone .dz-preview.show {
  display: flex;
}

.dropzone .dz-preview img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.dropzone .dz-preview .dz-preview-info {
  flex: 1;
  min-width: 0;
}

.dropzone .dz-preview .dz-preview-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropzone .dz-preview .dz-preview-size {
  font-size: 12px;
  color: var(--text-muted);
}

/* Success card */
.success-card {
  text-align: center;
  padding: 40px 32px;
}

.success-card .check {
  font-size: 56px;
  margin-bottom: 12px;
}

.success-card h2 {
  margin-bottom: 4px;
}

.success-card p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.success-detail {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.success-detail > div {
  flex: 1;
  min-width: 0;
}

.success-detail .label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.success-detail .value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--accent);
}

.success-detail .value.link-value {
  font-size: 14px;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--accent);
  word-break: break-all;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.success-detail.success-detail-link > div {
  text-align: left;
}

.success-detail.success-detail-link .copy-btn {
  align-self: flex-start;
}

.copy-btn {
  padding: 6px 14px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 500;
  transition: 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.copy-btn:hover { background: var(--surface-hover); border-color: var(--accent); color: var(--accent); }
.copy-btn.copied { background: var(--success-light); border-color: var(--success); color: var(--success); }

/* File list (multi-file upload) */
.file-list {
  display: none;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-height: 220px;
  overflow-y: auto;
}

.file-list.show { display: block; }

.file-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.file-list-item:last-child { border-bottom: none; }

.file-list-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-list-size {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.file-list-remove {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: 0.15s;
}

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

.file-list-total {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg);
  text-align: right;
}

/* QR code on success card */
.qr-container {
  display: block;
  margin: 8px 0 0;
  text-align: center;
}

.qr-container img {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: #ffffff;
}

/* File grid */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: 0.2s;
  display: flex;
  flex-direction: column;
}

.file-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.file-card .file-icon {
  font-size: 40px;
  margin-bottom: 12px;
  line-height: 1;
  transition: 0.2s;
}

.file-card:hover .file-icon {
  transform: scale(1.1);
}

.file-card .file-name {
  font-weight: 600;
  font-size: 14px;
  word-break: break-word;
  margin-bottom: 4px;
}

.file-card .file-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.file-card .file-uploader {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.file-card .btn {
  width: 100%;
}

/* Search bar */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}

.search-bar input {
  flex: 1;
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 16px;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  width: 100%;
  max-width: 400px;
  margin: 24px;
  text-align: center;
}

.modal h3 {
  margin-bottom: 4px;
}

.modal .modal-file {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.modal .key-input {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 5px;
  text-align: center;
}

.key-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
}

.key-input-row .key-input {
  flex: 1;
  margin-bottom: 0;
}

.key-input-row button {
  width: auto;
  padding: 10px 14px;
  font-size: 16px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: 0.15s;
  flex-shrink: 0;
}

.key-input-row button:hover {
  background: var(--border);
  color: var(--text-primary);
}

.modal .error-msg {
  color: var(--danger);
  font-size: 14px;
  margin-bottom: 12px;
  display: none;
}

.modal .error-msg.show {
  display: block;
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  transition: 0.15s;
  display: flex;
  align-items: center;
}
.theme-toggle:hover { background: var(--surface-hover); color: var(--text-primary); }

/* SVG icons */
.icon-svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.icon-lg { width: 48px; height: 48px; }
.icon-sm { width: 18px; height: 18px; }

/* Animations */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-in {
  animation: fadeInUp 0.5s ease both;
}
.animate-in-fade {
  animation: fadeIn 0.4s ease both;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  max-width: 400px;
  animation: toastIn 0.3s ease;
}

.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-error { border-left: 4px solid var(--danger); }
.toast.toast-info { border-left: 4px solid var(--accent); }

.toast .toast-icon { flex-shrink: 0; line-height: 1; }
.toast .toast-msg { flex: 1; }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
  display: none;
}
.progress-bar.active { display: block; }
.progress-bar .progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Button ripple */
.btn {
  position: relative;
  overflow: hidden;
}
.btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: scale(0);
  animation: rippleAnim 0.6s ease-out;
  pointer-events: none;
}
@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* Skeleton loaders */
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
  background: var(--border);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  background-size: 200px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.skeleton-card .skeleton {
  margin-bottom: 10px;
}

.skeleton-card .skeleton:last-child {
  width: 60%;
}

.skeleton-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.skeleton-text {
  height: 14px;
  width: 100%;
}

.skeleton-text-sm {
  height: 12px;
  width: 70%;
}

.skeleton-btn {
  height: 32px;
  width: 100%;
  border-radius: 6px;
  margin-top: 8px;
}

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

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

/* Utils */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-24 { margin-bottom: 24px; }

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.back-link:hover {
  color: var(--text-primary);
}

/* Responsive - Tablet & below */
@media (max-width: 768px) {
  .card-padded { padding: 24px; }
}

@media (max-width: 640px) {
  .action-grid {
    grid-template-columns: 1fr;
  }

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

  .navbar {
    padding: 0 12px;
    height: 56px;
  }

  .container {
    padding: 24px 16px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .hero p {
    font-size: 16px;
  }

  .toast-container {
    right: 8px;
    left: 8px;
    top: 64px;
  }

  .toast {
    max-width: 100%;
    padding: 12px 16px;
    font-size: 13px;
  }

  .key-row input {
    font-size: 18px;
    letter-spacing: 3px;
  }

  .action-card {
    padding: 28px 20px;
  }
}

@media (max-width: 480px) {
  .file-grid {
    grid-template-columns: 1fr;
  }

  .success-detail {
    flex-direction: column;
    text-align: center;
  }

  .hero h1 {
    font-size: 24px;
  }

  .hero p {
    font-size: 15px;
  }

  .nav-links a, .nav-links .theme-toggle {
    padding: 8px 10px;
    font-size: 13px;
  }

  .navbar .logo {
    font-size: 17px;
  }

  .dropzone {
    padding: 32px 16px;
  }

  .dropzone .dz-preview {
    flex-direction: column;
    text-align: center;
  }

  .dropzone .dz-preview img {
    width: 64px;
    height: 64px;
  }

  .modal {
    padding: 24px 20px;
    margin: 16px;
  }

  .success-card {
    padding: 28px 20px;
  }
}

@media (max-width: 400px) {
  .hero h1 {
    font-size: 20px;
  }

  .hero p {
    font-size: 14px;
  }

  .nav-links {
    gap: 0;
  }

  .nav-links a, .nav-links .theme-toggle {
    padding: 8px 8px;
    font-size: 12px;
  }

  .navbar .logo {
    font-size: 15px;
    gap: 4px;
  }

  .container {
    padding: 16px 12px;
  }

  .key-row {
    flex-wrap: wrap;
  }

  .key-row input {
    font-size: 16px;
    letter-spacing: 2px;
  }

  .key-row button {
    width: 100%;
  }

  .action-card {
    padding: 20px 16px;
  }

  .action-card .icon svg {
    width: 36px;
    height: 36px;
  }

  .action-card h2 {
    font-size: 17px;
  }

  .file-card {
    padding: 16px;
  }

  .file-card .file-icon {
    font-size: 32px;
  }

  .search-bar input {
    font-size: 14px;
    padding: 8px 12px;
  }
}
