/*
 * Harpoon Upload — shared styles for the uploader and admin pages
 * Brand: navy #031041 and yellow #FBC54F, as Harpoon Review.
 */

:root {
  --navy: #031041;
  --navy-2: #0d1d5c;
  --yellow: #FBC54F;
  --bg: #f4f3ef;
  --card: #ffffff;
  --ink: #16181d;
  --muted: #6b6f78;
  --line: #e2e0d9;
  --danger: #b3261e;
  --danger-bg: #fbeceb;
  --ok: #2e7d32;
  --ok-bg: #e9f4ea;
  --warn-bg: #fff6e0;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.05rem; }
a { color: var(--navy-2); }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ── Header ──────────────────────────────────────────────────────── */

.hd {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 10;
}
.hd__brand { display: flex; align-items: center; gap: 0.6rem; }
.hd__wordmark { height: 18px; width: auto; display: block; }
.hd__product {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--yellow);
  padding-left: 0.6rem;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}
.hd__user { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
.hd__user button { color: #fff; border-color: rgba(255, 255, 255, 0.35); background: transparent; }

/* ── Layout ──────────────────────────────────────────────────────── */

.wrap { max-width: 1000px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

/* ── Controls ────────────────────────────────────────────────────── */

button, .btn {
  font: inherit;
  font-size: 0.88rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 7px;
  padding: 0.38rem 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}
button:hover { border-color: #b9b6ac; }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
button.primary:hover { background: var(--navy-2); }
button.yellow { background: var(--yellow); border-color: var(--yellow); color: var(--navy); font-weight: 600; }
button.link { border: 0; background: none; padding: 0.2rem 0.3rem; color: var(--navy-2); text-decoration: underline; }
button.copied { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }

input[type=text], input[type=password], select {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.42rem 0.6rem;
  background: #fff;
  min-width: 0;
}
select { padding-right: 1.8rem; }
label.check { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; font-size: 0.92rem; }

.url {
  font-family: var(--mono);
  font-size: 0.78rem;
  flex: 1;
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  background: #eceae4;
  color: var(--muted);
}
.badge.public { background: var(--ok-bg); color: var(--ok); }
.badge.private { background: var(--warn-bg); color: #8a5a00; }

.msg { padding: 0.55rem 0.75rem; border-radius: 7px; font-size: 0.9rem; margin-top: 0.6rem; }
.msg.error { background: var(--danger-bg); color: var(--danger); }
.msg.ok { background: var(--ok-bg); color: var(--ok); }

/* ── Find a folder ───────────────────────────────────────────────── */

.finder { position: relative; }
.finder input { width: 100%; font: inherit; border: 1px solid var(--line); border-radius: 7px; padding: 0.55rem 0.75rem; background: #fff; }
.finder input:focus { outline: 2px solid var(--yellow); outline-offset: 0; border-color: var(--yellow); }
.finder__results {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  z-index: 5;
  list-style: none;
  margin: 0;
  padding: 0.3rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(3, 16, 65, 0.12);
  max-height: 320px;
  overflow-y: auto;
}
.finder__results button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  white-space: normal;
  word-break: break-word;
}
.finder__results button:hover, .finder__results button.active { background: #fff6e0; }
.finder__note { padding: 0.45rem 0.6rem; color: var(--muted); font-size: 0.88rem; }

/* ── Location: breadcrumb + folders ──────────────────────────────── */

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem; font-size: 0.95rem; margin: 0.9rem 0 0.6rem; }
.crumbs button { border: 0; background: none; padding: 0.15rem 0.3rem; color: var(--navy-2); font-size: 0.95rem; }
.crumbs button:hover { text-decoration: underline; }
.crumbs .sep { color: var(--muted); }
.crumbs .here { font-weight: 600; padding: 0.15rem 0.3rem; }

.folders { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.folder {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #f8f7f3;
}
.folder::before { content: '📁'; font-size: 0.95rem; }

/* ── Drop zone ───────────────────────────────────────────────────── */

.drop {
  border: 2px dashed #c9c6bc;
  border-radius: var(--radius);
  padding: 1.8rem 1rem;
  text-align: center;
  background: #fbfaf7;
  transition: background 0.15s, border-color 0.15s;
}
.drop.over { background: #fff8e6; border-color: var(--yellow); }
.drop strong { display: block; font-size: 1.05rem; margin-bottom: 0.25rem; }
.drop .row { justify-content: center; margin-top: 0.9rem; }
.dest { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); margin-top: 0.5rem; word-break: break-all; }

/* ── Upload results / file list ──────────────────────────────────── */

.items { list-style: none; margin: 0; padding: 0; }
.item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
}
.item:first-child { border-top: 0; }
.item__thumb {
  width: 44px; height: 44px;
  border-radius: 6px;
  background: #eeece6 center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  overflow: hidden;
}
.item__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__meta { font-size: 0.8rem; color: var(--muted); display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.item__actions { display: flex; gap: 0.4rem; align-items: center; }
.item.error .item__meta { color: var(--danger); white-space: normal; }
.item.error .item__thumb { background: var(--danger-bg); }

.bar { height: 5px; background: #eceae4; border-radius: 99px; overflow: hidden; margin-top: 0.35rem; }
.bar > span { display: block; height: 100%; width: 0; background: var(--navy-2); transition: width 0.15s; }

.empty { color: var(--muted); font-size: 0.9rem; padding: 0.4rem 0; }

/* ── Admin tables ────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.4rem; border-top: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); border-top: 0; }
td.actions { text-align: right; white-space: nowrap; }
tr.dim td { color: var(--muted); }

.clients-scroll { max-height: 420px; overflow-y: auto; border-top: 1px solid var(--line); }
.clients-scroll tr:first-child td { border-top: 0; }
input[type=search] { font: inherit; border: 1px solid var(--line); border-radius: 7px; padding: 0.42rem 0.6rem; background: #fff; }

.gate { max-width: 420px; margin: 12vh auto; text-align: center; }
.gate img { width: 64px; margin-bottom: 1rem; }
.gate form { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1rem; }

@media (max-width: 640px) {
  .hd { padding: 0.6rem 1rem; }
  .item { grid-template-columns: 36px minmax(0, 1fr); }
  .item__thumb { width: 36px; height: 36px; }
  .item__actions { grid-column: 2; }
  .hide-sm { display: none; }
}
