/* ABRemote — warstwa "kokpit operatora" na bazie palety AppsBusters (app.css).
   Tylko to, czego app.css nie ma: command-bar, sygnał stanu, wskaźnik kroków,
   chipy poziomów logów, taby, edytor JSON. Kolory wyłącznie z --global-palette*. */

body {
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(30,76,83,0.12), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(0,146,68,0.08), transparent 55%),
        #eef2f3;
}

/* ── Command bar ── */
.abr-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    color: #fff;
    background: linear-gradient(110deg, var(--global-palette4) 0%, var(--global-palette5) 70%, var(--global-palette6) 130%);
    box-shadow: 0 4px 18px rgba(2,44,50,0.28);
    border-bottom: 1px solid rgba(193,209,28,0.35);
}

.abr-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    font-size: 1.05rem;
}

.abr-brand .abr-logo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--global-palette1);
    box-shadow: 0 0 0 3px rgba(193,209,28,0.25);
    font-size: 1rem;
}

.abr-brand small {
    display: block;
    font-weight: 500;
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.62);
}

.abr-bar-spacer { flex: 1 1 auto; }

/* ── Sygnał stanu połączenia ── */
.abr-conn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.18);
}

.abr-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #94a3b8;
    box-shadow: 0 0 0 0 rgba(148,163,184,0.6);
}

.abr-conn.is-waiting .abr-dot { background: #f59e0b; animation: abr-pulse 1.3s ease-out infinite; }
.abr-conn.is-waiting { color: #ffe9c2; }
.abr-conn.is-connected .abr-dot { background: var(--global-palette2); animation: abr-pulse-green 2s ease-out infinite; }
.abr-conn.is-connected { color: #dcffe8; }
.abr-conn.is-idle { color: rgba(255,255,255,0.7); }

@keyframes abr-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(245,158,11,0.55); }
    70%  { box-shadow: 0 0 0 10px rgba(245,158,11,0); }
    100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); }
}
@keyframes abr-pulse-green {
    0%   { box-shadow: 0 0 0 0 rgba(193,209,28,0.5); }
    70%  { box-shadow: 0 0 0 12px rgba(193,209,28,0); }
    100% { box-shadow: 0 0 0 0 rgba(193,209,28,0); }
}

/* ── Wskaźnik kroków (Logowanie → Oczekiwanie → Sesja) ── */
.abr-steps {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 1.25rem auto 0;
    max-width: 1100px;
    padding: 0 0.25rem;
}
.abr-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--global-palette6);
    opacity: 0.6;
}
.abr-step .abr-step-no {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.78rem;
    background: #fff;
    border: 2px solid #cbd5e1;
    color: #94a3b8;
}
.abr-step.is-active { opacity: 1; color: var(--global-palette4); }
.abr-step.is-active .abr-step-no { border-color: var(--global-palette1); background: var(--global-palette1); color: #fff; }
.abr-step.is-done { opacity: 1; color: var(--global-palette1); }
.abr-step.is-done .abr-step-no { border-color: var(--global-palette1); background: rgba(0,146,68,0.12); color: var(--global-palette1); }
.abr-step-line { flex: 1 1 auto; height: 2px; background: #d7dee0; border-radius: 2px; min-width: 18px; }
.abr-step-line.is-done { background: var(--global-palette1); }

/* ── Layout roboczy ── */
.abr-stage { max-width: 1100px; margin: 1.25rem auto 3rem; padding: 0 1rem; }
.abr-stage-narrow { max-width: 480px; }
.abr-stage-wide { max-width: 1700px; }

.abr-waiting-visual {
    display: grid;
    place-items: center;
    padding: 1.5rem 0 0.5rem;
}
.abr-radar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,146,68,0.12), transparent 70%);
    border: 2px solid rgba(0,146,68,0.25);
    position: relative;
    animation: abr-breathe 2.4s ease-in-out infinite;
}
.abr-radar::after {
    content: "";
    position: absolute;
    inset: 18px;
    border-radius: 50%;
    border: 2px dashed rgba(30,76,83,0.35);
    animation: abr-spin 4s linear infinite;
}
@keyframes abr-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes abr-spin { to { transform: rotate(360deg); } }

/* ── Wizytówka instalacji ── */
.abr-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; }
.abr-fact {
    background: #f8fafa;
    border: 1px solid #e3e9ea;
    border-radius: 12px;
    padding: 0.7rem 0.85rem;
}
.abr-fact .k { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--global-palette6); }
.abr-fact .v { font-size: 1.05rem; font-weight: 700; color: var(--global-palette3); margin-top: 0.15rem; word-break: break-word; }
.abr-fact.is-alert { background: rgba(220,53,69,0.06); border-color: rgba(220,53,69,0.25); }
.abr-fact.is-alert .v { color: #b91c1c; }

/* ── Taby ── */
.abr-tabs { display: flex; gap: 0.35rem; border-bottom: 2px solid #e3e9ea; margin-bottom: 1.1rem; }
.abr-tab {
    appearance: none;
    border: none;
    background: transparent;
    padding: 0.6rem 1.1rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--global-palette6);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.abr-tab:hover { color: var(--global-palette4); }
.abr-tab.is-active { color: var(--global-palette1); border-bottom-color: var(--global-palette1); }
.abr-tab .abr-tab-badge {
    margin-left: 0.4rem;
    background: rgba(0,146,68,0.12);
    color: var(--global-palette1);
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
    font-size: 0.72rem;
}

/* ── Edytor ustawień (JSON) ── */
.abr-json {
    width: 100%;
    min-height: 420px;
    font-family: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    tab-size: 2;
    color: #0f172a;
    background: #fbfdfd;
    border: 1px solid #d7dee0;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    resize: vertical;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}
.abr-json:focus { outline: none; border-color: var(--global-palette1); box-shadow: 0 0 0 3px rgba(0,146,68,0.12); }

/* ── Logi ── */
.abr-log-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; margin-bottom: 0.9rem; }
.abr-log-toolbar .form-control, .abr-log-toolbar .form-select { min-width: 140px; }

.abr-logs { display: flex; flex-direction: column; gap: 0; border: 1px solid #e3e9ea; border-radius: 12px; overflow: hidden; }
.abr-log {
    display: grid;
    grid-template-columns: 150px 92px 1fr;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid #eef2f3;
    font-size: 0.83rem;
    align-items: start;
}
.abr-log:last-child { border-bottom: none; }
.abr-log:hover { background: rgba(0,146,68,0.04); }
.abr-log-time { color: var(--global-palette6); font-variant-numeric: tabular-nums; white-space: nowrap; }
.abr-log-msg { color: #1f2937; word-break: break-word; }
.abr-log-msg .abr-log-src { display: block; font-size: 0.7rem; color: #94a3b8; }
.abr-log-exc { margin-top: 0.3rem; font-size: 0.76rem; color: #b91c1c; white-space: pre-wrap; word-break: break-word; }

.abr-lvl {
    display: inline-block;
    text-align: center;
    width: 100%;
    padding: 0.1rem 0.3rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.abr-lvl-information { background: rgba(74,106,110,0.12); color: var(--global-palette5); }
.abr-lvl-warning { background: rgba(245,158,11,0.15); color: #b45309; }
.abr-lvl-error, .abr-lvl-fatal { background: rgba(220,53,69,0.13); color: #b91c1c; }
.abr-lvl-debug, .abr-lvl-verbose { background: #eef2f3; color: #94a3b8; }

.abr-pager { display: flex; align-items: center; justify-content: center; gap: 0.85rem; margin-top: 0.9rem; color: var(--global-palette6); font-size: 0.85rem; }

.abr-empty { text-align: center; padding: 2.5rem 1rem; color: var(--global-palette6); }
.abr-empty .abr-empty-ico { font-size: 2rem; opacity: 0.5; }

/* ── Konfigurator GT: lewe menu sekcji (SectionOutlet) + treść ── */
.abr-cfg-shell { display: flex; gap: 1rem; align-items: flex-start; }
.abr-cfg-sidebar {
    position: sticky;
    top: 70px;
    flex: 0 0 220px;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    background: linear-gradient(160deg, var(--global-palette4), var(--global-palette5));
    border-radius: 14px;
    padding: 1rem 0.75rem;
    box-shadow: 0 6px 20px rgba(2,44,50,0.18);
}
.abr-cfg-sidebar h6 { color: rgba(255,255,255,0.6); }
.abr-cfg-sidebar .nav-item { margin-bottom: 0.1rem; }
.abr-cfg-sidebar .nav-link {
    color: #fff;
    cursor: pointer;
    border-radius: 8px;
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    transition: background 0.15s;
}
.abr-cfg-sidebar .nav-link:hover { background: rgba(255,255,255,0.12); }
.abr-cfg-main { flex: 1 1 auto; min-width: 0; }

@media (max-width: 900px) {
    .abr-cfg-shell { flex-direction: column; }
    .abr-cfg-sidebar { position: static; flex: none; width: 100%; max-height: none; }
}

@media (max-width: 640px) {
    .abr-bar { flex-wrap: wrap; gap: 0.6rem; }
    .abr-log { grid-template-columns: 1fr; gap: 0.2rem; }
    .abr-lvl { width: auto; }
    .abr-steps .abr-step span:not(.abr-step-no) { display: none; }
}
