/* Baseline — stilovi izvedeni 1:1 iz Figma fajla "Directory UI" */

:root {
  --bg: #0f0f0f;
  --panel: #1c1c1c;
  --accent: #fd8550;
  --modal: #1b1b1b;
  --modal-border: #282828;
  --field: #272727;
  --create: #525252;

  --surface: rgba(255, 255, 255, 0.05);
  --surface-strong: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.1);
  --hover-border: rgba(255, 255, 255, 0.2);
  --muted: rgba(255, 255, 255, 0.2);
  --muted-half: rgba(255, 255, 255, 0.5);

  --font: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

input, button, textarea { font: inherit; }

/*
 * Figma reže tekst na cap-height, pa su svi razmaci u dizajnu računati bez
 * leading-a. `text-box` daje isti rezultat; padding vraća prostor za repove
 * slova (g, j, p) koje bi `overflow: hidden` inače odsekao, a negativna
 * margina ga poništava u rasporedu.
 */
.trim {
  text-box: trim-both cap alphabetic;
  padding-bottom: 0.25em;
  margin-bottom: -0.25em;
}

/*
 * Polja za unos ne smeju da se trimuju: browser crta tekst inputa u kutiji
 * visine line-height i sve ispod nje odseče, pa j, g, p, y ostanu bez repa.
 * Visinu polja zato drži sama kutija, a tekst dobija pun line-height.
 */
input.trim,
.search input {
  text-box: normal;
  line-height: normal;
  padding-top: 0;
  padding-bottom: 0;
}

.search input { margin-bottom: 0; }

/* ---------- raspored ---------- */

.app {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100%;
  padding: 10px;
}

/* ---------- header ---------- */

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 15px;
}

.logo { order: 1; width: 104.47px; height: 25px; flex-shrink: 0; }

.search {
  order: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  height: 41px;
  padding: 0 20px;
  border-radius: 100px;
  background: var(--panel);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: none;
  color: #fff;
  font-size: 16px;
  height: 100%;
}

.search input::placeholder { color: rgba(255, 255, 255, 0.3); font-weight: 300; }
.search input::-webkit-search-cancel-button { display: none; }

.btn-accent {
  order: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 10px 20px;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  overflow: hidden;
  transition: opacity 0.15s;
}

.btn-accent:hover { opacity: 0.9; }
.btn-accent:disabled { opacity: 0.6; cursor: default; }
.btn-accent img { width: 10px; height: 10px; }

@media (min-width: 900px) {
  .header { flex-wrap: nowrap; gap: 20px; padding: 20px; }
  .search { order: 2; width: 400px; flex-shrink: 0; }
  .btn-accent { order: 3; }
}

/* ---------- filter traka ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  align-items: center;
  gap: 10px;
  padding: 15px;
  border-radius: 6px;
  background: var(--panel);
  overflow: hidden;
}

@media (min-width: 900px) { .filters { padding: 20px; } }

.chip {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 10px 20px;
  border: 0;
  border-radius: 4px;
  background: var(--surface);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  overflow: hidden;
  transition: background-color 0.15s, color 0.15s;
}

.chip:hover { background: rgba(255, 255, 255, 0.1); }

.chip.is-active {
  border: 0.5px solid var(--accent);
  color: var(--accent);
  background: var(--surface);
}

/* ---------- mreža kartica ---------- */

.grid-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 420px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 640px)  { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px)  { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1280px) { .grid { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 1440px) { .grid { grid-template-columns: repeat(7, 1fr); } }

.empty {
  margin: auto;
  padding: 0 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 300;
  line-height: 1;
  color: rgba(255, 255, 255, 0.4);
}

/* ---------- kartica ---------- */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
  border-radius: 4px;
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.15s;
}

.card:hover { border-color: var(--hover-border); }

.card > a {
  display: flex;
  flex: 1;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.card-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
  background: var(--surface-strong);
  overflow: hidden;
}

@media (min-width: 640px) {
  .card-thumb { aspect-ratio: auto; height: 140px; }
}

.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 20px;
  padding: 15px;
}

.card-head { display: flex; flex-direction: column; gap: 10px; }

.card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-desc {
  margin: 0;
  min-height: 21px;
  font-size: 12px;
  font-weight: 300;
  line-height: 1;
  color: var(--muted-half);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags { display: flex; flex-wrap: wrap; gap: 10px; }

.tag {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 5px 10px;
  border: 0.5px solid var(--accent);
  border-radius: 4px;
  background: var(--surface);
  color: var(--accent);
  font-size: 10px;
  line-height: 1;
  overflow: hidden;
}

.card-link {
  margin: auto 0 0;
  font-size: 12px;
  font-weight: 300;
  line-height: 1;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Izmena i brisanje nisu u dizajnu — vide se tek na hover. */
.card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 5px;
  opacity: 0;
  transition: opacity 0.15s;
}

.card:hover .card-actions,
.card-actions:focus-within { opacity: 1; }

/* Na dodirnim ekranima hover ne postoji, pa bi dugmad ostala nevidljiva. */
@media (hover: none) { .card-actions { opacity: 1; } }

.card-actions button {
  padding: 5px 10px;
  border: 0;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: color 0.15s;
}

.card-actions button:hover { color: var(--accent); }

/* ---------- modal ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
}

.overlay[hidden] { display: none; }

.modal {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 419px;
  flex-shrink: 0;
  margin: auto 0;
  padding: 20px;
  border: 1px solid var(--modal-border);
  border-radius: 6px;
  background: var(--modal);
}

.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }

.modal-title { margin: 0; font-size: 18px; font-weight: 700; line-height: 1; }

.modal-close {
  flex-shrink: 0;
  margin: -5px;
  padding: 5px;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  line-height: 0;
  transition: opacity 0.15s;
}

.modal-close:hover { opacity: 0.6; }

.field { display: flex; flex-direction: column; gap: 10px; }

.field-label {
  font-size: 12px;
  font-weight: 300;
  line-height: 1;
  color: #fff;
  opacity: 0.5;
}

.field-head { display: flex; align-items: center; justify-content: space-between; }

.link-button {
  flex-shrink: 0;
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
}

.link-button:disabled { opacity: 0.5; cursor: default; }

.input {
  width: 100%;
  height: 37px;
  padding: 0 20px;
  border: 0;
  outline: 0;
  border-radius: 4px;
  background: var(--surface);
  color: #fff;
  font-size: 14px;
  line-height: 1;
}

.input::placeholder { color: rgba(255, 255, 255, 0.3); font-weight: 300; }

/* Polje sa brojačem ili dugmetom sa desne strane */
.input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 5px 20px;
  border-radius: 4px;
  background: var(--surface);
  overflow: hidden;
}

.input-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: #fff;
  font-size: 14px;
  line-height: 1;
}

.input-row input::placeholder { color: rgba(255, 255, 255, 0.3); font-weight: 300; }

.counter {
  flex-shrink: 0;
  padding-left: 10px;
  font-size: 14px;
  font-weight: 300;
  line-height: 1;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.3);
}

/* Dropdown kategorija — u dizajnu prelazi preko dugmeta "Dodaj". */
.combo { position: relative; z-index: 20; display: flex; flex-direction: column; gap: 10px; }

.combo.is-open .input-row {
  background: var(--field);
  border-radius: 4px 4px 0 0;
}

.create-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 0 0 0 10px;
  border: 0;
  background: none;
  cursor: pointer;
}

.create-button:disabled { cursor: default; }
.create-button img { width: 10px; height: 10px; }

.create-button span {
  font-size: 14px;
  font-weight: 300;
  line-height: 1;
  color: var(--create);
}

.create-button:not(:disabled) span { color: rgba(255, 255, 255, 0.5); }
.create-button:not(:disabled) img { filter: brightness(2); }

.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  border-radius: 0 0 4px 4px;
  background: var(--field);
}

.dropdown button {
  display: flex;
  align-items: center;
  height: 40px;
  flex-shrink: 0;
  width: 100%;
  padding: 5px 5px 5px 20px;
  border: 0;
  border-top: 1px solid var(--modal);
  background: var(--field);
  color: #fff;
  font-size: 14px;
  font-weight: 300;
  line-height: 1;
  text-align: left;
  cursor: pointer;
}

/* `display: flex` iznad nadjačava podrazumevano [hidden] { display: none }. */
.dropdown[hidden] { display: none; }

.dropdown button:hover { background: rgba(255, 255, 255, 0.05); }

.chosen { display: flex; flex-wrap: wrap; gap: 10px; }

.chosen button {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 5px 10px;
  border: 0.5px solid var(--accent);
  border-radius: 4px;
  background: var(--surface);
  color: var(--accent);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}

.note { margin: 0; font-size: 12px; font-weight: 300; line-height: 1; }
.note-warn { color: var(--accent); }
.note-error { color: #ff6b6b; }

.submit { align-self: flex-start; }

.boot-error {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 15px 20px;
  border-radius: 6px;
  background: #ff6b6b;
  color: #1b1b1b;
  font-size: 13px;
  line-height: 1.5;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
