/* ══ Files – Apex Design ═══════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --bg:          #06060b;
  --surface:     rgba(255,255,255,.025);
  --surface2:    rgba(255,255,255,.04);
  --surface3:    rgba(255,255,255,.06);
  --border:      rgba(255,255,255,.05);
  --border-h:    rgba(255,255,255,.1);
  --text:        #e2e8f0;
  --text-muted:  #94a3b8;
  --text-dim:    #64748b;
  --accent:      #3b82f6;
  --accent-h:    #2563eb;
  --accent-glow: rgba(59,130,246,.15);
  --accent2:     #8b5cf6;
  --ok:          #4ade80;
  --warn:        #fbbf24;
  --err:         #f87171;
  --radius:      14px;
  --radius-sm:   8px;
  --shadow:      0 8px 30px rgba(0,0,0,.25);
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  position: relative;
}
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(59,130,246,.08) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(139,92,246,.06) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 30%;
  background: linear-gradient(180deg, transparent, var(--bg));
  pointer-events: none;
  z-index: 0;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: #60a5fa; }
img { max-width: 100%; }
button { font-family: inherit; }

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  background: rgba(6,6,11,.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.topbar-inner {
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1.5rem;
  max-width: 1100px; margin: 0 auto;
}
.topbar-brand {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; font-size: 1rem; color: #fff;
}
.topbar-brand-icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .7rem; color: #fff;
  box-shadow: 0 3px 12px rgba(59,130,246,.25);
}
.topbar-brand strong { color: var(--accent); font-weight: 800; }
.topbar-sep { width: 1px; height: 18px; background: var(--border-h); margin: 0 .4rem; }
.topbar-links { display: flex; gap: .2rem; flex: 1; }
.topbar-link {
  padding: .45rem .85rem; border-radius: 7px;
  font-size: .88rem; font-weight: 500; color: var(--text-muted);
  transition: all .2s; text-decoration: none;
}
.topbar-link:hover { color: #fff; background: var(--surface3); }
.topbar-link.active { color: #fff; background: var(--surface2); }
.topbar-right { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.user-chip {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem .75rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; font-size: .82rem; color: var(--text);
}
.user-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.user-chip .folder { color: var(--text-dim); font-size: .75rem; font-family: 'JetBrains Mono', monospace; }
.topbar-btn {
  padding: .45rem .9rem; border-radius: 7px;
  font-size: .82rem; font-weight: 500; color: var(--text-muted);
  border: 1px solid var(--border); background: transparent;
  transition: all .2s; text-decoration: none; cursor: pointer;
}
.topbar-btn:hover { color: #fff; border-color: var(--border-h); background: var(--surface2); }

/* ── Container ──────────────────────────────────────── */
.container {
  max-width: 720px; margin: 0 auto; padding: 2rem 1.5rem 4rem;
  position: relative; z-index: 1;
}
.container.wide { max-width: 960px; }

/* ── Page header ────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 {
  font-size: 1.75rem; font-weight: 700; color: #fff;
  letter-spacing: -.02em; margin-bottom: .3rem;
}
.page-header .subtitle { color: var(--text-muted); font-size: .92rem; }

/* ── Cards / Panels ─────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.panel + .panel { margin-top: 1.2rem; }

/* ── Login centered ─────────────────────────────────── */
.center-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; position: relative; z-index: 1; }
.login-card { width: 100%; max-width: 380px; }
.login-logo {
  width: 64px; height: 64px; border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.6rem; color: #fff;
  margin: 0 auto 1.25rem;
  box-shadow: 0 10px 30px rgba(59,130,246,.3);
}
.login-card h1 { text-align: center; font-size: 1.5rem; font-weight: 700; color: #fff; margin-bottom: .3rem; }
.login-card .subtitle { text-align: center; color: var(--text-muted); font-size: .9rem; margin-bottom: 1.5rem; }

/* ── Form ───────────────────────────────────────────── */
.field { margin-bottom: 1rem; }
.field label {
  display: block; font-size: .72rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: .4rem;
  text-transform: uppercase; letter-spacing: .05em;
}
.input, input[type=text], input[type=password] {
  width: 100%; padding: .7rem .9rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: .92rem; font-family: inherit;
  outline: none; transition: border-color .15s, background .15s;
}
.input:focus, input[type=text]:focus, input[type=password]:focus {
  border-color: var(--accent); background: var(--surface3);
}
.input::placeholder { color: var(--text-dim); }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem 1.2rem; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 600; font-family: inherit;
  border: 1px solid transparent; cursor: pointer; transition: all .15s;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 14px rgba(59,130,246,.3);
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 6px 20px rgba(59,130,246,.4); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-ghost { background: var(--surface2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface3); border-color: var(--border-h); }
.btn-block { width: 100%; }

/* ── Drop zone ──────────────────────────────────────── */
.drop-zone {
  border: 1.5px dashed var(--border-h);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem; text-align: center;
  cursor: pointer; transition: all .2s;
  position: relative; background: var(--surface);
}
.drop-zone:hover { border-color: var(--accent); background: var(--accent-glow); }
.drop-zone.dragover { border-color: var(--accent); background: var(--accent-glow); transform: scale(1.01); }
.drop-zone.has-preview { border-style: solid; border-color: var(--ok); background: rgba(74,222,128,.04); padding: 1rem; }
.drop-zone input[type=file] { display: none; }
.drop-icon { font-size: 2.5rem; margin-bottom: .8rem; display: block; }
.drop-zone p { color: var(--text-muted); font-size: .9rem; }
.drop-zone .highlight { color: var(--accent); font-weight: 600; }
#preUploadPreview { display: none; }
#preUploadPreview img { max-height: 200px; border-radius: 8px; object-fit: contain; }

.paste-hint {
  text-align: center; color: var(--text-dim); font-size: .75rem;
  margin-bottom: 1rem;
}
.paste-hint kbd {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 5px; padding: .1rem .4rem;
  font-family: 'JetBrains Mono', monospace; font-size: .72rem;
  color: var(--text);
}

.file-info {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .9rem; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-top: .8rem; font-size: .85rem;
}
.file-info:empty { display: none; }
.file-name-text { flex: 1; min-width: 0; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size-text { color: var(--text-dim); font-size: .8rem; flex-shrink: 0; }
.clear-btn {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 1rem; padding: .2rem .4rem;
  border-radius: 4px; transition: color .15s;
}
.clear-btn:hover { color: var(--err); }

/* ── Progress ───────────────────────────────────────── */
.progress-wrap { display: none; margin-top: 1rem; }
.progress-label {
  display: flex; justify-content: space-between;
  font-size: .8rem; color: var(--text-muted); margin-bottom: .4rem;
}
.progress-track {
  height: 5px; background: var(--surface2);
  border-radius: 3px; overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px; width: 0%; transition: width .3s;
}

/* ── Result / Link box ──────────────────────────────── */
.result-box {
  margin-top: 1rem;
  background: rgba(74,222,128,.06);
  border: 1px solid rgba(74,222,128,.15);
  border-radius: var(--radius-sm);
  padding: 1rem;
}
.result-label {
  font-size: .7rem; font-weight: 600; color: var(--ok);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem;
}
.link-row { display: flex; gap: .4rem; }
.link-row input {
  flex: 1; padding: .5rem .7rem;
  background: rgba(0,0,0,.3); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text);
  font-family: 'JetBrains Mono', monospace; font-size: .78rem;
}
.copy-btn {
  padding: .5rem .9rem; background: var(--accent); color: #fff;
  border: none; border-radius: 6px; font-weight: 600; font-size: .8rem;
  cursor: pointer; transition: opacity .15s;
}
.copy-btn:hover { opacity: .9; }

.error-msg {
  margin-top: 1rem; padding: .75rem 1rem;
  background: rgba(248,113,113,.08);
  border: 1px solid rgba(248,113,113,.2);
  border-radius: var(--radius-sm);
  color: var(--err); font-size: .85rem;
}

#preview img { max-width: 100%; border-radius: var(--radius-sm); margin-top: 1rem; }

/* ── Section titles ─────────────────────────────────── */
.section-title {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .72rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em;
  margin: 1.5rem 0 .8rem; padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.section-title .count { color: var(--text-dim); font-weight: 500; }

/* ── File list ──────────────────────────────────────── */
.my-files-search {
  width: 100%; padding: .7rem .9rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: .88rem; font-family: inherit; outline: none;
  margin-bottom: .8rem; transition: border-color .15s;
}
.my-files-search:focus { border-color: var(--accent); }
.my-file {
  display: flex; justify-content: space-between; align-items: center; gap: .75rem;
  padding: .75rem 1rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: .4rem; transition: border-color .15s, background .15s;
}
.my-file:hover { border-color: var(--border-h); background: var(--surface2); }
.my-file-info { min-width: 0; flex: 1; }
.my-file-name { font-size: .9rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.my-file-meta { font-size: .75rem; color: var(--text-dim); margin-top: .15rem; font-family: 'JetBrains Mono', monospace; }
.my-file-actions { display: flex; gap: .3rem; flex-shrink: 0; }
.my-file-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); padding: .35rem .7rem;
  border-radius: 6px; cursor: pointer; font-size: .75rem; font-weight: 500;
  font-family: inherit; transition: all .15s;
}
.my-file-btn:hover { color: #fff; border-color: var(--border-h); background: var(--surface2); }
.my-file-btn.danger:hover { color: var(--err); border-color: rgba(248,113,113,.3); background: rgba(248,113,113,.06); }
.my-files-empty { text-align: center; padding: 2rem 1rem; color: var(--text-dim); font-size: .85rem; }

/* ── Admin table ────────────────────────────────────── */
.user-table {
  width: 100%; border-collapse: collapse;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.user-table thead th {
  text-align: left; padding: .75rem 1rem;
  background: rgba(0,0,0,.2);
  color: var(--text-muted); font-size: .7rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
.user-table tbody td {
  padding: .9rem 1rem; border-bottom: 1px solid var(--border);
  font-size: .88rem; vertical-align: middle;
}
.user-table tbody tr:last-child td { border-bottom: none; }
.user-table tbody tr:hover { background: var(--surface2); }
.user-table td.actions { text-align: right; white-space: nowrap; }

.name-cell { display: flex; align-items: center; gap: .6rem; }
.avatar {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .8rem; flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(59,130,246,.2);
}
.folder-code {
  display: inline-block; padding: .15rem .55rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace; font-size: .78rem;
}

.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .55rem; border-radius: 5px;
  font-size: .7rem; font-weight: 600;
}
.badge-admin { background: rgba(59,130,246,.12); color: #60a5fa; border: 1px solid rgba(59,130,246,.25); }
.badge-user { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-me { background: rgba(74,222,128,.12); color: var(--ok); border: 1px solid rgba(74,222,128,.25); margin-left: .4rem; }

.btn-sm {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); padding: .35rem .75rem;
  border-radius: 6px; cursor: pointer; font-size: .75rem;
  font-weight: 500; font-family: inherit;
  transition: all .15s; margin-left: .25rem;
}
.btn-sm:hover { color: #fff; border-color: var(--border-h); background: var(--surface2); }
.btn-sm.danger:hover { color: var(--err); border-color: rgba(248,113,113,.3); background: rgba(248,113,113,.06); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .8rem; margin-bottom: 1rem; }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.admin-toggle { display: flex; align-items: center; gap: .5rem; font-size: .88rem; color: var(--text); cursor: pointer; user-select: none; }
.admin-toggle input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.form-msg { font-size: .8rem; margin-top: .6rem; min-height: 1em; }
.form-msg.err { color: var(--err); }
.form-msg.ok { color: var(--ok); }

/* ── Dialog ─────────────────────────────────────────── */
.dlg-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.7); z-index: 200;
  align-items: center; justify-content: center;
  backdrop-filter: blur(6px); padding: 1rem;
}
.dlg-overlay.visible { display: flex; }
.dlg {
  background: #0c0c12; border: 1px solid var(--border-h);
  border-radius: var(--radius); padding: 1.5rem;
  max-width: 420px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.dlg h3 { font-size: 1.05rem; font-weight: 700; color: #fff; margin-bottom: .2rem; }
.dlg .dlg-sub { font-size: .82rem; color: var(--text-muted); margin-bottom: 1rem; }
.dlg input { margin-bottom: 1rem; }
.dlg-actions { display: flex; justify-content: flex-end; gap: .5rem; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 720px) {
  .topbar-inner { padding: .6rem 1rem; gap: .6rem; flex-wrap: wrap; }
  .topbar-links { order: 3; flex-basis: 100%; justify-content: center; }
  .user-chip .folder { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .user-table { font-size: .8rem; }
  .user-table tbody td { padding: .7rem .6rem; }
  .user-table .actions .btn-sm { display: block; width: 100%; margin: .15rem 0; }
  .name-cell .avatar { width: 28px; height: 28px; }
}
