/* Stacja Workspaces - jeden arkusz dla calego panelu. Bez frameworkow. */

:root {
  --bg: #0a0e14;
  --surface: #121a24;
  --surface-2: #18222e;
  --surface-3: #1f2b39;
  --border: #24313f;
  --border-soft: #1b2530;
  --text: #e7eef6;
  --muted: #8b9aad;
  --faint: #5d6b7d;
  --accent: #37d99a;
  --accent-dim: #1f7a58;
  --blue: #6ea8fe;
  --violet: #a78bfa;
  --danger: #ff6b6b;
  --warn: #ffb454;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 12px 32px rgba(0, 0, 0, .45);
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- ukladki ---------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #101823, #0c1219);
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 650;
  letter-spacing: -.01em;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 12px; height: 12px; border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  box-shadow: 0 0 14px rgba(55, 217, 154, .5);
}
.brand small { color: var(--faint); font-weight: 400; font-size: .78rem; }

.nav { display: flex; gap: .25rem; margin-left: 1rem; flex: 1; }
.nav a {
  color: var(--muted);
  padding: .4rem .7rem;
  border-radius: var(--radius-sm);
  font-size: .92rem;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--surface-3); color: var(--text); }

.container { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.container.wide { max-width: 1500px; }

.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

h1 { font-size: 1.45rem; margin: 0 0 .3rem; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; margin: 2rem 0 .8rem; letter-spacing: -.01em; }
h3 { font-size: .95rem; margin: 0 0 .5rem; }
.lead { color: var(--muted); margin: 0 0 1.5rem; }

/* ---------------- karty ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
}
.card + .card { margin-top: .85rem; }

.grid { display: grid; gap: .85rem; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
.grid.tiles { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* ---------------- kafel srodowiska ---------------- */

.ws-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  transition: border-color .15s, transform .15s;
}
.ws-card:hover { border-color: #33475d; transform: translateY(-1px); }
.ws-head { display: flex; align-items: flex-start; gap: .7rem; }
.ws-icon {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--surface-3);
  font-size: 1.1rem;
}
.ws-title { font-weight: 600; line-height: 1.3; }
.ws-sub { color: var(--faint); font-size: .82rem; }

.meter { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--blue)); }
.meter.warn > span { background: linear-gradient(90deg, var(--warn), var(--danger)); }

.metrics { display: flex; gap: 1.1rem; font-size: .8rem; color: var(--muted); }
.metrics b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------- odznaki ---------------- */

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .18rem .55rem;
  border-radius: 99px;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .01em;
  background: var(--surface-3);
  color: var(--muted);
  border: 1px solid var(--border);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.badge.running { color: var(--accent); border-color: rgba(55, 217, 154, .3); background: rgba(55, 217, 154, .1); }
.badge.starting { color: var(--warn); border-color: rgba(255, 180, 84, .3); background: rgba(255, 180, 84, .1); }
.badge.starting::before { animation: pulse 1s infinite; }
.badge.stopped { color: var(--faint); }
.badge.error { color: var(--danger); border-color: rgba(255, 107, 107, .3); background: rgba(255, 107, 107, .1); }
.badge.plain::before { display: none; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------------- przyciski ---------------- */

.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .48rem .85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: .88rem;
  cursor: pointer;
  transition: background .12s, border-color .12s, opacity .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: #33475d; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, #2fbf88, #23996c);
  border-color: #2fbf88;
  color: #04120c;
  font-weight: 620;
}
.btn.primary:hover { background: linear-gradient(180deg, #37d99a, #2aa878); }
.btn.danger { color: var(--danger); border-color: rgba(255, 107, 107, .35); }
.btn.danger:hover { background: rgba(255, 107, 107, .12); }
.btn.ghost { background: transparent; }
.btn.small { padding: .3rem .6rem; font-size: .8rem; }
.btn.icon { padding: .4rem .5rem; }

/* ---------------- formularze ---------------- */

label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .3rem; }

input, select, textarea {
  width: 100%;
  padding: .55rem .7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: .92rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(55, 217, 154, .12);
}
textarea { font-family: var(--mono); font-size: .84rem; resize: vertical; }
.field { margin-bottom: .85rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }

.hint { font-size: .78rem; color: var(--faint); margin-top: .3rem; }

/* ---------------- tabele ---------------- */

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th {
  text-align: left; font-weight: 600; color: var(--muted);
  font-size: .76rem; text-transform: uppercase; letter-spacing: .04em;
  padding: .5rem .6rem; border-bottom: 1px solid var(--border);
}
td { padding: .55rem .6rem; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tr:hover td { background: rgba(255, 255, 255, .015); }
.mono { font-family: var(--mono); font-size: .82rem; }
.nowrap { white-space: nowrap; }

/* ---------------- komunikaty ---------------- */

.alert {
  padding: .7rem .9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: .88rem;
  margin-bottom: 1rem;
}
.alert.error { border-color: rgba(255, 107, 107, .35); background: rgba(255, 107, 107, .08); color: #ffb3b3; }
.alert.ok { border-color: rgba(55, 217, 154, .35); background: rgba(55, 217, 154, .08); color: #a6f0d1; }
.alert.warn { border-color: rgba(255, 180, 84, .35); background: rgba(255, 180, 84, .08); color: #ffd9a6; }

#toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 100; display: grid; gap: .5rem; }
.toast {
  padding: .65rem .9rem;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: .88rem;
  max-width: 24rem;
  animation: slide .2s ease-out;
}
.toast.error { border-color: rgba(255, 107, 107, .5); }
.toast.ok { border-color: rgba(55, 217, 154, .5); }
@keyframes slide { from { transform: translateX(16px); opacity: 0; } }

.empty { text-align: center; padding: 3rem 1rem; color: var(--faint); }
.empty .big { font-size: 2rem; margin-bottom: .5rem; }

/* ---------------- logowanie ---------------- */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-box {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2rem;
  box-shadow: var(--shadow);
}
.auth-box h1 { font-size: 1.3rem; }
.auth-box .brand { margin-bottom: 1.4rem; font-size: 1.05rem; }

/* ---------------- workspace: zakladki i terminal ---------------- */

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tab {
  padding: .55rem .95rem;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: .9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.pane { display: none; }
.pane.active { display: block; }

#terminal-host {
  background: #05080c;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem;
  height: min(66vh, 620px);
}

.app-frame {
  width: 100%;
  height: min(74vh, 780px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #05080c;
}

/* ---------------- menedzer plikow ---------------- */

.crumbs { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; font-size: .85rem; margin-bottom: .7rem; }
.crumbs button { background: none; border: none; color: var(--blue); font: inherit; cursor: pointer; padding: .1rem .2rem; }
.crumbs span { color: var(--faint); }

.file-row { display: grid; grid-template-columns: 1.6rem 1fr auto auto auto; gap: .6rem; align-items: center;
            padding: .45rem .6rem; border-bottom: 1px solid var(--border-soft); font-size: .88rem; }
.file-row:hover { background: rgba(255, 255, 255, .02); }
.file-row .name { cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .name:hover { color: var(--blue); }
.file-row .size { color: var(--faint); font-size: .8rem; font-variant-numeric: tabular-nums; }
.file-row .date { color: var(--faint); font-size: .78rem; }

.dropzone { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: .8rem; text-align: center;
            color: var(--faint); font-size: .85rem; margin-bottom: .8rem; }
.dropzone.hot { border-color: var(--accent); color: var(--accent); background: rgba(55, 217, 154, .06); }

/* ---------------- okno modalne ---------------- */

.modal-bg {
  position: fixed; inset: 0; background: rgba(4, 7, 11, .72);
  display: grid; place-items: center; z-index: 90; padding: 1.5rem;
  backdrop-filter: blur(3px);
}
.modal {
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: var(--shadow);
  max-height: 88vh;
  overflow: auto;
}
.modal h3 { font-size: 1.1rem; margin-bottom: .9rem; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; font-size: .86rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: .82rem; word-break: break-all; }

.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem .9rem; }
.stat .label { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.3rem; font-weight: 640; font-variant-numeric: tabular-nums; margin-top: .15rem; }
.stat .value small { font-size: .8rem; color: var(--faint); font-weight: 400; }

@media (max-width: 720px) {
  .nav { display: none; }
  .field-row { grid-template-columns: 1fr; }
  .file-row { grid-template-columns: 1.4rem 1fr auto; }
  .file-row .date { display: none; }
}
