/*
 * IMProject dashboard theme - matches the imtech.hr brand.
 * Loaded after bootstrap.min.css and style.css, so it overrides both.
 */
:root {
  --bg: #0B0F16;
  --surface: #141a24;
  --surface-2: #1c2430;
  --surface-3: #232d3b;
  --text: #E8ECF2;
  --text-dim: #97A1B3;
  --text-faint: #6b7587;
  --accent: #F5A623;
  --accent-hover: #ffb944;
  --accent-ink: #1a1204;
  --accent-2: #4A90D9;
  --danger: #e5604d;
  --ok: #3fb97c;
  --line: #2A3341;
  --radius: 6px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

html { color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

p { font-weight: 400; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); color: var(--text); }
a { color: var(--accent-2); }
a:hover { color: var(--text); }
::selection { background: rgba(245, 166, 35, .35); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 28px;
  height: 60px;
  background: rgba(11, 15, 22, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--text) !important;
  white-space: nowrap;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.5px;
}
.nav-links {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  flex: 1;
  overflow-x: auto;
}
.nav-links a {
  display: block;
  padding: 8px 14px;
  border-radius: var(--radius);
  color: var(--text-dim) !important;
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--text) !important; background: var(--surface-2); }
.nav-links a.active { color: var(--text) !important; background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  border: 0;
  white-space: nowrap;
}
.topbar-user .who { color: var(--text-dim); font-size: 14px; }
.topbar-user .who b { color: var(--text); font-weight: 500; }

/* ---------- Page layout ---------- */
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 28px 64px;
}
.page form { border: 0; margin: 0; }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-head h1 { font-size: 26px; font-weight: 600; margin: 0 0 4px; letter-spacing: -.3px; }
.page-head p { margin: 0; color: var(--text-dim); font-size: 14px; }
.count {
  display: inline-block;
  margin-left: 10px;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  font: 500 13px var(--font-mono);
  vertical-align: middle;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
}
.card-pad { padding: 24px; }
.card h2 { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.card .hint { color: var(--text-dim); font-size: 13px; margin: 0 0 20px; }

/* ---------- Buttons ---------- */
button, .btn-x {
  width: auto;
  margin: 0;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font: 500 14px var(--font-body);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  opacity: 1;
}
button:hover, .btn-x:hover { background: var(--surface-3); border-color: #3a4556; opacity: 1; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary-x { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary-x:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-danger-x { color: var(--danger); }
.btn-danger-x:hover { background: rgba(229, 96, 77, .12); border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; padding: 11px 18px; }

/* ---------- Form fields ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
}
.page input[type=text], .page input[type=password], .page select,
.auth input[type=text], .auth input[type=password] {
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: 400 14px var(--font-body);
  transition: border-color .15s, background .15s;
}
.page input[readonly] { color: var(--text-dim); background: var(--surface-2); cursor: default; }
.page input:focus, .page select:focus, .auth input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 166, 35, .15);
}
.mono, .page input.mono { font-family: var(--font-mono) !important; font-size: 13px !important; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; align-items: start; }

/* ---------- Data tables ---------- */
.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 210px);
  border-radius: 10px;
}
.table-responsive { max-height: none; overflow: visible; }
.data-table {
  width: 100%;
  min-width: 0;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text);
}
.data-table thead { position: sticky; top: 0; z-index: 2; background: none !important; }
.data-table thead th {
  background: var(--surface-2);
  color: var(--text-dim) !important;
  font: 600 12px var(--font-body);
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line) !important;
  white-space: nowrap;
}
.data-table thead tr.group th {
  padding: 8px 14px 0;
  border-bottom: 0 !important;
  color: var(--accent) !important;
  font-size: 11px;
}
.data-table thead tr.group th.span { border-bottom: 1px solid var(--line) !important; padding-bottom: 6px; }
.data-table tbody td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-weight: 400;
  vertical-align: middle;
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: rgba(255, 255, 255, .025); }
.data-table tbody tr.active td, .data-table tbody tr.selected td { background: rgba(245, 166, 35, .07); }
.data-table td.idx { color: var(--text-faint); font: 400 13px var(--font-mono); width: 1%; }
.data-table td.sel { width: 1%; padding-right: 4px; }
.data-table td.dim { color: var(--text-dim); }
.data-table td.empty { text-align: center; color: var(--text-dim); padding: 48px 14px; white-space: normal; }

/* inline-editable cells: quiet until hovered or focused */
.data-table input[type=text], .data-table select {
  background: transparent;
  border-color: transparent;
  padding: 7px 10px;
}
.data-table input[type=text]:hover, .data-table select:hover { border-color: var(--line); background: var(--bg); }
.data-table input[type=text]:focus, .data-table select:focus { background: var(--bg); }
.data-table select { min-width: 140px; }
.data-table input[type=file] { color: var(--text-dim); font-size: 13px; }
.data-table input[type=file]::file-selector-button {
  margin-right: 10px;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font: 500 13px var(--font-body);
  cursor: pointer;
}
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; vertical-align: middle; }

.hash {
  font: 400 13px var(--font-mono);
  color: var(--text-dim);
}
.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  background: rgba(74, 144, 217, .14);
  color: #8dbdf0;
  font: 500 12px var(--font-mono);
}
.badge-x {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 13px;
}

/* ---------- Toggle switch (existing ios-switch markup) ---------- */
.custom-control.ios-switch { padding-left: 0; margin: 0; min-height: 0; cursor: pointer; }
.custom-control.ios-switch .ios-switch-control-indicator {
  margin: 0;
  top: 0;
  width: 38px;
  height: 22px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: background .2s, border-color .2s;
}
.custom-control.ios-switch .ios-switch-control-indicator::after {
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--text-dim);
  box-shadow: none;
  transition: left .2s, background .2s;
}
.custom-control.ios-switch .ios-switch-control-input:checked ~ .ios-switch-control-indicator {
  border: 1px solid var(--accent);
  background: var(--accent);
}
.custom-control.ios-switch .ios-switch-control-input:checked ~ .ios-switch-control-indicator::after {
  top: 2px;
  left: 18px;
  background: var(--accent-ink);
}
.custom-control.ios-switch .ios-switch-control-input:active ~ .ios-switch-control-indicator::after { width: 16px; }

/* ---------- Login / terms ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(245, 166, 35, .10), transparent 70%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 36px 32px 28px;
}
.auth-card .brand { justify-content: center; font-size: 22px; margin-bottom: 6px; }
.auth-card .brand-mark { width: 34px; height: 34px; font-size: 15px; }
.auth-card .sub { text-align: center; color: var(--text-dim); font-size: 14px; margin: 0 0 28px; }
.auth form { border: 0 !important; width: auto !important; }
.auth .remember { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 14px; margin: 4px 0 20px; cursor: pointer; }
.auth .error {
  margin: 0 0 18px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(229, 96, 77, .1);
  border: 1px solid rgba(229, 96, 77, .4);
  color: #f2a397;
  font-size: 14px;
}
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: var(--text-faint);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.google-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100% !important;
  padding: 10px 18px;
  border-radius: var(--radius);
  background: #fff;
  color: #1f1f1f !important;
  font-weight: 500;
  font-size: 14px;
}
.google-btn:hover { background: #f1f3f4; color: #1f1f1f !important; }
.google-btn svg { width: 18px; height: 18px; }

.terms { max-width: 760px; margin: 48px auto; padding: 36px 40px; }
.terms h1 { font-size: 26px; margin-bottom: 20px; }
.terms p, .terms li { color: var(--text-dim); }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  .topbar { gap: 12px; padding: 0 16px; height: auto; min-height: 56px; flex-wrap: wrap; }
  .nav-links { order: 3; flex-basis: 100%; padding-bottom: 8px; }
  .topbar-user { margin-left: auto; }
  .topbar-user .who { display: none; }
  .page { padding: 24px 16px 48px; }
  .grid-2 { grid-template-columns: 1fr; }
  .table-wrap { max-height: none; }
}

/* ---------- Fixes for legacy style.css rules ---------- */
.auth #login { width: 100% !important; margin: 0 !important; }
.topbar nav { flex: 1; min-width: 0; }
.data-table tbody td { font-size: 14px; }
.custom-control.ios-switch { display: inline-flex; align-items: center; vertical-align: middle; }
.custom-control.ios-switch .ios-switch-control-indicator { display: block; }
@media (max-width: 760px) {
  .topbar nav { order: 3; flex-basis: 100%; }
  .topbar .nav-links { padding-bottom: 8px; }
  .card { min-width: 0; max-width: 100%; }
}

/* ---------- Statistics: compact component cells ---------- */
.comp { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.comp-meta { color: var(--text-dim); font-size: 12px; }
.comp-meta .hash { font-size: 12px; }
.no-tag { color: var(--text-faint); font-size: 12px; font-style: italic; }
.copy { cursor: copy; border-bottom: 1px dashed var(--line); }
.copy:hover { color: var(--text); border-bottom-color: var(--accent); }
.copy.copied { color: var(--ok); border-bottom-color: var(--ok); }
.data-table td.hash { font-size: 13px; }
@media (max-width: 1200px) {
  .data-table thead th, .data-table tbody td { padding-left: 10px; padding-right: 10px; }
  .page { padding-left: 20px; padding-right: 20px; }
}
