/* ================================================================
   FileShare — Main Stylesheet
   Palette: Navy (#0f172a) · Slate (#1e293b) · Accent (#38bdf8)
   ================================================================ */

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

:root {
  --navy:      #0f172a;
  --slate:     #1e293b;
  --slate-mid: #334155;
  --border:    #475569;
  --text:      #e2e8f0;
  --muted:     #94a3b8;
  --accent:    #38bdf8;
  --accent-dk: #0284c7;
  --success:   #4ade80;
  --error:     #f87171;
  --warning:   #fbbf24;
  --info:      #38bdf8;
  --radius:    8px;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
  --font:      'Inter', system-ui, -apple-system, sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--navy);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

img, svg { display: block; max-width: 100%; }

/* ── Typography ────────────────────────────────────────────────── */
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h2 { font-size: clamp(1.2rem, 3vw, 1.8rem); }
h3 { font-size: 1.2rem; }
p  { color: var(--muted); }

/* ── Layout ────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

main { flex: 1; padding: 2.5rem 0; }

/* ── Header / Nav ──────────────────────────────────────────────── */
header {
  background: var(--slate);
  border-bottom: 1px solid var(--slate-mid);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 60px;
}

.nav-brand {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -.5px;
}
.nav-brand span { color: var(--text); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}

.nav-links a {
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.9rem;
  transition: background .15s, color .15s;
}
.nav-links a:hover,
.nav-links a.active { background: var(--slate-mid); color: var(--text); text-decoration: none; }

.nav-links .btn-nav {
  background: var(--accent);
  color: var(--navy) !important;
  font-weight: 600;
}
.nav-links .btn-nav:hover { background: var(--accent-dk); }

/* Hamburger (mobile) */
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 6px; }
.nav-toggle span {
  display: block; width: 24px; height: 2px;
  background: var(--text); margin: 5px 0;
  transition: transform .2s, opacity .2s;
}

/* ── Footer ────────────────────────────────────────────────────── */
footer {
  background: var(--slate);
  border-top: 1px solid var(--slate-mid);
  text-align: center;
  padding: 1.25rem;
  font-size: .85rem;
  color: var(--muted);
}

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--slate);
  border: 1px solid var(--slate-mid);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1.25rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  font-family: var(--font);
  transition: background .15s, transform .1s, box-shadow .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.3); text-decoration: none; }
.btn:active { transform: none; }

.btn-primary  { background: var(--accent); color: var(--navy); }
.btn-primary:hover { background: var(--accent-dk); color: #fff; }
.btn-danger   { background: #be123c; color: #fff; }
.btn-danger:hover { background: #9f1239; }
.btn-ghost    { background: var(--slate-mid); color: var(--text); }
.btn-ghost:hover { background: var(--border); }
.btn-sm       { padding: .35rem .85rem; font-size: .8rem; }
.btn-full     { width: 100%; justify-content: center; }

/* ── Forms ─────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .4rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: .95rem;
  padding: .6rem .9rem;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}

input::placeholder { color: var(--border); }

.form-hint { font-size: .8rem; color: var(--muted); margin-top: .3rem; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

/* ── Alerts ────────────────────────────────────────────────────── */
.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .9rem;
  font-weight: 500;
  border-left: 4px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}
.alert-success { background: rgba(74,222,128,.1); border-color: var(--success); color: var(--success); }
.alert-error   { background: rgba(248,113,113,.1); border-color: var(--error);   color: var(--error);   }
.alert-warning { background: rgba(251,191,36,.1);  border-color: var(--warning); color: var(--warning); }
.alert-info    { background: rgba(56,189,248,.1);  border-color: var(--info);    color: var(--info);    }

/* ── Upload Zone ───────────────────────────────────────────────── */
#upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
  background: var(--navy);
}

#upload-zone:hover,
#upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(56,189,248,.05);
}

#upload-zone .zone-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--accent);
  opacity: .7;
}

#upload-zone h3 { color: var(--text); margin-bottom: .4rem; }
#upload-zone p  { font-size: .9rem; }

#file-input { display: none; }

/* File info preview */
#file-preview {
  margin-top: 1rem;
  padding: .75rem 1rem;
  background: var(--slate-mid);
  border-radius: var(--radius);
  display: none;
  align-items: center;
  gap: .75rem;
  font-size: .9rem;
}
#file-preview.visible { display: flex; }
#file-preview .file-icon { font-size: 1.5rem; }
#file-preview .file-meta { flex: 1; overflow: hidden; }
#file-preview .file-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#file-preview .file-size { font-size: .8rem; color: var(--muted); }
#file-preview .remove-file { cursor: pointer; color: var(--error); font-size: 1.2rem; line-height: 1; }

/* ── Progress Bar ──────────────────────────────────────────────── */
#progress-wrap {
  margin-top: 1.25rem;
  display: none;
}
#progress-wrap.visible { display: block; }

.progress-bar-track {
  background: var(--slate-mid);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  background: var(--accent);
  height: 100%;
  width: 0%;
  border-radius: 99px;
  transition: width .15s ease;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: .35rem;
}

/* ── Share Link Box ────────────────────────────────────────────── */
#share-box {
  margin-top: 1.5rem;
  background: rgba(56,189,248,.08);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: none;
}
#share-box.visible { display: block; }
#share-box h4 { color: var(--success); margin-bottom: .75rem; font-size: 1rem; }

.share-link-row {
  display: flex;
  gap: .5rem;
  align-items: center;
}
.share-link-row input {
  flex: 1;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: .9rem;
  padding: .5rem .8rem;
  font-family: 'Courier New', monospace;
}

/* ── Tables ────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

th {
  background: var(--slate-mid);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: .75rem;
  letter-spacing: .05em;
  padding: .75rem 1rem;
  text-align: left;
  white-space: nowrap;
}

td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--slate-mid);
  color: var(--text);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: rgba(255,255,255,.025); }
tr:hover td { background: rgba(56,189,248,.05); }

.table-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Badges ────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-active  { background: rgba(74,222,128,.15); color: var(--success); }
.badge-expired { background: rgba(248,113,113,.15); color: var(--error); }
.badge-admin   { background: rgba(56,189,248,.15);  color: var(--accent); }
.badge-user    { background: rgba(148,163,184,.15); color: var(--muted); }

/* ── Auth Pages ────────────────────────────────────────────────── */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px - 60px);
  padding: 2rem 1rem;
}

.auth-card {
  background: var(--slate);
  border: 1px solid var(--slate-mid);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow);
}

.auth-card h2 { margin-bottom: 1.75rem; }
.auth-card .auth-footer { margin-top: 1.25rem; text-align: center; font-size: .875rem; color: var(--muted); }

/* ── Hero / Index ──────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}
.hero h1 { margin-bottom: .5rem; }
.hero p   { font-size: 1.05rem; max-width: 520px; margin: 0 auto 2rem; }

/* Upload form card */
.upload-card {
  max-width: 680px;
  margin: 0 auto;
}

/* ── Dashboard stats strip ─────────────────────────────────────── */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--slate);
  border: 1px solid var(--slate-mid);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  text-align: center;
}
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.stat-card .stat-label { font-size: .8rem; color: var(--muted); margin-top: .2rem; }

/* ── Pagination ────────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: .5rem;
  justify-content: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.pagination a,
.pagination span {
  padding: .4rem .9rem;
  border-radius: var(--radius);
  font-size: .875rem;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--slate);
}
.pagination a:hover   { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pagination .current  { background: var(--accent); color: var(--navy); border-color: var(--accent); font-weight: 700; }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ── Password Prompt (download page) ───────────────────────────── */
.pw-gate {
  max-width: 400px;
  margin: 3rem auto;
}

/* ── Admin panel ───────────────────────────────────────────────── */
.admin-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--slate-mid);
  padding-bottom: .75rem;
  flex-wrap: wrap;
}
.admin-tabs a {
  padding: .4rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  color: var(--muted);
  font-weight: 600;
}
.admin-tabs a:hover  { background: var(--slate-mid); color: var(--text); text-decoration: none; }
.admin-tabs a.active { background: var(--accent); color: var(--navy); }

/* ── API key box ───────────────────────────────────────────────── */
.api-key-box {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem .9rem;
  font-family: 'Courier New', monospace;
  font-size: .85rem;
  color: var(--accent);
  word-break: break-all;
}

/* ── Utility ───────────────────────────────────────────────────── */
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.text-muted    { color: var(--muted); }
.text-accent   { color: var(--accent); }
.text-success  { color: var(--success); }
.text-error    { color: var(--error); }
.text-center   { text-align: center; }
.text-sm       { font-size: .85rem; }
.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.gap-1         { gap: .5rem; }
.gap-2         { gap: 1rem; }
.w-full        { width: 100%; }
.truncate      { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.divider       { border: none; border-top: 1px solid var(--slate-mid); margin: 1.5rem 0; }
.section-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; color: var(--text); }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--slate);
    flex-direction: column;
    padding: 1rem;
    gap: .25rem;
    border-bottom: 1px solid var(--slate-mid);
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  nav { position: relative; }

  .auth-card { padding: 1.75rem 1.25rem; }
  .card      { padding: 1.25rem; }

  th, td { padding: .6rem .75rem; }
}
