/* File Ascender. Bootstrap 5.3 plus a light custom layer; dark mode via data-bs-theme. */

:root,
[data-bs-theme="light"] {
  --fa-brand: #3b5bdb;
  --fa-brand-2: #7048e8;
  --fa-bg: #f5f7fb;
  --fa-surface: #ffffff;
  --fa-border: #e3e7ef;
  --fa-muted-surface: #f0f3f9;
  --fa-row-hover: #f7f9fd;
  --fa-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --bs-primary: var(--fa-brand);
  --bs-primary-rgb: 59, 91, 219;
  --bs-link-color: var(--fa-brand);
  --bs-link-color-rgb: 59, 91, 219;
  --bs-link-hover-color: #2f49b0;
  --bs-body-bg: var(--fa-bg);
  --bs-border-color: var(--fa-border);
}

[data-bs-theme="dark"] {
  --fa-brand: #748ffc;
  --fa-brand-2: #9775fa;
  --fa-bg: #0e121a;
  --fa-surface: #161b26;
  --fa-border: #262d3b;
  --fa-muted-surface: #1c2230;
  --fa-row-hover: #1a2030;
  --fa-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --bs-primary: var(--fa-brand);
  --bs-primary-rgb: 116, 143, 252;
  --bs-link-color: var(--fa-brand);
  --bs-link-color-rgb: 116, 143, 252;
  --bs-link-hover-color: #91a7ff;
  --bs-body-bg: var(--fa-bg);
  --bs-body-color: #e3e7ef;
  --bs-border-color: var(--fa-border);
  --bs-secondary-color: rgba(227, 231, 239, 0.62);
}

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fa-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
.min-w-0 { min-width: 0; }
.tabular { font-variant-numeric: tabular-nums; }
.narrow { max-width: 640px; }

.btn-primary {
  --bs-btn-bg: var(--fa-brand);
  --bs-btn-border-color: var(--fa-brand);
  --bs-btn-hover-bg: #2f49b0;
  --bs-btn-hover-border-color: #2f49b0;
  --bs-btn-active-bg: #2a419e;
  --bs-btn-active-border-color: #2a419e;
  --bs-btn-disabled-bg: var(--fa-brand);
  --bs-btn-disabled-border-color: var(--fa-brand);
}
[data-bs-theme="dark"] .btn-primary {
  --bs-btn-color: #0e121a;
  --bs-btn-hover-color: #0e121a;
  --bs-btn-active-color: #0e121a;
  --bs-btn-hover-bg: #91a7ff;
  --bs-btn-hover-border-color: #91a7ff;
}
.btn-outline-primary {
  --bs-btn-color: var(--fa-brand);
  --bs-btn-border-color: var(--fa-brand);
  --bs-btn-hover-bg: var(--fa-brand);
  --bs-btn-hover-border-color: var(--fa-brand);
  --bs-btn-active-bg: var(--fa-brand);
}
.btn-icon {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  color: var(--bs-secondary-color);
  background: transparent;
}
.btn-icon:hover, .btn-icon:focus-visible { background: var(--fa-muted-surface); color: var(--bs-body-color); }

.card {
  --bs-card-bg: var(--fa-surface);
  --bs-card-border-color: var(--fa-border);
  box-shadow: var(--fa-shadow);
  border-radius: 0.875rem;
}
.form-control, .form-select { border-radius: 0.5rem; }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select { background-color: #10151f; }
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--fa-brand);
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.2);
}
.form-check-input:checked { background-color: var(--fa-brand); border-color: var(--fa-brand); }
.dropdown-menu { border-radius: 0.75rem; box-shadow: 0 10px 30px rgba(16, 24, 40, 0.12); border-color: var(--fa-border); }
.table { --bs-table-bg: transparent; --bs-table-hover-bg: var(--fa-row-hover); }
.table > :not(caption) > * > * { padding: 0.75rem 1rem; }
.table thead th { font-size: 0.8rem; font-weight: 600; color: var(--bs-secondary-color); text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- chrome ---------- */

.app-nav {
  background: color-mix(in srgb, var(--fa-surface) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--fa-border);
  position: sticky;
  top: 0;
  z-index: 1020;
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; letter-spacing: -0.01em; }
.brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 0.6rem;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--fa-brand), var(--fa-brand-2));
}
.app-nav .nav-link { border-radius: 0.5rem; padding: 0.45rem 0.75rem !important; color: var(--bs-secondary-color); font-weight: 500; }
.app-nav .nav-link:hover { color: var(--bs-body-color); }
.app-nav .nav-link.active { color: var(--fa-brand); background: rgba(var(--bs-primary-rgb), 0.1); }
.app-nav .nav-link .bi { margin-right: 0.25rem; }
[data-bs-theme="light"] .theme-icon-light, [data-bs-theme="dark"] .theme-icon-dark { display: none; }

.impersonation-bar { background: linear-gradient(90deg, #e8590c, #d9480f); color: #fff; font-size: 0.9rem; }
.app-footer { padding: 2rem 0; color: var(--bs-secondary-color); font-size: 0.85rem; }
.app-footer a { color: inherit; }
.flash { border-radius: 0.75rem; }
.back-link { display: inline-flex; gap: 0.35rem; align-items: center; margin-bottom: 1.25rem; color: var(--bs-secondary-color); text-decoration: none; }
.back-link:hover { color: var(--bs-body-color); }

.page-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.5rem; }
.page-head h1 { letter-spacing: -0.02em; font-weight: 700; }
.search { position: relative; width: min(100%, 18rem); }
.search .bi { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--bs-secondary-color); }
.search input { padding-left: 2.2rem; border-radius: 999px; }

/* ---------- auth ---------- */

.auth-card { max-width: 440px; margin: 1rem auto 0; }
.auth-card .card-body { padding: 2.25rem; }
@media (max-width: 575px) { .auth-card .card-body { padding: 1.5rem; } }

/* ---------- uploads ---------- */

.dropzone {
  border: 2px dashed color-mix(in srgb, var(--fa-brand) 35%, var(--fa-border));
  border-radius: 1rem;
  background: color-mix(in srgb, var(--fa-brand) 4%, var(--fa-surface));
  padding: 1.75rem;
  margin-bottom: 2rem;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.dropzone.is-over { border-color: var(--fa-brand); background: color-mix(in srgb, var(--fa-brand) 10%, var(--fa-surface)); transform: scale(1.005); }
.dropzone-inner { display: flex; align-items: center; gap: 1.25rem; }
.dropzone-icon {
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  color: #fff;
  background: linear-gradient(135deg, var(--fa-brand), var(--fa-brand-2));
  box-shadow: 0 8px 20px rgba(var(--bs-primary-rgb), 0.3);
}
.dropzone-sm { padding: 1rem; margin-bottom: 0; }
.dropzone-sm .dropzone-inner { gap: 0.6rem; justify-content: center; color: var(--bs-secondary-color); }
.dropzone .btn-link { font-weight: 600; text-decoration: none; }

.upload-queue:not(:empty) { margin-top: 1.25rem; display: grid; gap: 0.6rem; }
.upload-item {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  gap: 0.75rem;
  align-items: center;
  background: var(--fa-surface);
  border: 1px solid var(--fa-border);
  border-radius: 0.75rem;
  padding: 0.6rem 0.75rem;
}
.upload-item .thumb { width: 2.5rem; height: 2.5rem; border-radius: 0.5rem; background: var(--fa-muted-surface); display: grid; place-items: center; overflow: hidden; color: var(--bs-secondary-color); }
.upload-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload-item .name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-item .meta { font-size: 0.8rem; color: var(--bs-secondary-color); display: flex; gap: 0.5rem; }
.upload-item .bar { height: 0.35rem; border-radius: 1rem; background: var(--fa-muted-surface); overflow: hidden; margin-top: 0.35rem; }
.upload-item .bar > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--fa-brand), var(--fa-brand-2)); transition: width 0.2s; }
.upload-item.is-done .bar > span { background: var(--bs-success); }
.upload-item.is-error .bar > span { background: var(--bs-danger); width: 100% !important; }
.upload-item.is-error .meta .status { color: var(--bs-danger); }
.upload-item.is-done .meta .status { color: var(--bs-success); }

.receive-card { background: var(--fa-surface); border: 1px solid var(--fa-border); border-radius: 1rem; padding: 1.25rem 1.5rem; margin-bottom: 2rem; box-shadow: var(--fa-shadow); }
.receive-icon { flex: none; width: 3rem; height: 3rem; border-radius: 0.8rem; display: grid; place-items: center; font-size: 1.4rem; color: var(--fa-brand); background: rgba(var(--bs-primary-rgb), 0.12); }

.file-tabs { margin-bottom: 1rem; }
.file-tabs .nav-link { color: var(--bs-secondary-color); font-weight: 500; }
.file-tabs .nav-link.active { color: var(--bs-body-color); border-bottom-color: var(--fa-brand); }
.file-tabs .badge { font-weight: 500; background: var(--fa-muted-surface) !important; color: var(--bs-secondary-color) !important; }

.file-list { background: var(--fa-surface); border: 1px solid var(--fa-border); border-radius: 0.875rem; box-shadow: var(--fa-shadow); }
.file-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) 8rem 8rem 6rem 5rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--fa-border);
}
.file-row:first-child { border-top: 0; }
.file-row:not(.file-row-head):hover { background: var(--fa-row-hover); }
.file-row-head { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--bs-secondary-color); padding-top: 0.6rem; padding-bottom: 0.6rem; }
@media (max-width: 991px) { .file-row { grid-template-columns: 2rem minmax(0, 1fr) 8rem 6rem 5rem; } }
@media (max-width: 767px) { .file-row { grid-template-columns: 2rem minmax(0, 1fr) 5rem 5rem; } }
@media (max-width: 575px) { .file-row { grid-template-columns: 2rem minmax(0, 1fr) 5rem; padding: 0.7rem 0.75rem; } }
.file-row.is-expired .file-name { color: var(--bs-secondary-color); }
.file-main { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.file-thumb {
  flex: none;
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.6rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--fa-brand);
  background: rgba(var(--bs-primary-rgb), 0.1);
}
.file-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.file-thumb.kind-video { color: #e8590c; background: rgba(232, 89, 12, 0.1); }
.file-thumb.kind-audio { color: #ae3ec9; background: rgba(174, 62, 201, 0.1); }
.file-thumb.kind-pdf { color: #e03131; background: rgba(224, 49, 49, 0.1); }
.file-thumb.kind-archive { color: #f08c00; background: rgba(240, 140, 0, 0.12); }
.file-thumb.kind-sheet { color: #2f9e44; background: rgba(47, 158, 68, 0.12); }
.file-thumb.kind-image { color: #1098ad; background: rgba(16, 152, 173, 0.1); }
.file-name { display: block; font-weight: 500; color: var(--bs-body-color); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-name:hover { color: var(--fa-brand); }
.file-meta { font-size: 0.8rem; color: var(--bs-secondary-color); }
.file-actions { display: flex; justify-content: flex-end; gap: 0.1rem; }
.bulk-bar {
  position: sticky;
  top: 4.5rem;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.6rem 0.6rem 1rem;
  margin-bottom: 0.75rem;
  border-radius: 0.75rem;
  background: var(--bs-body-color);
  color: var(--fa-surface);
  font-weight: 500;
}
.empty-state { text-align: center; padding: 4rem 1rem; background: var(--fa-surface); border: 1px dashed var(--fa-border); border-radius: 1rem; }
.empty-state > .bi { font-size: 2.5rem; color: var(--bs-secondary-color); display: block; margin-bottom: 0.75rem; }

.preview { overflow: hidden; background: var(--fa-muted-surface); min-height: 16rem; display: grid; place-items: center; }
.preview img, .preview video { width: 100%; max-height: 70vh; object-fit: contain; display: block; background: #000; }
.preview img { background: transparent; }
.preview iframe { width: 100%; height: 70vh; border: 0; background: #fff; }
.preview-empty { display: grid; justify-items: center; gap: 0.75rem; padding: 3rem 1rem; }
.preview-empty > .bi { font-size: 4rem; color: var(--bs-secondary-color); }
.description { white-space: pre-wrap; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--fa-border); border: 1px solid var(--fa-border); border-radius: 0.75rem; overflow: hidden; }
.facts > div { background: var(--fa-surface); padding: 0.75rem 1rem; display: grid; gap: 0.1rem; }
.facts span { font-size: 0.75rem; color: var(--bs-secondary-color); text-transform: uppercase; letter-spacing: 0.04em; }
.facts strong { font-weight: 600; }

.swap { max-width: 640px; margin: 0 auto; text-align: center; }
.swap .dropzone { text-align: left; }
.avatar { border-radius: 50%; box-shadow: 0 0 0 4px var(--fa-surface), 0 0 0 5px var(--fa-border); }
.avatar-sm { border-radius: 50%; flex: none; }

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: rgba(var(--bs-primary-rgb), 0.18);
  backdrop-filter: blur(3px);
  pointer-events: none;
}
.drop-overlay > div { text-align: center; color: var(--fa-brand); font-weight: 600; font-size: 1.25rem; background: var(--fa-surface); padding: 2rem 3rem; border-radius: 1.25rem; box-shadow: 0 20px 60px rgba(16, 24, 40, 0.2); }
.drop-overlay .bi { font-size: 3rem; }
.drop-overlay[hidden] { display: none; }

.copy-toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 2100; background: var(--bs-body-color); color: var(--fa-surface); padding: 0.6rem 1rem; border-radius: 999px; font-weight: 500; font-size: 0.9rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); }

/* visibility tweaks */
.form-check-input { border-color: color-mix(in srgb, var(--bs-body-color) 30%, transparent); }
[data-bs-theme="dark"] .app-footer img { filter: invert(1) brightness(0.8); }
