/* SlapZip - Optimizacija fajlova za klijente - Slap It
   Boje preuzete iz brendinga SLAP IT sajta (crvena #b4261c + tamnoplava #252b3f).
   Minimalistički, jedan stylesheet, bez framework-a. */

:root {
  --bg: #f3f7fb;
  --bg-elevated: #ffffff;
  --ink: #252b3f;
  --ink-soft: #565d70;
  --ink-faint: #8b93a3;
  --line: #e3e8ef;
  --line-strong: #d0d6e0;
  --accent: #b4261c;
  --accent-ink: #ffffff;
  --accent-soft: #fbe9e7;
  --accent-strong: #98201a;
  --success: #1f9d6b;
  --success-soft: #e6f6ef;
  --danger: #b4261c;
  --danger-soft: #fbe9e7;
  --radius-lg: 18px;
  --radius: 13px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(37, 43, 63, 0.06), 0 1px 3px rgba(37, 43, 63, 0.05);
  --shadow: 0 6px 24px rgba(37, 43, 63, 0.09), 0 2px 6px rgba(37, 43, 63, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161a26;
    --bg-elevated: #1c2130;
    --ink: #eef0f4;
    --ink-soft: #b6bccb;
    --ink-faint: #838b9d;
    --line: #2b3142;
    --line-strong: #3b4256;
    --accent: #e0574b;
    --accent-ink: #ffffff;
    --accent-soft: #2c1614;
    --accent-strong: #ef6a5e;
    --success: #37c98b;
    --success-soft: #10241c;
    --danger: #e0574b;
    --danger-soft: #2c1614;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

/* ---------- Brand marks ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand__logo {
  width: auto;
  height: 30px;
  flex: none;
  display: block;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__name {
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 17px;
  color: var(--ink);
}
.brand__sub {
  font-size: 12px;
  color: var(--ink-faint);
}

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 34px 30px 26px;
  overflow: hidden;
}
.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--accent);
}
.login-card .brand { justify-content: center; margin-bottom: 6px; }
.login-card__title {
  text-align: center;
  font-size: 15px;
  color: var(--ink-soft);
  margin: 14px 0 22px;
}
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
input[type="password"],
input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 11px 13px;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: filter 0.15s, opacity 0.15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--ghost {
  width: auto;
  color: var(--ink-soft);
  background: transparent;
  border-color: var(--line-strong);
}
.btn--ghost:hover { filter: none; background: var(--bg); }
.btn--lg { padding: 14px 20px; font-size: 15.5px; }
.btn--block { width: 100%; }

.alert {
  font-size: 13.5px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.alert--error { background: var(--danger-soft); color: var(--danger); }
.alert--info { background: var(--accent-soft); color: var(--accent); }
.alert[hidden] { display: none; }

.footer-note {
  text-align: center;
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 22px;
}

/* ---------- App shell ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 26px 20px 60px;
}

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.tab {
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.tab:hover { border-color: var(--line-strong); color: var(--ink); }
.tab[aria-selected="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 18px;
}
.card__title {
  font-size: 16px;
  font-weight: 650;
  margin: 0 0 4px;
}
.card__desc {
  font-size: 13px;
  color: var(--ink-faint);
  margin: 0 0 18px;
}

.panel[hidden] { display: none; }

/* ---------- Dropzone ---------- */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 34px 20px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.is-drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type="file"] { display: none; }
.dropzone__icon { width: 30px; height: 30px; opacity: 0.7; }
.dropzone__hint { font-size: 12px; color: var(--ink-faint); }

.filecard {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}
.filecard[hidden] { display: none; }
.filecard__meta { flex: 1; min-width: 0; }
.filecard__name {
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filecard__size { font-size: 12px; color: var(--ink-faint); }
.filecard__remove {
  flex: none;
  border: none;
  background: transparent;
  color: var(--ink-faint);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.filecard__remove:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------- Options ---------- */
.options {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}
.options[hidden] { display: none; }
.opt-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.seg {
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.seg label {
  flex: 1;
  margin: 0;
  text-align: center;
  padding: 9px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) {
  background: var(--accent);
  color: var(--accent-ink);
}
.seg label + label { border-left: 1px solid var(--line-strong); }

.checkbox {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: var(--ink-soft);
  cursor: pointer;
}
.checkbox input { width: auto; }

.hint { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }

/* ---------- Progress ---------- */
.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin: 16px 0 4px;
}
.progress[hidden] { display: none; }
.progress__bar {
  height: 100%;
  width: 30%;
  background: var(--accent);
  border-radius: 999px;
  animation: slide 1.1s ease-in-out infinite;
}
@keyframes slide {
  0% { margin-left: -30%; }
  100% { margin-left: 100%; }
}

/* ---------- Result ---------- */
.result {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--bg);
}
.result[hidden] { display: none; }
.result__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 8px;
}
.stat__label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.stat__value { font-size: 19px; font-weight: 680; letter-spacing: -0.01em; }
.stat__value--save { color: var(--success); }
.result__note {
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--success-soft);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  margin: 12px 0;
}
.result__note--plain {
  background: var(--bg);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.result__meta { font-size: 12px; color: var(--ink-faint); margin-bottom: 14px; }

/* ---------- File list (multi-select) ---------- */
.filelist {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.filelist[hidden] { display: none; }
.filelist__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 13px;
}
.filelist__idx {
  flex: none;
  min-width: 18px;
  color: var(--ink-faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.filelist__thumb {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}
.filelist__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.filelist__thumb--none {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-faint);
  letter-spacing: 0.03em;
}
.filelist__meta { flex: 1; min-width: 0; }
.filelist__name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filelist__sub { font-size: 11.5px; color: var(--ink-faint); }
.filelist__status { flex: none; font-size: 12px; font-weight: 700; }
.filelist__status--ok { color: var(--success); }
.filelist__status--err { color: var(--danger); }
.filelist__btns { flex: none; display: flex; gap: 2px; }
.filelist__btn {
  border: none;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
}
.filelist__btn:hover { color: var(--ink); background: var(--line); }
.filelist__btn:disabled { opacity: 0.3; cursor: default; }
.filelist__btn--rm:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------- Cropper (pomjeranje + zum) ---------- */
.cropper { margin: 4px 0 18px; }
.cropper[hidden] { display: none; }
.cropper__frame {
  position: relative;
  margin: 0 auto;
  max-width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.cropper__frame:active { cursor: grabbing; }
.cropper__frame img {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  max-width: none;
  will-change: transform;
  pointer-events: none;
}
.cropper__ctl {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}
.cropper__zoom {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.cropper__zoom input[type="range"] { flex: 1; accent-color: var(--accent); }
.cropper__ctl .btn--ghost { width: auto; flex: none; }

/* ---------- Batch results ---------- */
.results { display: grid; gap: 14px; margin-top: 16px; }
.results[hidden] { display: none; }
.result__file {
  font-weight: 650;
  font-size: 13.5px;
  margin-bottom: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.batchbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--ink-soft);
}
.batchbar[hidden] { display: none; }
.batchbar .btn--ghost { width: auto; }

.engine-banner {
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 16px;
}

@media (max-width: 560px) {
  .result__grid { grid-template-columns: 1fr; gap: 8px; }
  .topbar { padding: 12px 14px; }
  .container { padding: 18px 14px 48px; }
}
