:root {
  --bg:        #f4f6f8;
  --surface:   #ffffff;
  --border:    #d8dee6;
  --text:      #1c2733;
  --muted:     #66768a;
  --accent:    #0f6ab4;
  --accent-dk: #0b5490;
  --shadow:    0 1px 2px rgba(16, 32, 48, .06), 0 8px 24px rgba(16, 32, 48, .07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
}
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.topbar p  { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* Logotip je široka slika (648x140); visina ga drži u retku sa zaglavljem. */
.topbar .logo {
  height: 34px;
  width: auto;
  flex: none;
}
.topbar-text { flex: 1 1 auto; min-width: 0; }

.topbar-user {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}
.topbar-user .who { font-weight: 600; color: var(--text); }
.topbar-user a { color: var(--accent); text-decoration: none; }
.topbar-user a:hover { text-decoration: underline; }

@media (max-width: 620px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .topbar-text { flex-basis: 100%; order: 3; }
}

/* -------------------------------------------------------------- prijava */

.login-page { background: var(--bg); }

.login {
  max-width: 380px;
  margin: 0 auto;
  padding: 72px 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 28px 26px 26px;
}
.login-card .logo {
  display: block;
  height: 38px;
  width: auto;
  margin-bottom: 20px;
}
.login-card h1 { margin: 0; font-size: 18px; }
.login-card .help { margin: 6px 0 20px; color: var(--muted); font-size: 13px; }
.login-card label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.login-card input {
  width: 100%;
  margin-bottom: 16px;
  padding: 11px 13px;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
}
.login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 106, 180, .16);
}
.login-card button { width: 100%; }
.login-card .error { margin: 0 0 16px; }

main { max-width: 980px; margin: 0 auto; padding: 28px 24px 64px; }

/* ---------------------------------------------------------------- tražilica */

.search-block { margin-bottom: 28px; }
.search-block > label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 8px;
}

.search-wrap { position: relative; }

#q {
  width: 100%;
  padding: 13px 44px 13px 15px;
  font-size: 16px;
  font-family: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
#q:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 106, 180, .16);
}

.spinner {
  position: absolute;
  top: 50%; right: 15px;
  width: 16px; height: 16px;
  margin-top: -8px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0; right: 0;
  max-height: 380px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.results li {
  padding: 9px 11px;
  border-radius: 6px;
  cursor: pointer;
}
.results li[aria-selected="true"],
.results li:hover { background: #eef4fa; }
.results li.empty { color: var(--muted); cursor: default; }
.results li.empty:hover { background: none; }

.results .name { display: block; font-weight: 600; }
.results .sub  { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.results mark  { background: #ffeeba; color: inherit; border-radius: 2px; }
.results .nhs  { margin-left: 8px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px;
                 font-weight: 500; font-size: 12px; color: var(--accent-dk); white-space: nowrap;
                 font-variant-numeric: tabular-nums; }

.help { margin: 8px 2px 0; font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------------ obrazac */

.detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 22px 24px 24px;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.detail-head h2 { margin: 0; font-size: 17px; line-height: 1.35; }
.meta { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.meta code {
  background: #eef1f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
}
.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: #e6f0f9;
  color: var(--accent-dk);
  border-radius: 999px;
}

.note {
  margin: 18px 0;
  padding: 11px 14px;
  font-size: 13.5px;
  color: #5c4a12;
  background: #fff8e6;
  border: 1px solid #f0e0b0;
  border-radius: 7px;
}

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px 20px;
}
.field.wide { grid-column: 1 / -1; }

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--muted);
  margin-bottom: 4px;
}
.field input,
.field textarea {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 106, 180, .14);
}
/* Polja koja API nije mogao popuniti */
.field input.blank,
.field textarea.blank { background: #fbfcfd; }
.field textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
.field .hint { display: block; margin-top: 4px; font-size: 11.5px; color: #8593a5; }
.field .src { display: block; margin-top: 3px; font-size: 11.5px; color: #2e7d5b; }
.field .counter { float: right; font-weight: 400; color: #8593a5; }
.field .counter.over { color: #c0392b; font-weight: 600; }

.actions {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 7px;
  padding: 10px 18px;
}
button.primary {
  background: var(--accent);
  border: 1px solid var(--accent-dk);
  color: #fff;
  font-weight: 600;
}
button.primary:hover { background: var(--accent-dk); }
button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 7px 14px;
  font-size: 13.5px;
}
button.ghost:hover { background: #f1f4f7; }

.warn {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid #f0d48a;
  border-left: 3px solid #d9a441;
  border-radius: 4px;
  background: #fdf8ec;
  color: #6b4e12;
  font-size: 13px;
}

.error {
  margin-top: 20px;
  padding: 12px 15px;
  background: #fdeceb;
  border: 1px solid #f3c4c0;
  border-radius: 7px;
  color: #96271f;
  font-size: 14px;
}

/* Poveznice na SmPC / PIL uz obavijesti o odabranom proizvodu */
.docs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: var(--surface);
  font-size: 13px;
}
.docs span { color: var(--muted); }
.docs a { color: var(--accent); font-weight: 600; text-decoration: none; }
.docs a:hover { text-decoration: underline; }
