/*
 * G-Dev-Help: izgled desktop aplikacije G-Sessions (src/renderer/control.css,
 * activation.html). Neutralno grafitno staklo kao macOS, Apple boje za tekst
 * i oznake; GAiA zelena samo kao svetlo: ivica i sjaj na hover/izboru i
 * glavno dugme. Bez zelenih površina. Samo tamna tema.
 */

@font-face { font-family: 'Inter'; font-weight: 300 800; font-display: swap; src: url(/fonts/inter-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2190-2193; }
@font-face { font-family: 'Inter'; font-weight: 300 800; font-display: swap; src: url(/fonts/inter-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+1E00-1EFF; }

:root {
  --g: 24, 180, 81;              /* GAiA zelena #18b451 */
  --green: #2bd06b;              /* podignuta za tamno staklo */
  --red: #ff6961;
  --orange: #ffb340;
  --blue: #64a8ff;

  /* Apple boje teksta na tamnom staklu */
  --label: rgba(255, 255, 255, 0.96);
  --label-2: rgba(235, 235, 245, 0.68);
  --label-3: rgba(235, 235, 245, 0.42);
  --fill: rgba(255, 255, 255, 0.06);
  --fill-hover: rgba(255, 255, 255, 0.09);
  --fill-strong: rgba(255, 255, 255, 0.12);
  --hairline: rgba(255, 255, 255, 0.09);
  --panel: rgba(26, 27, 30, 0.92);
  --bg: #141517;
  --well: rgba(0, 0, 0, 0.28);

  --r-group: 10px;
  --r-ctl: 8px;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--label);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'SF Pro Text', Inter, system-ui, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  background: radial-gradient(70% 50% at 50% 115%, rgba(var(--g), 0.14), transparent 70%), var(--bg);
  background-attachment: fixed;
}
/* Daleko iza: par zvezdica, kao u G-Sessions panelu. */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1px 1px at 14% 22%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1px 1px at 81% 12%, rgba(255, 255, 255, 0.25), transparent),
    radial-gradient(1px 1px at 63% 44%, rgba(255, 255, 255, 0.18), transparent),
    radial-gradient(1px 1px at 27% 68%, rgba(255, 255, 255, 0.2), transparent),
    radial-gradient(1px 1px at 90% 76%, rgba(255, 255, 255, 0.16), transparent);
}
body > * { position: relative; z-index: 1; }

a { color: var(--label); text-decoration: none; }
a:hover { color: #fff; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.015em; margin: 4px 0 6px; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--label-2); }
.dim { color: var(--label-3); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.lead { color: var(--label-2); margin: 0 0 18px; max-width: 760px; }
.grow { flex: 1; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid rgba(var(--g), 0.6); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(var(--g), 0.35); }

svg.ico {
  flex: none; width: 16px; height: 16px;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

/* ------------------------------------------------------------ znak */
.mark {
  flex: none; width: 26px; height: 26px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.05) url(/gaia-mark-white.png) center / 62% no-repeat;
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.14);
}
.mark.big {
  width: 64px; height: 64px; border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(var(--g), 0.5), 0 0 34px -8px rgba(var(--g), 0.7);
}

/* ------------------------------------------------------------ dugmad */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 32px; padding: 0 13px;
  font: 600 13px/1 -apple-system, BlinkMacSystemFont, Inter, sans-serif;
  color: var(--label); white-space: nowrap;
  background: var(--fill);
  border: 0; border-radius: var(--r-ctl);
  box-shadow: inset 0 0 0 0.5px var(--hairline);
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.2s, color 0.15s;
}
.btn:hover { background: var(--fill-hover); color: var(--label); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
/* Glavno dugme: zelena kao svetlo (ivica + sjaj), ne kao boja. */
.btn.primary { background: rgba(var(--g), 0.12); box-shadow: inset 0 0 0 1px rgba(var(--g), 0.6); }
.btn.primary:hover { background: rgba(var(--g), 0.2); box-shadow: inset 0 0 0 1px rgba(var(--g), 0.9), 0 0 16px -4px rgba(var(--g), 0.6); }
.btn.quiet { background: transparent; box-shadow: none; color: var(--label-2); }
.btn.quiet:hover { background: var(--fill); color: var(--label); }
.btn.danger { color: var(--red); background: transparent; box-shadow: inset 0 0 0 0.5px rgba(255, 105, 97, 0.4); }
.btn.danger:hover { background: rgba(255, 105, 97, 0.1); }
.btn.small { height: 26px; padding: 0 9px; font-size: 12px; }
.btn.wide { width: 100%; height: 38px; font-size: 13.5px; border-radius: 11px; }

/* ------------------------------------------------------------ polja */
.field {
  height: 34px; padding: 0 11px;
  font: inherit; font-size: 13.5px; color: var(--label);
  background: var(--well);
  border: 0; border-radius: var(--r-ctl);
  box-shadow: inset 0 0 0 0.5px var(--hairline);
  transition: box-shadow 0.15s;
}
.field::placeholder, textarea::placeholder { color: var(--label-3); }
.field:hover { box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.18); }
.field:focus { outline: none; box-shadow: inset 0 0 0 1px rgba(var(--g), 0.7), 0 0 0 3px rgba(var(--g), 0.12); }
.field.small { height: 26px; font-size: 12px; padding: 0 8px; width: 140px; }
select.field { padding-right: 8px; }
input[type='date'].field { color-scheme: dark; }

/* ------------------------------------------------------------ oznake */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px;
  font-size: 11.5px; font-weight: 500; color: var(--label-2); white-space: nowrap;
  background: var(--fill); border-radius: 999px;
  box-shadow: inset 0 0 0 0.5px var(--hairline);
}
.badge i { width: 6px; height: 6px; border-radius: 50%; background: var(--label-3); }
.badge.ok i { background: var(--green); box-shadow: 0 0 6px rgba(var(--g), 0.8); }
.badge.info i { background: var(--blue); }
.badge.wait i { background: var(--orange); }
.badge.bad i { background: var(--red); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-block; padding: 1px 7px;
  font: 500 11.5px/1.6 var(--mono); color: var(--label-2);
  background: var(--fill); border-radius: 6px;
  box-shadow: inset 0 0 0 0.5px var(--hairline);
}
a.chip:hover { color: var(--label); text-decoration: none; box-shadow: inset 0 0 0 0.5px rgba(var(--g), 0.6); }

.flash, .note {
  padding: 9px 13px; margin-bottom: 14px; border-radius: var(--r-group);
  font-size: 13px; color: var(--label);
  background: var(--fill); box-shadow: inset 0 0 0 0.5px rgba(var(--g), 0.45);
}
.flash.bad, .note.bad { box-shadow: inset 0 0 0 0.5px rgba(255, 105, 97, 0.55); color: #ffb4ae; }

/* ------------------------------------------------------------ gornja traka */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  height: 52px; padding: 0 16px;
  background: rgba(22, 23, 26, 0.78);
  -webkit-backdrop-filter: blur(30px) saturate(1.6); backdrop-filter: blur(30px) saturate(1.6);
  box-shadow: inset 0 -0.5px 0 var(--hairline);
}
.top form { margin: 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; font-size: 14.5px; letter-spacing: -0.01em; }
.tag { font-size: 11px; font-weight: 600; color: var(--label-2); padding: 2px 7px; border-radius: 6px; background: var(--fill); box-shadow: inset 0 0 0 0.5px var(--hairline); }
.who { display: inline-flex; align-items: center; gap: 7px; color: var(--label-2); font-size: 13px; }

/* Segmentirana kontrola (G-Sessions .segmented) */
.segmented {
  display: inline-grid; grid-auto-flow: column; gap: 2px; padding: 2px; margin-left: 10px;
  background: var(--fill); border-radius: 8px; box-shadow: inset 0 0 0 0.5px var(--hairline);
}
.seg { display: flex; align-items: center; height: 26px; padding: 0 12px; font-size: 12.5px; font-weight: 500; color: var(--label-2); border-radius: 6px; transition: background-color 0.15s, color 0.15s; }
.seg:hover { color: var(--label); }
.seg[aria-selected='true'] { color: var(--label); background: var(--fill-strong); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), inset 0 0 0 0.5px rgba(255, 255, 255, 0.1); }

/* ------------------------------------------------------------ prijava */
main.center { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.signin {
  width: min(360px, 100%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 36px 30px 26px; text-align: center;
  background: var(--panel); border-radius: 18px;
  box-shadow: inset 0 0 0 0.5px var(--hairline), 0 30px 80px -30px rgba(0, 0, 0, 0.8);
  -webkit-backdrop-filter: blur(40px); backdrop-filter: blur(40px);
  animation: rise 0.45s cubic-bezier(0.25, 0.8, 0.25, 1) both;
}
.signin .mark.big { margin-bottom: 6px; }
.signin h1 { font-size: 21px; margin: 0; }
.signin p { font-size: 13px; color: var(--label-2); margin: 0 0 6px; max-width: 280px; }
.signin .note { width: 100%; margin: 0; }
.fields { width: 100%; display: grid; background: var(--well); border-radius: 11px; box-shadow: inset 0 0 0 0.5px var(--hairline); margin: 6px 0 4px; }
.fields .field { height: 40px; background: transparent; box-shadow: none; border-radius: 0; padding: 0 13px; }
.fields .field + .field { box-shadow: inset 0 0.5px 0 var(--hairline); }
.fields .field:focus, .fields .field + .field:focus { box-shadow: inset 0 0 0 1px rgba(var(--g), 0.7); border-radius: 11px; }
.signin .foot { font-size: 11.5px; color: var(--label-3); margin-top: 6px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ chat */
main.chat-page { display: grid; grid-template-columns: 272px minmax(0, 1fr); height: calc(100vh - 52px); }
.side {
  display: flex; flex-direction: column; gap: 6px; min-height: 0;
  padding: 14px 10px; background: rgba(20, 21, 24, 0.6);
  box-shadow: inset -0.5px 0 0 var(--hairline);
}
.side form { margin: 0 2px 6px; }
.btn.new { width: 100%; height: 34px; justify-content: flex-start; padding: 0 12px; }
.btn.new:hover { box-shadow: inset 0 0 0 1px rgba(var(--g), 0.55), 0 0 14px -6px rgba(var(--g), 0.6); }
.side-label { padding: 4px 10px 2px; font-size: 11px; font-weight: 600; color: var(--label-3); }
.convs { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; gap: 1px; align-content: start; }
.convs a { display: flex; align-items: flex-start; gap: 9px; padding: 8px 10px; border-radius: 8px; color: var(--label-2); }
.convs a svg.ico { margin-top: 2px; width: 15px; height: 15px; color: var(--label-3); }
.convs .t { display: grid; min-width: 0; }
.convs b { font-weight: 500; font-size: 13px; color: var(--label); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convs em { font-style: normal; font-size: 11.5px; color: var(--label-3); }
.convs a:hover { background: var(--fill); }
.convs a[aria-current='page'] { background: var(--fill-strong); box-shadow: inset 0 0 0 0.5px rgba(var(--g), 0.5), 0 4px 14px -10px rgba(var(--g), 0.8); }
.convs a[aria-current='page'] svg.ico { color: var(--green); }

.chat { display: flex; flex-direction: column; min-height: 0; }
.thread { flex: 1; overflow-y: auto; padding: 26px 24px 10px; }
.thread-inner { max-width: 780px; margin: 0 auto; display: grid; gap: 22px; }
.msg { display: grid; gap: 14px; animation: rise 0.3s ease both; }
.msg .q { display: flex; justify-content: flex-end; }
.bubble {
  max-width: min(78%, 620px); padding: 9px 14px;
  white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--fill-strong); border-radius: 18px 18px 6px 18px;
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.08);
}
.msg .a { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; }
.avatar { width: 26px; height: 26px; border-radius: 8px; background: rgba(255, 255, 255, 0.05) url(/gaia-mark-white.png) center / 60% no-repeat; box-shadow: inset 0 0 0 0.5px rgba(var(--g), 0.5); margin-top: 1px; }
.a-body { min-width: 0; }
.msg .a.bad .answer { color: #ffb4ae; }
.msg .a.wait .answer { color: var(--label-2); padding-top: 3px; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 10px; }

/* Markdown odgovora */
.answer { font-size: 14.5px; line-height: 1.62; color: var(--label); overflow-wrap: anywhere; }
.answer > :first-child { margin-top: 2px; }
.answer p { margin: 0 0 10px; }
.answer p.h { font-weight: 650; margin-top: 14px; }
.answer strong { font-weight: 650; color: #fff; }
.answer em { color: var(--label-2); }
.answer ol, .answer ul { margin: 0 0 12px; padding-left: 24px; }
.answer li { margin: 4px 0; padding-left: 2px; }
.answer li::marker { color: var(--label-3); }
.answer ol li::marker { font-variant-numeric: tabular-nums; }
.answer a { color: var(--blue); }
.answer a:hover { text-decoration: underline; }
.answer blockquote { margin: 8px 0 12px; padding: 2px 0 2px 12px; color: var(--label-2); box-shadow: inset 2px 0 0 var(--fill-strong); }
.answer code, .lead code, .empty code { font: 12.5px/1.4 var(--mono); padding: 1px 5px; border-radius: 5px; background: var(--fill-strong); }
.answer pre {
  margin: 4px 0 14px; padding: 12px 14px; overflow-x: auto;
  background: rgba(0, 0, 0, 0.38); border-radius: var(--r-group);
  box-shadow: inset 0 0 0 0.5px var(--hairline);
}
.answer pre code { padding: 0; background: none; font-size: 12.5px; line-height: 1.55; white-space: pre; color: #e8e8ed; }

.dots::after { content: '…'; display: inline-block; animation: dots 1.2s steps(3) infinite; width: 1em; text-align: left; }
@keyframes dots { 0% { content: '.'; } 33% { content: '..'; } 66% { content: '...'; } }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 9vh 0 20px; }
.empty .mark.big { margin-bottom: 8px; }
.empty h2 { font-size: 19px; font-weight: 700; margin: 0; }
.empty p { color: var(--label-2); margin: 0; }
.examples { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px 0 10px; }
.example {
  height: 32px; padding: 0 13px; font: 500 13px/1 -apple-system, BlinkMacSystemFont, Inter, sans-serif; color: var(--label-2);
  background: var(--fill); border: 0; border-radius: 999px; box-shadow: inset 0 0 0 0.5px var(--hairline); cursor: pointer;
  transition: color 0.15s, box-shadow 0.2s, background-color 0.15s;
}
.example:hover { color: var(--label); background: var(--fill-hover); box-shadow: inset 0 0 0 0.5px rgba(var(--g), 0.6), 0 0 14px -6px rgba(var(--g), 0.6); }

/* Polje za unos dole */
.composer {
  width: min(780px, calc(100% - 48px)); margin: 6px auto 18px;
  padding: 10px 10px 8px 16px;
  background: var(--panel); border-radius: 16px;
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.12), 0 18px 50px -24px rgba(0, 0, 0, 0.9);
  -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px);
  transition: box-shadow 0.2s;
}
.composer:focus-within { box-shadow: inset 0 0 0 1px rgba(var(--g), 0.55), 0 0 22px -10px rgba(var(--g), 0.7), 0 18px 50px -24px rgba(0, 0, 0, 0.9); }
.composer textarea {
  display: block; width: 100%; min-height: 24px; max-height: 220px; padding: 4px 0; resize: none;
  font: inherit; font-size: 14.5px; line-height: 1.5; color: var(--label);
  background: transparent; border: 0; outline: none;
}
.composer textarea:focus-visible { outline: none; }
.composer-bar { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.composer-bar .hint { flex: 1; font-size: 11.5px; color: var(--label-3); }
.composer-bar .count { font-size: 11.5px; color: var(--label-3); font-variant-numeric: tabular-nums; }
.send {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  color: var(--label); background: rgba(var(--g), 0.14); border: 0; border-radius: 50%; cursor: pointer;
  box-shadow: inset 0 0 0 1.5px var(--green), 0 0 0 3px rgba(var(--g), 0.08);
  transition: box-shadow 0.2s, opacity 0.15s;
}
.send:hover { box-shadow: inset 0 0 0 1.5px var(--green), 0 0 0 5px rgba(var(--g), 0.14), 0 0 20px -4px rgba(var(--g), 0.6); }
.send:disabled { opacity: 0.4; cursor: default; box-shadow: inset 0 0 0 1.5px var(--label-3); background: transparent; }
.send svg.ico { width: 16px; height: 16px; stroke-width: 2.1; }

/* ------------------------------------------------------------ admin */
main:not(.center):not(.chat-page) { max-width: 1180px; margin: 0 auto; padding: 26px 24px 70px; }
.group { background: var(--fill); border-radius: var(--r-group); box-shadow: inset 0 0 0 0.5px var(--hairline); margin-bottom: 18px; }
h2.section { font-size: 12px; font-weight: 600; color: var(--label-3); margin: 26px 4px 8px; letter-spacing: 0.01em; }
.section-row { display: flex; align-items: center; gap: 10px; margin: 22px 4px 8px; }
.section-row h2.section { margin: 0; }
.title-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.title-row h1 { flex: 1; }
.back { display: inline-block; color: var(--label-2); font-size: 13px; margin-bottom: 4px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 4px; }
.stat { padding: 14px 16px; background: var(--fill); border-radius: var(--r-group); box-shadow: inset 0 0 0 0.5px var(--hairline); }
.stat b { display: block; font-size: 22px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat b small { font-size: 14px; color: var(--label-2); font-weight: 500; }
.stat span { font-size: 12px; color: var(--label-2); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11.5px; font-weight: 500; color: var(--label-3); padding: 10px 12px 8px; white-space: nowrap; }
td { padding: 10px 12px; vertical-align: top; box-shadow: inset 0 0.5px 0 var(--hairline); }
tbody tr { transition: background-color 0.12s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
tr.off td { color: var(--label-3); }
td a { color: var(--label); }
td a:hover { color: #fff; text-decoration: underline; text-decoration-color: rgba(var(--g), 0.7); text-underline-offset: 3px; }
.q-cell { min-width: 280px; }
.q-cell .small { margin-top: 3px; }
th.right, td.right { text-align: right; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
form.inline + form.inline { margin-left: 4px; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 14px; margin-top: 22px; }
.filters label { display: grid; gap: 5px; font-size: 11.5px; color: var(--label-3); font-weight: 500; }
.filters .field { height: 32px; font-size: 13px; }
.filter-actions { display: flex; gap: 6px; margin-left: auto; }

.form-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; }
.form-row .field { flex: 1 1 180px; }

.list .item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 14px; color: var(--label); position: relative; }
.list .item svg.ico { color: var(--label-3); }
.list .item .mono { flex: 1; }
.list .item + .item::before { content: ''; position: absolute; top: 0; left: 40px; right: 0; height: 0.5px; background: var(--hairline); }
.list .item:hover { background: rgba(255, 255, 255, 0.03); }
.list .item:hover svg.ico { color: var(--green); }
.empty-box { padding: 18px; }
.empty-box p { margin: 0; }

.admin-thread { margin-top: 18px; gap: 14px; }
.analysis { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 10px 38px; padding: 10px 12px; background: var(--fill); border-radius: var(--r-group); box-shadow: inset 0 0 0 0.5px var(--hairline); }
.analysis p { flex-basis: 100%; margin: 4px 0 0; font-size: 13px; color: var(--label-2); }

/* ------------------------------------------------------------ uži ekrani */
@media (max-width: 860px) {
  main.chat-page { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .side { padding: 10px; box-shadow: inset 0 -0.5px 0 var(--hairline); }
  .convs { max-height: 132px; }
  .composer { width: calc(100% - 24px); margin-bottom: 12px; }
  .thread { padding: 18px 14px 8px; }
  .bubble { max-width: 92%; }
  .composer-bar .hint { visibility: hidden; }
  .who, .top .btn span { display: none; }
  .segmented { margin-left: 0; }
  .seg { padding: 0 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
