/* ===== Reset & Variables ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --bg-hover: #1f2b47;
  --bg-glass: rgba(26, 26, 46, 0.85);
  --border-color: rgba(255, 255, 255, 0.06);
  --border-active: rgba(99, 102, 241, 0.4);
  --text-primary: #e8e8f0;
  --text-secondary: #8b8ba3;
  --text-muted: #5c5c72;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-light: rgba(99, 102, 241, 0.15);
  --danger: #ef4444;
  --danger-hover: #f87171;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 14px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139, 92, 246, 0.08), transparent);
}

/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

/* ===== Search ===== */
.search-box {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-box input {
  width: 100%;
  height: 40px;
  padding: 0 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 0.93rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--border-active);
  background: var(--bg-hover);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.search-clear:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.search-clear.visible {
  display: flex;
}

/* ===== Upload Button ===== */
.upload-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.93rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
}

.upload-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.45);
}

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

.upload-btn svg {
  width: 18px;
  height: 18px;
}

/* ===== Drop Zone ===== */
.drop-zone {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 15, 26, 0.92);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
}

.drop-zone.active {
  display: flex;
}

.drop-zone-content {
  text-align: center;
  padding: 60px 80px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  background: var(--accent-light);
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: var(--accent); }
  50% { border-color: var(--accent-hover); }
}

.drop-icon {
  width: 56px;
  height: 56px;
  color: var(--accent);
  margin-bottom: 16px;
}

.drop-text {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

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

/* ===== Upload Progress ===== */
.upload-progress {
  display: none;
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 32px;
  align-items: center;
  gap: 16px;
}

.upload-progress.active {
  display: flex;
}

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

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex-shrink: 0;
  min-width: 80px;
}

/* ===== Main Content ===== */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px 60px;
}

.file-stats {
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.file-stats strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ===== Table ===== */
.table-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.file-table {
  width: 100%;
  border-collapse: collapse;
}

.file-table thead {
  background: var(--bg-card);
}

.file-table th {
  padding: 14px 20px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.file-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.93rem;
  vertical-align: middle;
}

.file-table tbody tr {
  transition: background var(--transition);
}

.file-table tbody tr:hover {
  background: var(--bg-hover);
}

.file-table tbody tr:last-child td {
  border-bottom: none;
}

/* Column widths */
.th-name { width: auto; }
.th-ext { width: 80px; }
.th-size { width: 120px; }
.th-time { width: 180px; }
.th-actions { width: 140px; text-align: center; }

/* File name cell */
.file-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.file-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
}

.file-ext {
  display: inline-block;
  padding: 3px 10px;
  background: var(--bg-card);
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
}

.file-size {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

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

/* ===== Action Buttons ===== */
.actions-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.action-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  background: transparent;
}

.action-btn svg {
  width: 16px;
  height: 16px;
}

.action-btn.download {
  color: var(--accent);
}

.action-btn.download:hover {
  background: var(--accent-light);
  color: var(--accent-hover);
}

.action-btn.delete {
  color: var(--danger);
}

.action-btn.delete:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger-hover);
}

/* ===== Empty State ===== */
.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}

.empty-state.visible {
  display: flex;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: var(--text-muted);
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state span {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
  color: var(--text-primary);
  animation: toast-in 0.3s ease;
  min-width: 260px;
  max-width: 380px;
}

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

.toast-out {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(60px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(60px);
  }
}

/* ===== File Icon Colors ===== */
.icon-image { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.icon-video { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.icon-audio { background: rgba(14, 165, 233, 0.15); color: #0ea5e9; }
.icon-document { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.icon-archive { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.icon-code { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.icon-pdf { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.icon-default { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header-inner {
    padding: 0 16px;
    gap: 12px;
  }

  .logo span {
    display: none;
  }

  .search-box {
    max-width: none;
  }

  .upload-btn span {
    display: none;
  }

  .upload-btn {
    padding: 10px 14px;
  }

  .main-content {
    padding: 16px;
  }

  .file-table th,
  .file-table td {
    padding: 12px 14px;
  }

  .th-time {
    display: none;
  }

  .td-time {
    display: none;
  }

  .file-name-text {
    max-width: 180px;
  }
}

@media (max-width: 480px) {
  .th-ext, .td-ext {
    display: none;
  }

  .th-size, .td-size {
    display: none;
  }
}
