/* ==========================================================================
   Baufens Portal – stilovi (javna stranica) + zajedničke komponente
   ========================================================================== */

:root {
  --ink: #0e2a28;
  --ink-soft: #46615e;
  --muted: #7b8f8d;
  --line: #e3eae8;
  --line-soft: #eef3f2;
  --bg: #f5f8f7;
  --card: #ffffff;
  --brand: #0f2b29;
  --accent: #0d9488;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(14, 42, 40, .04), 0 1px 3px rgba(14, 42, 40, .05);
  --shadow-md: 0 10px 26px rgba(14, 42, 40, .10), 0 2px 6px rgba(14, 42, 40, .05);
  --shadow-lg: 0 24px 60px rgba(14, 42, 40, .18);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: inherit; }

/* hidden atribut mora uvijek pobijediti (npr. .app-card ima display:flex) */
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

.pi { width: 22px; height: 22px; flex: 0 0 auto; }
.pi--sm { width: 16px; height: 16px; }
.pi--xs { width: 14px; height: 14px; }

/* ------------------------------ Traka ----------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand__logo { height: 30px; width: auto; display: block; }

.topbar__right { display: flex; align-items: center; gap: 10px; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--muted);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: #b9cdca; box-shadow: 0 0 0 4px rgba(13, 148, 136, .10); }
.search input {
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  width: 210px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }

/* ------------------------------ Zaglavlje ------------------------------- */

.main { padding: 30px 20px 56px; flex: 1 1 auto; }

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px 28px;
  flex-wrap: wrap;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.hero__text h1 {
  margin: 0 0 4px;
  font-size: 26px;
  letter-spacing: -.02em;
  line-height: 1.15;
}
.hero__text p { margin: 0; color: var(--ink-soft); font-size: 14.5px; }

.hero__stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.stat strong { font-size: 14px; color: var(--ink); }

.hero__note {
  flex: 1 0 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--ink-soft);
  font-size: 13.5px;
}

/* ------------------------------ Sekcije --------------------------------- */

.section { margin-top: 26px; }
.section__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.section__head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.section__line { flex: 1 1 auto; height: 1px; background: var(--line); }

/* ------------------------------ Pločice --------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 14px;
}

.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 154px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.app-card__bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--app-color, var(--accent));
  opacity: .85;
}
.app-card--disabled .app-card__bar { opacity: .3; }
.app-card--disabled { background: #fcfdfd; }

a.app-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #cfe0dd; }
a.app-card:focus-visible { outline: 3px solid rgba(13, 148, 136, .35); outline-offset: 2px; }

.app-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

.app-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #eef3f2;
  background: color-mix(in srgb, var(--app-color, #2563eb) 12%, #ffffff);
  color: var(--app-color, #2563eb);
  flex: 0 0 auto;
}
.app-icon .pi { width: 23px; height: 23px; }
.app-icon--emoji { font-size: 22px; line-height: 1; }
.app-icon--emoji .emoji { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.app-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; }
.app-icon--sm { width: 34px; height: 34px; border-radius: 10px; }
.app-icon--sm .pi { width: 18px; height: 18px; }
.app-icon--sm.app-icon--emoji { font-size: 17px; }

.app-card__title {
  margin: 2px 0 0;
  font-size: 16.5px;
  font-weight: 650;
  letter-spacing: -.01em;
}
.app-card__desc {
  margin: 0;
  flex: 1 1 auto;
  min-height: 2.9em;
  color: var(--ink-soft);
  font-size: 13.5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.app-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
  color: var(--app-color, var(--accent));
}
.app-card__cta .pi { transition: transform .15s ease; }
a.app-card:hover .app-card__cta .pi { transform: translateX(3px); }
.app-card__cta--muted { color: var(--muted); font-weight: 500; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--line-soft);
  color: var(--ink-soft);
}
.status-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge.is-active { background: #e6f6ef; color: #0f7a52; }
.status-badge.is-soon { background: #eef2f7; color: #4a6280; }
.status-badge.is-maint { background: #fdf1e3; color: #9a5b12; }
.status-badge.is-hidden { background: #f1f2f4; color: #6b7280; }

/* ------------------------------ Uskoro ---------------------------------- */

.soon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(318px, 1fr));
  gap: 10px;
}
.soon-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px dashed #d7e2e0;
  border-radius: 12px;
  background: rgba(255, 255, 255, .65);
  color: var(--ink-soft);
}
.soon-item__text { min-width: 0; }
.soon-item__text strong { display: block; font-size: 14.5px; color: var(--ink); font-weight: 600; }
.soon-item__text small {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.soon-item__tag {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #8b9d9b;
  white-space: nowrap;
}

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

/* ------------------------------ Footer ---------------------------------- */

.footer {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 18px 0;
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  color: var(--ink-soft);
  font-size: 13.5px;
}
.footer__brand { display: flex; align-items: center; gap: 12px; }
.footer__logo { height: 24px; width: auto; display: block; }
.footer__contact { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.footer a { color: var(--ink); text-decoration: none; border-bottom: 1px solid rgba(15, 43, 41, .22); }
.footer a:hover { border-bottom-color: var(--ink); }

/* ------------------------------ Dugmad (koristi i admin) ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: #173f3c; }
.btn--ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { background: var(--line-soft); }
.btn--danger { background: #b42318; color: #fff; }
.btn--danger:hover { background: #971c13; }
.btn--small { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn--block { width: 100%; }

/* ------------------------------ Mobilni --------------------------------- */

@media (max-width: 760px) {
  .topbar__inner {
    flex-wrap: wrap;
    row-gap: 10px;
    padding-top: 10px;
    padding-bottom: 12px;
    min-height: 0;
  }
  .topbar__right { width: 100%; }
  .search { flex: 1 1 auto; min-width: 0; }
  .search input { width: 100%; min-width: 0; }
  .brand__logo { height: 27px; }

  .main { padding: 22px 20px 44px; }
  .hero { align-items: flex-start; }
  .hero__text h1 { font-size: 22px; }
  .grid, .soon-grid { grid-template-columns: 1fr; }
  .app-card { min-height: 0; }
  .footer__inner { flex-direction: column; align-items: flex-start; }
}
