@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
  --bg:         #f1f5f9;
  --surface:    #ffffff;
  --nav-bg:     #0d3355;
  --nav-text:   #e2e8f0;
  --nav-active: #ffffff;

  --primary:    #4d65ff;
  --primary-h:  #3a52e8;
  --danger:     #ef4444;
  --danger-h:   #dc2626;
  --success:    #16a34a;
  --warning:    #d97706;

  --text:       #0f172a;
  --muted:      #64748b;
  --border:     #e2e8f0;
  --row-hover:  #f8fafc;

  --radius:     8px;
  --shadow:     0 2px 12px rgba(0,0,0,0.07);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.12);
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Nav ────────────────────────────────────────────────────────────────── */
.nav {
  background: var(--nav-bg);
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--nav-active);
  text-decoration: none;
  letter-spacing: .02em;
  white-space: nowrap;
}
.nav-links {
  display: flex;
  gap: .25rem;
  flex: 1;
}
.nav-links a {
  color: var(--nav-text);
  text-decoration: none;
  padding: .35rem .8rem;
  border-radius: 5px;
  font-size: .875rem;
  transition: background .15s, color .15s;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,0.12);
  color: var(--nav-active);
}
.nav-logout {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--nav-text);
  padding: .3rem .8rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: .875rem;
  transition: background .15s;
}
.nav-logout:hover { background: rgba(255,255,255,0.1); }

/* ── Page content ────────────────────────────────────────────────────────── */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .875rem;
  color: var(--muted);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--border); user-select: none; }
.breadcrumb .current { color: var(--text); font-weight: 500; }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}
.toolbar-right { margin-left: auto; }

/* ── Bulk actions bar ────────────────────────────────────────────────────── */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1rem;
  margin-bottom: .75rem;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
}
.bulk-bar #bulk-count { margin-right: auto; }
.bulk-bar .btn-ghost {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.8);
  cursor: pointer;
  font-size: .875rem;
  padding: .3rem .6rem;
  border-radius: 4px;
}
.bulk-bar .btn-ghost:hover { color: #fff; background: rgba(255,255,255,.15); }
.bulk-bar .btn-outline {
  border-color: rgba(255,255,255,.6);
  color: #fff;
  background: transparent;
}
.bulk-bar .btn-outline:hover { background: rgba(255,255,255,.15); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem 1rem;
  border-radius: 6px;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary   { background: var(--primary);  color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); }

.btn-danger    { background: var(--danger);   color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-h); }

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover:not(:disabled) { background: var(--row-hover); }

.btn-ghost {
  background: none;
  color: var(--muted);
  padding: .35rem .5rem;
}
.btn-ghost:hover { color: var(--text); background: var(--row-hover); }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: .3rem .4rem;
  border-radius: 5px;
  font-size: 1rem;
  line-height: 1;
  transition: color .15s, background .15s;
}
.btn-icon:hover { color: var(--text); background: var(--border); }
.btn-icon.danger:hover { color: var(--danger); }
.btn-icon.success:hover { color: var(--success); }

.btn-full { width: 100%; justify-content: center; }

/* ── Card / Table container ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ── File / Link table ───────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: .65rem 1rem;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--row-hover); }

.col-size   { color: var(--muted); }
.col-date   { color: var(--muted); white-space: nowrap; }
.col-actions{ text-align: right; white-space: nowrap; }

/* file / folder name cell */
.name-cell {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.name-cell .icon { font-size: 1.1rem; flex-shrink: 0; }
.name-cell a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.name-cell a:hover { color: var(--primary); text-decoration: underline; }

/* ── Badges / status pills ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .55rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-active   { background: #dcfce7; color: var(--success); }
.badge-disabled { background: #fee2e2; color: var(--danger);  }
.badge-expired  { background: #fef3c7; color: var(--warning); }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state p { margin-top: .5rem; }

/* ── Drag-and-drop overlay ───────────────────────────────────────────────── */
.drop-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(77,101,255,.08);
  border: 3px dashed var(--primary);
  z-index: 200;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  pointer-events: none;
}
.drop-overlay.active { display: flex; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop.active { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  padding: 1.75rem;
}
.modal h2 {
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
  color: var(--text);
}
.modal-actions {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* share link result box */
.link-result {
  display: none;
  margin-top: 1rem;
}
.link-result.active { display: block; }
.link-box {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .5rem .75rem;
  font-size: .8rem;
  word-break: break-all;
  color: var(--primary);
  font-family: monospace;
}
.link-box .copy-btn {
  flex-shrink: 0;
  margin-left: auto;
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-weight: 500;
  font-size: .875rem;
  margin-bottom: .35rem;
  color: var(--text);
}
.form-group .hint {
  font-size: .75rem;
  color: var(--muted);
  margin-top: .2rem;
}
input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .875rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(77,101,255,.15);
}

/* radio group for expiry */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .35rem;
}
.radio-group label {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-weight: 400;
  cursor: pointer;
  padding: .35rem .65rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  transition: border-color .15s, background .15s;
  white-space: nowrap;
  user-select: none;
}
.radio-group input[type="radio"] { width: auto; }
.radio-group label:has(input:checked) {
  border-color: var(--primary);
  background: #eef0ff;
  color: var(--primary);
}

.error-msg {
  color: var(--danger);
  font-size: .8rem;
  margin-bottom: .75rem;
  padding: .45rem .7rem;
  background: #fee2e2;
  border-radius: 5px;
}

/* ── Upload progress bar ─────────────────────────────────────────────────── */
.upload-queue {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.upload-item {
  background: var(--bg);
  border-radius: 5px;
  padding: .5rem .75rem;
  font-size: .8rem;
}
.upload-item .upload-name {
  display: flex;
  justify-content: space-between;
  margin-bottom: .3rem;
}
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width .2s;
}

/* ── Toast notifications ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  background: #1e293b;
  color: #f1f5f9;
  padding: .65rem 1.1rem;
  border-radius: 7px;
  font-size: .875rem;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger);  }

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}
.login-box {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo h1 { font-size: 1.5rem; color: var(--text); }
.login-logo p  { color: var(--muted); font-size: .875rem; margin-top: .25rem; }

/* ── Filter bar ──────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.filter-bar label {
  font-weight: 500;
  font-size: .875rem;
  white-space: nowrap;
}
.filter-bar select { max-width: 220px; }

/* ── Stat chips (links page) ─────────────────────────────────────────────── */
.dl-count {
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Bulk action bar ─────────────────────────────────────────────────────── */
.bulk-bar {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  padding: .65rem 1rem .65rem 1.25rem;
  align-items: center;
  gap: 1rem;
  z-index: 400;
  white-space: nowrap;
}
.bulk-bar.active { display: flex; }
.bulk-count { font-size: .875rem; font-weight: 600; color: #94a3b8; min-width: 5rem; }
.bulk-actions { display: flex; gap: .5rem; }
.bulk-actions .btn { font-size: .8rem; padding: .35rem .75rem; }
.bulk-actions .btn-outline { background: #334155; border-color: #475569; color: #e2e8f0; }
.bulk-actions .btn-outline:hover { background: #475569; }
.bulk-actions .btn-danger { font-size: .8rem; padding: .35rem .75rem; }

/* ── Stat cards (storage page) ───────────────────────────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
}
.stat-card .stat-label { font-size: .75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); margin-bottom: .35rem; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-card .stat-sub   { font-size: .75rem; color: var(--muted); margin-top: .2rem; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .page { padding: 1rem; }
  .col-size, .col-date { display: none; }
  .data-table th, .data-table td { padding: .6rem .75rem; }
}
