:root {
  --bg-main: #090d16;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-hover: rgba(24, 33, 53, 0.95);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  
  --accent-purple: #8b5cf6;
  --accent-blue: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background Ambient Glows */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

.bg-glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #4f46e5, transparent);
  top: -150px;
  left: 10%;
}

.bg-glow-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #8b5cf6, transparent);
  bottom: -200px;
  right: 5%;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: rgba(9, 13, 22, 0.8);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff, #cbd5e1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
  margin-left: 6px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Content Layout */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.page-header {
  text-align: center;
  max-width: 650px;
  margin: 0 auto;
}

.page-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 12px;
  background: linear-gradient(180deg, #ffffff 30%, #94a3b8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

/* Stats Row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-blue { background: rgba(56, 189, 248, 0.12); color: var(--accent-blue); }
.stat-icon-purple { background: rgba(139, 92, 246, 0.12); color: var(--accent-purple); }
.stat-icon-emerald { background: rgba(16, 185, 129, 0.12); color: var(--accent-emerald); }
.stat-icon-amber { background: rgba(245, 158, 11, 0.12); color: var(--accent-amber); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Upload Hero Zone */
.upload-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dropzone {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 2px dashed rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-xl);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.upload-icon-wrapper {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--primary);
  transition: transform 0.25s ease;
}

.dropzone:hover .upload-icon-wrapper {
  transform: scale(1.08);
  background: rgba(99, 102, 241, 0.18);
}

.dropzone-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.dropzone-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.highlight-browse {
  color: #818cf8;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dropzone-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
}

.badge-subtle {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

/* Upload Queue Panel */
.upload-queue-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.queue-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.queue-badge {
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  padding: 2px 10px;
  border-radius: 12px;
}

.queue-items-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  max-height: 200px;
  overflow-y: auto;
}

.queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.queue-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.queue-item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
  font-weight: 500;
}

.queue-item-size {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

.queue-item-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}

.queue-item-remove:hover {
  color: var(--accent-rose);
}

/* Progress bar */
.queue-progress-bar-container {
  margin-bottom: 16px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent-purple));
  border-radius: 8px;
  transition: width 0.2s ease;
  background-size: 30px 30px;
  background-image: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.15) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.15) 75%,
    transparent 75%,
    transparent
  );
  animation: progressStripe 1s linear infinite;
}

@keyframes progressStripe {
  0% { background-position: 0 0; }
  100% { background-position: 30px 0; }
}

.queue-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Documents Toolbar */
.docs-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pill-counter {
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 9px;
  border-radius: 12px;
  color: var(--text-muted);
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-box input {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 36px 8px 36px;
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
  width: 240px;
  transition: all 0.2s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  width: 280px;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
}

/* Document Grid */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.doc-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.25s ease;
  position: relative;
}

.doc-card:hover {
  transform: translateY(-3px);
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: var(--shadow-md);
  background: var(--bg-card-hover);
}

.doc-card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.doc-pdf-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(244, 63, 94, 0.12);
  color: var(--accent-rose);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.doc-pdf-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  display: block;
}

.doc-meta {
  flex: 1;
  min-width: 0;
}

.doc-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.doc-details {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.doc-detail-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Share Link Box in Card */
.doc-link-container {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.doc-link-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #a5b4fc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-copy-link {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-copy-link:hover {
  background: var(--primary);
  color: #fff;
}

.btn-copy-link.copied {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #fff;
}

.btn-copy-link svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  display: block;
  flex-shrink: 0;
}

/* Card Actions */
.doc-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 14px;
  margin-top: 2px;
}

.card-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.btn {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-sm {
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

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

.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
  background: var(--accent-rose);
  color: #fff;
}

.btn-danger:hover {
  background: #e11d48;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  display: block;
  pointer-events: none;
}

.btn-icon:hover {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon-danger {
  color: var(--text-dim);
}

.btn-icon-danger:hover {
  color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.1);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  background: var(--bg-card);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-xl);
}

.empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-dim);
}

.empty-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.empty-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Modal Backdrops & Cards */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: #111827;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 24px;
  box-shadow: var(--shadow-md);
  animation: modalScale 0.2s ease;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-icon-danger {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-icon-info {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-body {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.modal-filename {
  color: var(--text-main);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Share Modal Custom */
.share-modal-body {
  margin-bottom: 20px;
}

.share-doc-title {
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-link-input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.share-link-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: #818cf8;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.share-quick-actions {
  display: flex;
  gap: 10px;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #1e293b;
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideInRight 0.25s ease;
  min-width: 260px;
}

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

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

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

/* Responsive adjustments */
@media (max-width: 768px) {
  .nav-container {
    padding: 12px 16px;
  }
  .status-indicator {
    display: none;
  }
  .main-content {
    padding: 24px 16px 60px;
  }
  .page-title {
    font-size: 1.8rem;
  }
  .docs-grid {
    grid-template-columns: 1fr;
  }
  .search-box input {
    width: 100%;
  }
  .search-box input:focus {
    width: 100%;
  }
  .docs-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}
