:root {
  --bg: #f6f7f9;
  --card-bg: #ffffff;
  --text: #1c1f26;
  --muted: #6b7280;
  --border: #e3e6eb;
  --primary: #2b5fd9;
  --primary-hover: #1f4bb8;
  --green-bg: #e6f6ec;
  --green-text: #157347;
  --red-bg: #fdeceb;
  --red-text: #c0392b;
  --danger: #c0392b;
  --danger-hover: #a5311f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { letter-spacing: -0.01em; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
a.plain { color: inherit; text-decoration: none; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.75rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar nav { display: flex; align-items: center; gap: 0.75rem; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
}
.brand:hover { text-decoration: none; }
.brand-logo {
  height: 47px;
  width: auto;
  max-width: 182px;
  object-fit: contain;
  display: block;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.brand-org {
  font-size: 1.04rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.brand-site {
  font-size: 1.01rem;
  color: var(--muted);
}

@media (max-width: 480px) {
  .hide-sm { display: none; }
}


.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.5rem;
}
.container-narrow { max-width: 480px; }
.container-wide { max-width: 960px; }

.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.footer-sep { margin: 0 0.4rem; opacity: 0.6; }
.footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.footer a:hover { color: var(--primary); }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card h2 { margin-top: 0; }

/* Dugme "Dodaj izabrano u korpu" na dnu spiska opreme — namerno vidno
   odvojeno od poslednje tabele (veliki razmak + sopstvena kartica), da se
   nikad ne "lepi" direktno uz tabelu iznad. */
.cart-cta {
  margin-top: 3rem;
  text-align: center;
}

.admin-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}
.admin-actions h2 { margin: 0; }

.empty { color: var(--muted); padding: 2rem 0; text-align: center; }

.rules-block {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  font-size: 11pt;
}
.rules-block h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}
.rules-block p {
  margin: 0 0 0.5rem;
  color: var(--text);
  line-height: 1.35;
}
.contact-title { font-weight: 600; margin-bottom: 0.4rem !important; }
.contact-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text);
}
.contact-list li { margin-bottom: 0.25rem; }

.rules-list {
  margin: 0 0 0.5rem;
  padding-left: 1.1rem;
  color: var(--text);
  line-height: 1.35;
}
.rules-list li { margin-bottom: 0.25rem; }

.hours-block {
  background: #1c3f6e;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.hours-block p {
  margin: 0 0 0.5rem;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.6;
}
.hours-block p:last-child { margin-bottom: 0; }

/* Kalendar zakazivanja */
.calendar-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.calendar-header h3 { margin: 0; font-size: 1.05rem; }
.cal-view-toggle { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.cal-view-btn {
  background: #eef0f3;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.cal-view-btn:hover { background: #e3e6eb; }
.cal-view-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.cal-month-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.75rem;
  text-align: center;
}
.cal-dow-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-bottom: 0.25rem;
}
.cal-dow {
  text-align: center;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  padding: 0.3rem 0;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.cal-day {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg);
  font-size: 0.9rem;
  cursor: pointer;
}
.cal-day:hover { filter: brightness(0.96); }
.cal-day.other-month { color: var(--muted); opacity: 0.45; }
.cal-day.has-event { background: var(--primary); color: #fff; font-weight: 700; }
.cal-day.has-event .cal-dot { background: #fff; }
.cal-day.selected { outline: 2px solid var(--primary); outline-offset: -2px; }
.cal-dot {
  position: absolute;
  bottom: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
}

.cal-week-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(64px, 1fr));
  gap: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.cal-week-day {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 0.5rem 1.1rem;
  text-align: center;
  cursor: pointer;
}
.cal-week-day:hover { filter: brightness(0.97); }
.cal-week-day.has-event { background: var(--primary); border-color: var(--primary); color: #fff; }
.cal-week-day.has-event .cal-week-dayname { color: rgba(255, 255, 255, 0.8); }
.cal-week-day.has-event .cal-dot { background: #fff; }
.cal-week-day.selected { outline: 2px solid var(--primary); outline-offset: -2px; }
.cal-week-dayname {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  white-space: nowrap;
}
.cal-week-daynum { font-size: 1rem; font-weight: 700; margin-top: 0.25rem; white-space: nowrap; }
.cal-week-day .cal-dot { bottom: 6px; left: 50%; transform: translateX(-50%); }

.cal-year-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
}
@media (max-width: 640px) {
  .cal-year-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.cal-mini-month { }
.cal-mini-title {
  text-align: center;
  font-weight: 700;
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
}
.cal-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}
.cal-mini-day {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: var(--muted);
  border-radius: 3px;
}
.cal-mini-day.has-event { background: var(--primary); color: #fff; font-weight: 700; }
.cal-mini-day.selected { outline: 2px solid var(--primary); outline-offset: -1px; }

.booking-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.booking-field { display: flex; flex-direction: column; gap: 0.3rem; }
.booking-field label {
  font-size: 0.78rem;
  color: var(--muted);
}
.booking-field input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--card-bg);
  color: var(--text);
}
.booking-hint { margin-top: 0.6rem; font-size: 0.82rem; }

/* Naslov uvek stoji neposredno iznad nekog elementa sa zaobljenim uglovima
   (tabela, kartica...) — bez malog pomeranja udesno deluje neporavnato sa
   pravom linijom ivice, jer ta ivica kod zaobljenog ugla počinje malo kasnije
   (otprilike širina jednog slova, na oko). Isto važi i za .heading-above-table
   ispod, za slučaj kad tabela nije prva stavka na strani nego je ugnežđena
   unutar kartice. */
.category-heading {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1c3f6e;
  margin: 3.5rem 0 0.5rem 0.6rem;
}
.category-heading-first { margin-top: 0; }

.heading-above-table { margin-left: 0.6rem; }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

/* Lista reversa (admin) — fiksna visina, vertikalni skrol kad ima puno
   redova, umesto da razvuče celu stranicu naniže. */
.reversi-scroll {
  max-height: 70vh;
  overflow-y: auto;
}
.reversi-scroll thead th {
  position: sticky;
  top: 0;
  background: var(--card-bg);
  z-index: 1;
}

.equipment-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}
.equipment-table th,
.equipment-table td {
  padding: 0.4rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  line-height: 1.3;
  font-size: 11pt;
}
.equipment-table thead th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  vertical-align: top;
}
.equipment-table tbody tr:last-child td { border-bottom: none; }
.equipment-table tbody tr:hover { background: #fafbfc; }

.equipment-table td.col-note { font-size: 0.88rem; }

/* Uže razmaci između kolona Naziv / Status opreme / Zadužio / Datum */
.equipment-table th:nth-child(2), .equipment-table td:nth-child(2) {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
.equipment-table th:nth-child(3), .equipment-table td:nth-child(3),
.equipment-table th:nth-child(4), .equipment-table td:nth-child(4),
.equipment-table th:nth-child(5), .equipment-table td:nth-child(5) {
  padding-left: 0.15rem;
  padding-right: 0.15rem;
}

.col-img { width: 64px; }
.col-actions { width: 1%; white-space: nowrap; }

.thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  display: block;
  cursor: zoom-in;
}

#thumb-zoom-preview {
  position: fixed;
  z-index: 1000;
  display: none;
  pointer-events: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  padding: 10px;
}
#thumb-zoom-preview img {
  display: block;
  max-width: 260px;
  max-height: 260px;
  object-fit: contain;
}
.thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef0f3;
  font-size: 1.2rem;
}
.thumb-preview {
  width: 96px;
  height: 96px;
  margin-top: 0.5rem;
}

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

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.badge-green { background: var(--green-bg); color: var(--green-text); }
.badge-red { background: var(--red-bg); color: var(--red-text); }

.status-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
  font-size: 9pt;
  font-weight: 400;
  color: var(--muted);
}
.status-dot {
  width: 8.8px;
  height: 8.8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.available { background: #34d058; }
.status-dot.unavailable { background: #ff5c4d; }
.status-dot.permanent { background: #8b5cf6; }
.status-dot.requested { background: #f0ad4e; }

/* Red opreme čiji je rok vraćanja prošao (admin panel) — blago crvenkasta
   pozadina na celom redu, plus istaknuta oznaka "kasni" uz sam datum. */
.equipment-table tr.row-overdue { background: var(--red-bg); }
.equipment-table tr.row-overdue:hover { background: var(--red-bg); filter: brightness(0.97); }
.overdue-cell { color: var(--red-text); font-weight: 600; }
.overdue-tag {
  display: inline-block;
  background: var(--red-text);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  margin-left: 0.3rem;
  vertical-align: middle;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 2rem;
  align-items: stretch;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem 2rem;
  min-width: 220px;
}
.stat-value {
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}
.stat-label {
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 0.4rem;
}
.stat-card.overdue {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.stat-card.overdue .stat-value { color: #d64545; }

.stat-card.overdue-list {
  min-width: 300px;
  flex: 1 1 300px;
}
.overdue-names {
  margin: 0.6rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.95rem;
}
.overdue-names li { margin-bottom: 0.35rem; }

/* Donut grafik statusa opreme */
.donut-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-width: 340px;
}
.donut {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}
.donut-hole {
  position: absolute;
  inset: 18px;
  background: var(--card-bg);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.donut-total {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
}
.donut-total-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.15rem;
}
.donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.donut-legend strong { margin-left: 0.3rem; }
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.5rem;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin: 1.75rem 0 1.5rem;
}

.filter-dd {
  position: relative;
}
.btn-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  list-style: none;
  background: #eef0f3;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  user-select: none;
}
.btn-filter::-webkit-details-marker { display: none; }
.btn-filter:hover { background: #e3e6eb; }
.dd-arrow { font-size: 0.75rem; color: var(--muted); }

.filter-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  z-index: 20;
  min-width: 220px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}
.filter-option {
  text-align: left;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
}
.filter-option:hover { background: var(--bg); }
.filter-option.active {
  background: #eef0f3;
  font-weight: 700;
}

.waitlist-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start;
}

.waitlist-names {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.88rem;
  color: var(--text);
}
.waitlist-name-row { white-space: nowrap; }

.waitlist-count {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #9a6b00;
  background: #fff3cd;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.3rem;
  text-decoration: none;
}
a.waitlist-count:hover { text-decoration: underline; }

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn-small { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f0f1f3; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }
.btn-cart {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #157347;
  color: #fff;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
}
.btn-cart:hover { background: #125c39; }
.cart-icon { width: 20px; height: 20px; flex-shrink: 0; }

.inline-form { display: inline-block; margin: 0; }

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

.loan-details { display: inline-block; position: relative; }
.loan-details summary { list-style: none; cursor: pointer; }
.loan-details summary::-webkit-details-marker { display: none; }
.loan-form {
  position: absolute;
  z-index: 10;
  top: 110%;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 270px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}
.loan-form input {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}
.loan-form .checkbox-label {
  align-items: flex-start;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--muted);
}
.loan-form .checkbox-label input[type="checkbox"] {
  margin-top: 0.15rem;
}

form label {
  display: block;
  margin-bottom: 1rem;
  font-weight: 600;
  font-size: 0.9rem;
}
form label.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}
/* Čekboks van forme (povezan preko HTML "form" atributa, ne ugnežđen) —
   koristi se u tabeli opreme za izbor stavki za korpu. */
.checkbox-label-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
}
.checkbox-label-inline input[type="checkbox"] {
  width: auto;
  margin: 0;
}
form label.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}
form input[type="text"],
form input[type="password"],
form input[type="email"],
form input[type="date"],
form input[type="file"],
form textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: normal;
}
form textarea { resize: vertical; }

.alert {
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.alert-error { background: var(--red-bg); color: var(--red-text); }

/* Sajt je namerno uvek svetao (belа pozadina), bez obzira na sistemski
   dark mode — po zahtevu, ne pratimo prefers-color-scheme. */

body.auth-bg {
  min-height: 100vh;
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
  background-attachment: fixed;
}
body.auth-bg-student { background-image: url('../img/filmstil.jpg'); }
body.auth-bg-admin {
  background-image: url('../img/marina-ulaj.jpg');
  background-position: center -80px;
}
body.auth-bg .topbar {
  background: rgba(255, 255, 255, 0.96);
}
body.auth-bg .container-narrow {
  max-width: 360px;
  padding-top: 3rem;
}
body.auth-bg-student .container-narrow {
  max-width: 440px;
}

@media (max-width: 640px) {
  body.auth-bg { background-attachment: scroll; }
  .topbar { padding: 0.65rem 1rem; gap: 0.6rem; }
  .container { padding: 1rem; }

  .brand { gap: 0.55rem; }
  .brand-logo { height: 36px; max-width: 120px; }
  .brand-org { font-size: 0.86rem; }
  .brand-site { font-size: 0.76rem; line-height: 1.3; }

  .stats-row { gap: 0.85rem; }
  .stat-card,
  .donut-card,
  .stat-card.overdue-list { min-width: 0; width: 100%; }
  .donut-card { flex-wrap: wrap; justify-content: center; text-align: center; }

  .calendar-card, .rules-block, .hours-block { padding: 1rem; }

  .booking-form { align-items: stretch; }
  .booking-field { flex: 1 1 45%; }
  .booking-form > button { flex: 1 1 100%; }
}
