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

:root,
[data-theme="light"] {
  --bg: #f3f6fb;
  --bg-glow-1: radial-gradient(900px 420px at 15% -10%, rgba(37, 99, 235, 0.08), transparent 65%);
  --bg-glow-2: radial-gradient(700px 360px at 88% -5%, rgba(217, 119, 6, 0.06), transparent 60%);
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --surface-hover: #f8fafc;
  --header-bg: rgba(255, 255, 255, 0.82);
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --input-bg: #f8fafc;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: rgba(37, 99, 235, 0.09);
  --primary-glow: 0 6px 18px rgba(37, 99, 235, 0.25);
  --gold: #b45309;
  --accent-bg: rgba(14, 165, 233, 0.1);
  --accent-border: rgba(14, 165, 233, 0.22);
  --accent-text: #0369a1;
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.08);
  --danger-border: rgba(220, 38, 38, 0.25);
  --success: #16a34a;
  --shadow-card: 0 10px 30px -10px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.04);
  --radius: 14px;
  --pill-dir-bg: rgba(217, 119, 6, 0.12);
  --pill-dir-fg: #b45309;
  --pill-exe-bg: rgba(37, 99, 235, 0.11);
  --pill-exe-fg: #1d4ed8;
  --pill-zip-bg: rgba(124, 58, 237, 0.11);
  --pill-zip-fg: #6d28d9;
  --pill-pdf-bg: rgba(220, 38, 38, 0.1);
  --pill-pdf-fg: #b91c1c;
  --pill-vid-bg: rgba(22, 163, 74, 0.11);
  --pill-vid-fg: #15803d;
  --pill-def-bg: rgba(100, 116, 139, 0.12);
  --pill-def-fg: #475569;
}

[data-theme="dark"] {
  --bg: #060913;
  --bg-glow-1: radial-gradient(960px 460px at 18% -12%, rgba(56, 189, 248, 0.14), transparent 62%);
  --bg-glow-2: radial-gradient(820px 420px at 86% -10%, rgba(217, 164, 65, 0.11), transparent 60%);
  --surface: rgba(15, 22, 38, 0.78);
  --surface-solid: #0f1626;
  --surface-hover: rgba(30, 41, 66, 0.55);
  --header-bg: rgba(9, 13, 25, 0.8);
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --muted: #8b9bb4;
  --input-bg: rgba(15, 23, 42, 0.85);
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-soft: rgba(59, 130, 246, 0.15);
  --primary-glow: 0 6px 22px rgba(59, 130, 246, 0.35);
  --gold: #eab308;
  --accent-bg: rgba(234, 179, 8, 0.1);
  --accent-border: rgba(234, 179, 8, 0.26);
  --accent-text: #facc15;
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --danger-border: rgba(248, 113, 113, 0.3);
  --success: #34d399;
  --shadow-card: 0 22px 50px -15px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --radius: 14px;
  --pill-dir-bg: rgba(245, 158, 11, 0.16);
  --pill-dir-fg: #fbbf24;
  --pill-exe-bg: rgba(59, 130, 246, 0.18);
  --pill-exe-fg: #60a5fa;
  --pill-zip-bg: rgba(167, 139, 250, 0.18);
  --pill-zip-fg: #c4b5fd;
  --pill-pdf-bg: rgba(248, 113, 113, 0.16);
  --pill-pdf-fg: #fca5a5;
  --pill-vid-bg: rgba(52, 211, 153, 0.16);
  --pill-vid-fg: #6ee7b7;
  --pill-def-bg: rgba(148, 163, 184, 0.14);
  --pill-def-fg: #cbd5e1;
}

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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background-color: var(--bg);
  background-image: var(--bg-glow-1), var(--bg-glow-2);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

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

.header-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.brand-logo-img {
  height: 34px;
  width: auto;
  display: block;
  object-fit: contain;
  transition: filter 0.25s ease, transform 0.2s ease;
}

.brand:hover .brand-logo-img {
  transform: translateY(-1px);
}

[data-theme="dark"] .brand-logo-img {
  filter: brightness(0) invert(1) drop-shadow(0 2px 10px rgba(96, 165, 250, 0.28));
}

.brand-divider {
  width: 1px;
  height: 28px;
  background: var(--border-strong);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-text span {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.search-box {
  flex: 1;
  min-width: 220px;
  max-width: 440px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 10px 36px 10px 40px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  transition: all 0.18s ease;
}

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

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: inline-flex;
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  display: none;
  padding: 4px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Theme toggle (Sun / Moon) */
.theme-toggle {
  width: 38px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.lang-switch {
  display: inline-flex;
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 3px;
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-btn:hover { color: var(--text); }

.lang-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.admin-nav-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 13px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  transition: all 0.15s ease;
}

.admin-nav-link:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.search-section {
  margin-bottom: 24px;
}

.search-box-hero {
  max-width: 100%;
}

.search-box-hero input {
  padding: 13px 40px 13px 46px;
  font-size: 14.5px;
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.search-box-hero .search-icon {
  left: 16px;
}

.folder-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  border-radius: 8px;
  background: var(--pill-dir-bg);
  color: var(--pill-dir-fg);
  flex-shrink: 0;
}

.selection-bar {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 18px;
  border-radius: 13px;
  background: var(--primary-soft);
  border: 1px solid rgba(59, 130, 246, 0.35);
  box-shadow: var(--shadow-card);
}

.selection-bar.show {
  display: flex;
}

.selection-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.selection-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.selection-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: 12px;
  color: var(--text);
  max-width: 340px;
}

.selection-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-chip button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 2px;
  font-size: 13px;
  line-height: 1;
}

.selection-chip button:hover {
  color: var(--danger);
}

.selection-info {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.chk-cell {
  width: 40px;
  text-align: center;
}

.file-select-chk {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Main */
.main {
  flex: 1;
  max-width: 1220px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 24px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.breadcrumbs a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.breadcrumbs a:hover { text-decoration: underline; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* Glass Card */
.card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

.file-table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.05);
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.file-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: middle;
  transition: background-color 0.14s ease;
}

.file-table tr:last-child td { border-bottom: none; }
.file-table tbody tr:hover td { background: var(--surface-hover); }

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

.file-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  word-break: break-word;
  transition: color 0.15s;
}

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

.file-subpath {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
}

.ext-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 7px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  min-width: 56px;
  text-align: center;
}

.ext-dir { background: var(--pill-dir-bg); color: var(--pill-dir-fg); }
.ext-exe { background: var(--pill-exe-bg); color: var(--pill-exe-fg); }
.ext-zip { background: var(--pill-zip-bg); color: var(--pill-zip-fg); }
.ext-pdf { background: var(--pill-pdf-bg); color: var(--pill-pdf-fg); }
.ext-vid { background: var(--pill-vid-bg); color: var(--pill-vid-fg); }
.ext-def { background: var(--pill-def-bg); color: var(--pill-def-fg); }

.mono-muted {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.actions-cell {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.16s ease;
}

.btn:hover {
  border-color: var(--primary);
  color: var(--text);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: rgba(96, 165, 250, 0.35);
  color: #fff;
  box-shadow: var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-color: rgba(147, 197, 253, 0.5);
  color: #fff;
}

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

.btn-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.empty-state {
  text-align: center;
  padding: 54px 20px;
  color: var(--muted);
  font-size: 14.5px;
}

.ttl-select {
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.footer-inner {
  max-width: 1220px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.support-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}

.support-trigger:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.65);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 900;
}

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

.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-head h3 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.modal-head p { font-size: 12.5px; color: var(--muted); }

.modal-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
}

.modal-field { margin-bottom: 12px; }
.modal-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}
.modal-field input,
.modal-field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
}
.modal-field textarea { min-height: 86px; resize: vertical; }
.modal-field input:focus,
.modal-field textarea:focus { border-color: var(--primary); }

.modal-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  padding: 16px 24px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: all 0.22s ease;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 680px) {
  .header-inner { padding: 12px 14px; }
  .main { padding: 16px 14px; }
  .col-date-hide { display: none; }
}
