/* up.garda.lv: same plain look as dl.garda.lv (white page, centred logo, system font). */
:root {
  --text: #222;
  --muted: #6b6b6b;
  --line: #e3e3e3;
  --soft: #f6f6f6;
  --teal: #02979d;
  --teal-dark: #017a7f;
  --red: #e4003d;
  --err: #b00020;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #fff;
  color: var(--text);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

body.center { display: flex; align-items: center; justify-content: center; }

img, video, audio { max-width: 100%; height: auto; }
a { color: var(--teal-dark); }
h1 { font-size: 1.25rem; font-weight: 600; margin: .5em 0 .25em; overflow-wrap: anywhere; }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 .75em; }

input, select, button { font: inherit; color: inherit; }
input[type=text], input[type=password], select {
  padding: 6px 10px;
  border: 1px solid #b5b5b5;
  border-radius: 3px;
  background: #fff;
  min-height: 38px;
  max-width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.msg { color: var(--err); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.logo img { display: block; margin: 0 auto; width: 250px; }

/* ---- login / not found ---- */
.login { text-align: center; padding: 16px; max-width: 420px; }
.login label { margin-right: 4px; }
.login input[type=password] { width: 12em; }
.login button { padding: 6px 12px; min-height: 38px; }
.show-pw { color: var(--muted); cursor: pointer; }

.foot { text-align: center; font-size: .875rem; margin: 2.5em 0 1em; display: flex; gap: 1.25em; justify-content: center; align-items: center; flex-wrap: wrap; }
.foot .lang { color: var(--muted); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 40px; padding: 8px 16px;
  border: 1px solid #b5b5b5; border-radius: var(--radius);
  background: #fff; color: var(--text);
  text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn.big { padding: 12px 24px; font-size: 1.05rem; }
.btn:disabled { opacity: .5; cursor: default; }
button.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; }
.icon-btn {
  border: 0; background: none; padding: 6px; min-width: 36px; min-height: 36px;
  color: var(--muted); cursor: pointer; border-radius: var(--radius); font-size: 1.1rem; line-height: 1;
}
.icon-btn:hover { background: var(--soft); color: var(--text); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.danger:hover { color: var(--err); }

/* ---- uploader ---- */
.app main, main.share-page { max-width: 760px; margin: 0 auto; padding: 24px 16px; }
.top { margin: 8px 0 24px; text-align: center; }

.drop {
  border: 2px dashed #c9c9c9;
  border-radius: 10px;
  padding: 32px 16px;
  text-align: center;
  transition: border-color .15s, background-color .15s;
}
.drop.over { border-color: var(--teal); background: #f0fafa; }
.drop-title { font-size: 1.1rem; margin: 0 0 16px; }
.drop-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 0; }
.drop-hint { margin: 14px 0 0; color: var(--muted); font-size: .875rem; }
body.dragging .drop { border-color: var(--teal); }

.batch { margin-top: 24px; }
.batch-head { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .875rem; color: var(--muted); }
.field:first-child { flex: 1 1 260px; }
.field input, .field select, .field textarea { color: var(--text); font-size: 1rem; width: 100%; }
.field.wide { flex: 1 1 100%; }
textarea { font: inherit; padding: 6px 10px; border: 1px solid #b5b5b5; border-radius: 3px; resize: vertical; }
.thanks { font-size: 1.1rem; margin: 0 0 8px; color: var(--teal-dark); }
.badge {
  display: inline-block; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
  color: #fff; background: var(--red); border-radius: 3px; padding: 1px 6px; margin-right: 6px; vertical-align: 1px;
}
.share-note { font-size: .8125rem; color: var(--text); background: var(--soft); border-radius: 4px; padding: 6px 10px; margin: 8px 0 0 56px; white-space: pre-wrap; overflow-wrap: anywhere; }
.share-settings { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .8125rem; color: var(--muted); padding: 8px 0 0 56px; }
.share-settings select, .share-settings input[type=date] { min-height: 34px; padding: 2px 6px; font-size: .875rem; }
.small-btn { min-height: 34px; padding: 4px 12px; font-size: .875rem; }
button.link.expiry { color: inherit; text-decoration: underline dotted; text-underline-offset: 2px; font-size: inherit; }
button.link.expiry:hover { color: var(--teal-dark); }
@media (max-width: 520px) { .share-note { margin-left: 0; } .share-settings { padding-left: 0; } }

.bar { height: 6px; background: var(--soft); border-radius: 3px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--teal); transition: width .2s linear; }
.progress-total { margin-bottom: 12px; }
.progress-total p { margin: 6px 0 0; }

.queue, .shares { list-style: none; margin: 0; padding: 0; }
.queue li {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 4px 12px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.queue li:last-child { border-bottom: 1px solid var(--line); }
.queue .thumb, .shares .thumb {
  width: 44px; height: 44px; border-radius: 4px; background: var(--soft); object-fit: cover;
  display: flex; align-items: center; justify-content: center; font-size: .65rem; color: var(--muted); font-weight: 600;
  grid-row: span 2; overflow: hidden;
}
.queue .name, .shares .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue .status { font-size: .8125rem; color: var(--muted); grid-column: 2; display: flex; gap: 8px; align-items: center; min-width: 0; }
.queue .status .bar { flex: 1; max-width: 220px; }
.queue .actions { grid-row: span 2; grid-column: 3; grid-row-start: 1; }
.queue li.done .status { color: var(--teal-dark); }
.queue li.error .status { color: var(--err); }

.batch-done { margin-top: 16px; padding: 16px; background: #f0fafa; border-radius: 10px; }
.link-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; }
.link-row input { flex: 1 1 240px; min-width: 0; font-size: .95rem; }

.history { margin-top: 40px; }
.shares > li { padding: 12px 0; border-top: 1px solid var(--line); }
.shares > li:last-child { border-bottom: 1px solid var(--line); }
.share-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 2px 12px; align-items: center; }
.share-row .info { min-width: 0; }
.share-row .sub { font-size: .8125rem; color: var(--muted); }
.share-row .tools { display: flex; gap: 2px; }
.share-files { list-style: none; padding: 8px 0 0 56px; margin: 0; font-size: .875rem; }
.share-files li { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 2px 0; }
.share-files .name { flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #222; color: #fff; padding: 10px 16px; border-radius: var(--radius); font-size: .9rem;
  max-width: calc(100vw - 32px); box-shadow: 0 4px 16px rgba(0,0,0,.2); z-index: 20;
}

/* ---- share page ---- */
.share-page { text-align: center; }
.share-page h1 + p { margin-top: 0; }
.share-page h1 { margin-top: 0; }
.single { margin-top: 16px; }
.single .preview { display: block; margin: 0 auto 16px; max-height: 70vh; border-radius: 4px; }
.single audio.preview { width: 100%; }
.file-icon .ext, .tile .ext {
  display: inline-flex; align-items: center; justify-content: center;
  width: 72px; height: 88px; border-radius: 6px; background: var(--soft); color: var(--muted); font-weight: 700;
}
.grid {
  list-style: none; padding: 0; margin: 24px 0 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; text-align: left;
}
.grid .tile {
  text-decoration: none;
  position: relative; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1; background: var(--soft); border-radius: 4px; overflow: hidden;
}
.grid .tile img { width: 100%; height: 100%; object-fit: cover; }
.grid .play {
  position: absolute; width: 44px; height: 44px; border-radius: 50%; background: rgba(0,0,0,.55);
}
.grid .play::after {
  content: ""; position: absolute; left: 17px; top: 13px;
  border-left: 14px solid #fff; border-top: 9px solid transparent; border-bottom: 9px solid transparent;
}
.grid .meta { display: flex; flex-direction: column; gap: 2px; padding-top: 6px; font-size: .8125rem; }
.grid .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid .row { display: flex; justify-content: space-between; gap: 8px; }

/* lightbox */
.lb {
  position: fixed; inset: 0; background: #000; z-index: 30;
  display: flex; align-items: center; justify-content: center; touch-action: pan-y pinch-zoom;
}
.lb img, .lb video { max-width: 100vw; max-height: 100vh; max-height: 100dvh; object-fit: contain; }
.lb button, .lb a {
  position: absolute; background: rgba(0,0,0,.4); border: 0; color: #fff; font-size: 1.5rem;
  width: 48px; height: 48px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center;
  text-decoration: none;
}
.lb .close { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
.lb .dl { top: calc(12px + env(safe-area-inset-top)); right: 68px; font-size: 1.2rem; }
.lb .prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb .next { right: 12px; top: 50%; transform: translateY(-50%); }
.lb .cap {
  position: absolute; left: 0; right: 0; bottom: calc(12px + env(safe-area-inset-bottom)); color: #ddd;
  font-size: .85rem; text-align: center; padding: 0 16px;
}

@media (max-width: 520px) {
  .logo img { width: 200px; }
  .top { margin-bottom: 16px; }
  .drop { padding: 24px 12px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .share-files { padding-left: 0; }
  .lb .prev, .lb .next { display: none; }
}

@media (hover: none) {
  .drop-hint.desktop-only { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

[hidden] { display: none !important; }

.lb .stage { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
