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

:root {
  --bg:       #0d1117;
  --bg2:      #161b22;
  --bg3:      #21262d;
  --border:   #30363d;
  --border2:  #3d444d;
  --text:     #e6edf3;
  --text2:    #8b949e;
  --text3:    #656d76;
  --accent:   #2f81f7;
  --accent2:  #1f6feb;
  --success:  #3fb950;
  --warning:  #d29922;
  --danger:   #f85149;
  --purple:   #a371f7;
  --radius:   8px;
  --shadow:   0 8px 32px rgba(0,0,0,.4);
}

body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; line-height: 1.5; min-height: 100vh; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius); border: 1px solid transparent;
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all .15s;
  white-space: nowrap; line-height: 20px;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary   { background: var(--accent); color: #fff; border-color: var(--accent2); }
.btn-primary:hover:not(:disabled) { background: var(--accent2); }
.btn-secondary { background: var(--bg3); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }
.btn-danger    { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-ghost     { background: transparent; color: var(--text2); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--bg3); color: var(--text); }
.btn-full      { width: 100%; justify-content: center; padding: 10px 14px; font-size: 14px; }
.btn-sm        { padding: 3px 10px; font-size: 12px; }
.btn-icon      { padding: 6px; border-radius: var(--radius); }

/* ── Form elements ─────────────────────────────────────────────────────────── */
input, textarea, select {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); padding: 7px 10px; font-size: 13px; width: 100%;
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47,129,247,.15);
}
input::placeholder { color: var(--text3); }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .5px; }
.form-error { color: var(--danger); font-size: 12px; min-height: 16px; margin-top: 4px; }
.optional { font-weight: 400; color: var(--text3); text-transform: none; }
.input-eye { position: relative; }
.input-eye input { padding-right: 36px; }
.eye-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text3); font-size: 14px; }
.strength-bar-wrap { height: 4px; background: var(--bg3); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.strength-bar { height: 4px; border-radius: 2px; transition: width .3s, background .3s; }
.password-strength { display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
.password-strength .strength-bar { height: 3px; border-radius: 2px; transition: all .3s; }

/* ── Auth page ─────────────────────────────────────────────────────────────── */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-container {
  width: 100%; max-width: 400px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 32px; display: flex; flex-direction: column; gap: 20px;
}
.auth-logo { display: flex; align-items: center; gap: 10px; justify-content: center; }
.logo-icon { font-size: 32px; }
.logo-text { font-size: 22px; font-weight: 700; letter-spacing: -.5px; }
.auth-tabs { display: flex; border-bottom: 1px solid var(--border); }
.auth-tab {
  flex: 1; background: none; border: none; color: var(--text2);
  padding: 8px; cursor: pointer; font-size: 13px; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s;
}
.auth-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form.hidden { display: none; }

/* ── App layout ────────────────────────────────────────────────────────────── */
.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px; height: 52px; min-height: 52px;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  z-index: 100;
}
.topbar-logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; margin-right: 8px; }
.topbar-logo .logo-icon { font-size: 20px; }
.topbar-search { flex: 1; max-width: 340px; }
.topbar-search input { background: var(--bg3); height: 34px; }
.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar-user { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; border-radius: var(--radius); }
.topbar-user:hover { background: var(--bg3); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--purple)); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }

/* Sidebar */
.sidebar {
  width: 220px; min-width: 220px; background: var(--bg2);
  border-right: 1px solid var(--border); display: flex;
  flex-direction: column; overflow-y: auto; padding: 12px 0;
}
.sidebar-section { padding: 0 8px; margin-bottom: 16px; }
.sidebar-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .5px; padding: 0 8px; margin-bottom: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: var(--radius); cursor: pointer;
  color: var(--text2); font-size: 13px; transition: all .1s; user-select: none;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(47,129,247,.15); color: var(--accent); }
.nav-item .nav-icon { width: 16px; text-align: center; flex-shrink: 0; }
.nav-item .nav-badge { margin-left: auto; background: var(--bg3); color: var(--text2); font-size: 10px; padding: 1px 6px; border-radius: 10px; }

/* Storage bar in sidebar */
.storage-bar-wrap { padding: 8px 16px; }
.storage-bar-bg { height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.storage-bar-fill { height: 100%; border-radius: 2px; transition: width .5s; background: var(--accent); }
.storage-bar-fill.warn { background: var(--warning); }
.storage-bar-fill.full { background: var(--danger); }
.storage-text { font-size: 11px; color: var(--text2); }

/* Content area */
.main { display: flex; flex: 1; overflow: hidden; }
.content { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* ── Toolbar ───────────────────────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-left { display: flex; align-items: center; gap: 8px; flex: 1; }
.toolbar-right { display: flex; align-items: center; gap: 6px; }
.breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.breadcrumb-item { color: var(--text2); cursor: pointer; }
.breadcrumb-item:hover { color: var(--text); }
.breadcrumb-item.current { color: var(--text); font-weight: 600; }
.breadcrumb-sep { color: var(--text3); }
.view-toggle { display: flex; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.view-btn { background: none; border: none; padding: 5px 10px; color: var(--text3); cursor: pointer; font-size: 14px; transition: all .1s; }
.view-btn.active { background: var(--border); color: var(--text); }

/* ── File grid ─────────────────────────────────────────────────────────────── */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.file-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: border-color .15s, transform .1s; position: relative;
}
.file-card:hover { border-color: var(--border2); transform: translateY(-1px); }
.file-card.selected { border-color: var(--accent); background: rgba(47,129,247,.08); }
.file-card-thumb {
  height: 100px; display: flex; align-items: center; justify-content: center;
  background: var(--bg3); overflow: hidden; position: relative;
}
.file-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-card-thumb .file-icon { font-size: 36px; }
.file-card-info { padding: 8px 10px; }
.file-card-name { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card-meta { font-size: 10px; color: var(--text3); margin-top: 2px; }
.file-card-check {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  width: 18px; height: 18px; border-radius: 4px;
  background: rgba(13,17,23,.7); border: 2px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; transition: all .1s;
}
.file-card.selected .file-card-check { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── File list ─────────────────────────────────────────────────────────────── */
.file-list { display: flex; flex-direction: column; gap: 2px; }
.file-row {
  display: grid; grid-template-columns: 24px 2fr 100px 80px 120px 100px;
  align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer;
  transition: background .1s;
}
.file-row:hover { background: var(--bg2); }
.file-row.selected { background: rgba(47,129,247,.08); border-color: rgba(47,129,247,.3); }
.file-row-header {
  font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase;
  padding: 4px 12px; letter-spacing: .5px; cursor: default;
}
.file-row-header:hover { background: none; }
.file-row-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.file-row-name .file-icon { font-size: 18px; flex-shrink: 0; }
.file-row-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity .1s; }
.file-row:hover .file-row-actions { opacity: 1; }

/* ── Upload zone ───────────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 40px 20px; text-align: center; cursor: pointer;
  transition: all .2s; margin-bottom: 20px; background: var(--bg2);
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: rgba(47,129,247,.05); }
.upload-zone .upload-icon { font-size: 40px; margin-bottom: 10px; }
.upload-zone h3 { font-size: 15px; margin-bottom: 4px; }
.upload-zone p { color: var(--text2); font-size: 12px; }
.upload-zone.compact { padding: 16px; }
.upload-zone.compact .upload-icon { font-size: 24px; margin-bottom: 4px; }
.upload-zone.compact h3 { font-size: 13px; }

/* ── Upload queue ──────────────────────────────────────────────────────────── */
.upload-queue { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.upload-item {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
}
.upload-item-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.upload-item-name { flex: 1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item-size { font-size: 11px; color: var(--text3); }
.progress-bar { height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 2px; background: var(--accent); transition: width .2s; }
.progress-fill.done { background: var(--success); }
.progress-fill.error { background: var(--danger); }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text2); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .5; }
.empty-state h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  backdrop-filter: blur(2px);
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; width: 100%; max-width: 480px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: 90vh;
}
.modal.modal-lg { max-width: 700px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); flex-shrink: 0; }
.close-btn { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 18px; padding: 2px 6px; border-radius: 4px; }
.close-btn:hover { background: var(--bg3); color: var(--text); }

/* ── File type icons by color ──────────────────────────────────────────────── */
.icon-image  { color: #58a6ff; }
.icon-video  { color: #a371f7; }
.icon-audio  { color: #f78166; }
.icon-doc    { color: #79c0ff; }
.icon-pdf    { color: #f85149; }
.icon-code   { color: #56d364; }
.icon-zip    { color: #e3b341; }
.icon-folder { color: #e3b341; }
.icon-file   { color: var(--text3); }

/* ── Tags / badges ─────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-blue   { background: rgba(47,129,247,.15); color: var(--accent); }
.badge-green  { background: rgba(63,185,80,.15);  color: var(--success); }
.badge-yellow { background: rgba(210,153,34,.15); color: var(--warning); }
.badge-red    { background: rgba(248,81,73,.15);  color: var(--danger); }
.badge-purple { background: rgba(163,113,247,.15);color: var(--purple); }

/* ── Dropdown ──────────────────────────────────────────────────────────────── */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 4px); right: 0;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); z-index: 150;
  min-width: 160px; padding: 4px;
}
.dropdown-menu.hidden { display: none; }
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 5px; cursor: pointer;
  font-size: 13px; color: var(--text2); transition: all .1s;
}
.dropdown-item:hover { background: var(--bg3); color: var(--text); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: rgba(248,81,73,.1); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Selection bar ─────────────────────────────────────────────────────────── */
.selection-bar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(47,129,247,.9); color: #fff;
  padding: 8px 16px; border-radius: var(--radius);
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px; backdrop-filter: blur(4px);
}
.selection-bar.hidden { display: none; }

/* ── Share link display ────────────────────────────────────────────────────── */
.share-link-box { display: flex; gap: 6px; }
.share-link-box input { font-family: monospace; font-size: 12px; }
.copy-feedback { color: var(--success); font-size: 12px; }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 16px;
  font-size: 13px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 8px; pointer-events: all;
  animation: slideIn .2s ease;
}
.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }
.toast.info    { border-color: var(--accent); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Admin panel ───────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-value { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }

/* ── Table ─────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th { background: var(--bg3); padding: 9px 12px; font-size: 11px; font-weight: 600; color: var(--text3); text-align: left; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg3); }

/* ── Preview ───────────────────────────────────────────────────────────────── */
.preview-container { max-height: 60vh; overflow: auto; display: flex; align-items: center; justify-content: center; background: var(--bg3); border-radius: var(--radius); }
.preview-container img, .preview-container video, .preview-container audio { max-width: 100%; max-height: 60vh; }
.preview-container iframe { width: 100%; height: 60vh; border: none; background: #fff; }
.preview-container pre { padding: 16px; font-family: monospace; font-size: 12px; color: var(--text); white-space: pre-wrap; width: 100%; }
.no-preview { padding: 40px; text-align: center; color: var(--text2); }

/* ── Misc ──────────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text2); }
.font-mono { font-family: monospace; }
.section-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

/* ── Share public page ─────────────────────────────────────────────────────── */
.share-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.share-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 32px; width: 100%; max-width: 460px;
  box-shadow: var(--shadow);
}
.share-file-icon { font-size: 56px; text-align: center; margin-bottom: 16px; }
.share-file-name { font-size: 18px; font-weight: 600; text-align: center; word-break: break-all; }
.share-meta { display: flex; justify-content: center; gap: 16px; color: var(--text2); font-size: 13px; margin: 10px 0 20px; flex-wrap: wrap; }
.share-divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Context menu ──────────────────────────────────────────────────────────── */
.context-menu {
  position: fixed; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); z-index: 300;
  padding: 4px; min-width: 160px;
}
.context-menu.hidden { display: none; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .file-row { grid-template-columns: 24px 1fr 80px; }
  .file-row-size, .file-row-date, .file-row-downloads { display: none; }
  .content { padding: 12px; }
}
