/*
    Štýly portálu. Zámerne strohé: farby sa berú z návrhových tokenov FluentUI (--neutral-*,
    --accent-*), aby sa vzhľad nerozišiel s komponentmi. Vlastná farba sa používa LEN na stavy
    a závažnosti (SPEC §9) — triedy tp-badge--*, tp-semaphore--* a tp-seg__button.

    Poradie sekcií: rozloženie → karty a oznamy → formuláre → tabuľky → odznaky → semafor →
    exekúcia behu → modálne okno → drobnosti.
*/

:root {
    /* Stavové farby (SPEC §9). Nikde inde sa farba nepoužíva — text a rámy sú neutrálne. */
    --tp-ok: #0e700e;
    --tp-ok-bg: rgba(14, 112, 14, 0.10);
    --tp-fail: #c50f1f;
    --tp-fail-bg: rgba(197, 15, 31, 0.10);
    --tp-blocked: #bc4b09;
    --tp-blocked-bg: rgba(188, 75, 9, 0.10);
    --tp-warn: #8a6100;
    --tp-warn-bg: rgba(240, 180, 0, 0.16);
    --tp-info: #0f6cbd;
    --tp-info-bg: rgba(15, 108, 189, 0.10);
    --tp-muted: #57606a;
    --tp-muted-bg: rgba(87, 96, 106, 0.10);
    --tp-line: var(--neutral-stroke-divider-rest, #e0e0e0);
}

html, body {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
    background-color: var(--neutral-layer-1, #fbfbfb);
    color: var(--neutral-foreground-rest, #1a1a1a);
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 1rem;
}

h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 1.5rem 0 0.5rem;
}

a {
    color: var(--accent-foreground-rest, #0f6cbd);
}

code {
    font-family: "Cascadia Mono", Consolas, monospace;
    background-color: var(--neutral-layer-3, #f0f0f0);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

/* --- rozloženie --------------------------------------------------------- */

.tp-main {
    align-items: stretch;
    min-height: calc(100vh - 100px);
}

.tp-nav {
    border-inline-end: 1px solid var(--neutral-stroke-divider-rest, #e0e0e0);
    padding-block: 0.5rem;
}

.tp-content {
    padding: 1.25rem 1.5rem;
    max-width: 1200px;
}

.tp-footer span {
    font-size: 0.8rem;
    opacity: 0.75;
}

/* --- karty a oznamy ------------------------------------------------------ */

.tp-card {
    padding: 1.25rem;
    max-width: 900px;
}

.tp-card p {
    margin: 0 0 0.75rem;
    line-height: 1.5;
}

.tp-card p:last-child {
    margin-bottom: 0;
}

.tp-notice,
.tp-error,
.tp-success {
    border-inline-start: 4px solid;
    padding: 0.6rem 0.8rem;
    border-radius: 3px;
    line-height: 1.45;
}

.tp-notice {
    border-color: #0f6cbd;
    background-color: rgba(15, 108, 189, 0.08);
}

.tp-error {
    border-color: #c50f1f;
    background-color: rgba(197, 15, 31, 0.08);
}

.tp-success {
    border-color: #0e700e;
    background-color: rgba(14, 112, 14, 0.08);
}

/* --- prihlásenie a zmena hesla ------------------------------------------ */

.tp-auth {
    display: flex;
    justify-content: center;
    padding: 3rem 1rem;
}

.tp-card--auth {
    width: min(420px, 100%);
}

.tp-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.tp-field label {
    font-size: 0.85rem;
    font-weight: 600;
}

.tp-input {
    font: inherit;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--neutral-stroke-rest, #8a8886);
    border-radius: 4px;
    background-color: var(--neutral-fill-input-rest, #fff);
    color: inherit;
}

.tp-input:focus-visible {
    outline: 2px solid var(--accent-fill-rest, #0f6cbd);
    outline-offset: 1px;
}

.tp-button {
    font: inherit;
    font-weight: 600;
    padding: 0.5rem 1.1rem;
    border: none;
    border-radius: 4px;
    background-color: var(--accent-fill-rest, #0f6cbd);
    color: #fff;
    cursor: pointer;
}

.tp-button:hover {
    background-color: var(--accent-fill-hover, #115ea3);
}

.tp-linkbutton {
    font: inherit;
    background: none;
    border: 1px solid currentcolor;
    border-radius: 4px;
    color: inherit;
    padding: 0.2rem 0.6rem;
    cursor: pointer;
}

.tp-linkbutton:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

.validation-message {
    color: #c50f1f;
    font-size: 0.85rem;
}

/* --- hlásenie o strate spojenia (Blazor Server) -------------------------- */

#blazor-error-ui {
    display: none;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 1000;
    padding: 0.6rem 1.25rem;
    background-color: #ffe9a8;
    color: #3b2f00;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    inset-inline-end: 0.75rem;
    top: 0.5rem;
}


/* --- typografia obsahu --------------------------------------------------- */

h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.25rem 0 0.4rem;
}

.tp-lead {
    margin: -0.5rem 0 1.25rem;
    max-width: 70ch;
    color: var(--tp-muted);
    line-height: 1.5;
}

.tp-md > :first-child { margin-top: 0; }
.tp-md > :last-child { margin-bottom: 0; }

.tp-md p {
    margin: 0 0 0.5rem;
    line-height: 1.5;
}

.tp-md ul,
.tp-md ol {
    margin: 0 0 0.5rem;
    padding-inline-start: 1.35rem;
    line-height: 1.5;
}

.tp-md li { margin-bottom: 0.2rem; }

/* --- karty --------------------------------------------------------------- */

.tp-card--wide { max-width: none; }

.tp-card + .tp-card { margin-top: 1rem; }

.tp-card__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
}

.tp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
    align-items: start;
}

.tp-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.25rem;
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    color: var(--tp-muted);
}

.tp-meta strong {
    color: var(--neutral-foreground-rest, #1a1a1a);
    font-weight: 600;
}

.tp-dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.35rem 1rem;
    margin: 0;
    font-size: 0.9rem;
}

.tp-dl dt {
    font-weight: 600;
    color: var(--tp-muted);
}

.tp-dl dd { margin: 0; }

/* --- formuláre a filtre -------------------------------------------------- */

.tp-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.tp-filters .tp-field {
    margin-bottom: 0;
    min-width: 9rem;
}

.tp-filters .tp-field--wide { min-width: 16rem; }

.tp-select,
.tp-textarea {
    font: inherit;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--neutral-stroke-rest, #8a8886);
    border-radius: 4px;
    background-color: var(--neutral-fill-input-rest, #fff);
    color: inherit;
}

.tp-textarea {
    min-height: 7rem;
    resize: vertical;
    line-height: 1.5;
}

.tp-select:focus-visible,
.tp-textarea:focus-visible {
    outline: 2px solid var(--accent-fill-rest, #0f6cbd);
    outline-offset: 1px;
}

.tp-hint {
    font-size: 0.8rem;
    color: var(--tp-muted);
    margin: 0.15rem 0 0;
}

.tp-button--secondary {
    background-color: transparent;
    color: var(--accent-foreground-rest, #0f6cbd);
    border: 1px solid var(--neutral-stroke-rest, #8a8886);
}

.tp-button--secondary:hover { background-color: var(--neutral-layer-3, #f0f0f0); }

.tp-button--danger { background-color: var(--tp-fail); }

.tp-button--danger:hover { background-color: #a80f1c; }

.tp-button:disabled,
.tp-button[disabled] {
    background-color: var(--neutral-layer-3, #e6e6e6);
    color: var(--tp-muted);
    cursor: not-allowed;
}

.tp-button--small {
    padding: 0.25rem 0.6rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.tp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.tp-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

/* --- tabuľky ------------------------------------------------------------- */

.tp-tablewrap {
    overflow-x: auto;
    margin-inline: -0.25rem;
    padding-inline: 0.25rem;
}

.tp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.tp-table th,
.tp-table td {
    text-align: start;
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--tp-line);
    vertical-align: top;
}

.tp-table th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--tp-muted);
    white-space: nowrap;
}

.tp-table tbody tr:hover { background-color: var(--neutral-layer-3, #f5f5f5); }

.tp-table td.tp-num,
.tp-table th.tp-num {
    text-align: end;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tp-table .tp-nowrap { white-space: nowrap; }

.tp-table code { font-size: 0.85em; }

.tp-count--zero { color: var(--tp-muted); }
.tp-count--ok { color: var(--tp-ok); font-weight: 600; }
.tp-count--fail { color: var(--tp-fail); font-weight: 600; }
.tp-count--blocked { color: var(--tp-blocked); font-weight: 600; }
.tp-count--warn { color: var(--tp-warn); font-weight: 600; }

.tp-empty {
    padding: 1.25rem;
    border: 1px dashed var(--tp-line);
    border-radius: 4px;
    color: var(--tp-muted);
    text-align: center;
    line-height: 1.5;
}

.tp-paging {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--tp-muted);
}

/* --- odznaky ------------------------------------------------------------- */

.tp-badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}

.tp-badge--ok { color: var(--tp-ok); background-color: var(--tp-ok-bg); border-color: var(--tp-ok); }
.tp-badge--fail { color: var(--tp-fail); background-color: var(--tp-fail-bg); border-color: var(--tp-fail); }
.tp-badge--blocked { color: var(--tp-blocked); background-color: var(--tp-blocked-bg); border-color: var(--tp-blocked); }
.tp-badge--warn { color: var(--tp-warn); background-color: var(--tp-warn-bg); border-color: var(--tp-warn); }
.tp-badge--info { color: var(--tp-info); background-color: var(--tp-info-bg); border-color: var(--tp-info); }
.tp-badge--muted { color: var(--tp-muted); background-color: var(--tp-muted-bg); border-color: var(--tp-muted); }

.tp-chip {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    margin: 0 0.25rem 0.25rem 0;
    border-radius: 3px;
    font-size: 0.78rem;
    background-color: var(--neutral-layer-3, #f0f0f0);
    color: var(--tp-muted);
    border: 1px solid var(--tp-line);
}

.tp-sevchips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tp-sevchip {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 5.5rem;
    padding: 0.5rem 0.7rem;
    border-radius: 4px;
    border: 1px solid var(--tp-line);
    text-decoration: none;
    color: inherit;
}

.tp-sevchip__value {
    font-size: 1.35rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.tp-sevchip__label {
    font-size: 0.78rem;
    color: var(--tp-muted);
}

.tp-sevchip--critical { border-color: var(--tp-fail); }
.tp-sevchip--critical .tp-sevchip__value { color: var(--tp-fail); }
.tp-sevchip--high { border-color: var(--tp-blocked); }
.tp-sevchip--high .tp-sevchip__value { color: var(--tp-blocked); }
.tp-sevchip--medium { border-color: var(--tp-warn); }
.tp-sevchip--medium .tp-sevchip__value { color: var(--tp-warn); }
.tp-sevchip--low { border-color: var(--tp-line); }
.tp-sevchip--low .tp-sevchip__value { color: var(--tp-muted); }

/* --- readiness semafor --------------------------------------------------- */

.tp-semaphore {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    border-radius: 6px;
    border: 1px solid;
}

.tp-semaphore__light {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    flex: 0 0 auto;
    margin-top: 0.15rem;
}

.tp-semaphore__title {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 0.35rem;
}

.tp-semaphore__reasons {
    margin: 0;
    padding-inline-start: 1.2rem;
    line-height: 1.55;
}

.tp-semaphore--red { border-color: var(--tp-fail); background-color: var(--tp-fail-bg); }
.tp-semaphore--red .tp-semaphore__light { background-color: var(--tp-fail); }
.tp-semaphore--red .tp-semaphore__title { color: var(--tp-fail); }

.tp-semaphore--yellow { border-color: var(--tp-warn); background-color: var(--tp-warn-bg); }
.tp-semaphore--yellow .tp-semaphore__light { background-color: #f0b400; }
.tp-semaphore--yellow .tp-semaphore__title { color: var(--tp-warn); }

.tp-semaphore--green { border-color: var(--tp-ok); background-color: var(--tp-ok-bg); }
.tp-semaphore--green .tp-semaphore__light { background-color: var(--tp-ok); }
.tp-semaphore--green .tp-semaphore__title { color: var(--tp-ok); }

/* --- exekúcia behu ------------------------------------------------------- */

.tp-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.5rem 0 1rem;
    font-size: 0.88rem;
    color: var(--tp-muted);
}

.tp-progress__track {
    flex: 1 1 auto;
    max-width: 22rem;
    height: 6px;
    border-radius: 3px;
    background-color: var(--neutral-layer-3, #e6e6e6);
    overflow: hidden;
}

.tp-progress__value {
    height: 100%;
    background-color: var(--accent-fill-rest, #0f6cbd);
}

.tp-step {
    border: 1px solid var(--tp-line);
    border-radius: 6px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.75rem;
    background-color: var(--neutral-layer-2, #fff);
}

.tp-step--ok { border-inline-start: 4px solid var(--tp-ok); }
.tp-step--fail { border-inline-start: 4px solid var(--tp-fail); }
.tp-step--blocked { border-inline-start: 4px solid var(--tp-blocked); }
.tp-step--skipped { border-inline-start: 4px solid var(--tp-muted); }
.tp-step--notdone { border-inline-start: 4px solid var(--tp-line); }

.tp-step__header {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.tp-step__number {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--tp-muted);
    white-space: nowrap;
}

.tp-step__label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--tp-muted);
    margin: 0.6rem 0 0.15rem;
}

.tp-seg {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0.6rem 0 0.5rem;
}

.tp-seg__button {
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    border: 1px solid var(--neutral-stroke-rest, #8a8886);
    background-color: transparent;
    color: var(--tp-muted);
    cursor: pointer;
}

.tp-seg__button:hover:not(:disabled) { background-color: var(--neutral-layer-3, #f0f0f0); }

.tp-seg__button:disabled { cursor: not-allowed; opacity: 0.6; }

.tp-seg__button--active-ok { color: #fff; background-color: var(--tp-ok); border-color: var(--tp-ok); }
.tp-seg__button--active-fail { color: #fff; background-color: var(--tp-fail); border-color: var(--tp-fail); }
.tp-seg__button--active-blocked { color: #fff; background-color: var(--tp-blocked); border-color: var(--tp-blocked); }
.tp-seg__button--active-skipped { color: #fff; background-color: var(--tp-muted); border-color: var(--tp-muted); }

.tp-blocked-reason {
    font-size: 0.85rem;
    color: var(--tp-muted);
    margin: 0.35rem 0 0;
}

/* --- modálne okno -------------------------------------------------------- */

.tp-modal {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 3rem 1rem;
    overflow-y: auto;
}

.tp-modal__backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.35);
}

.tp-modal__panel {
    position: relative;
    width: min(620px, 100%);
    background-color: var(--neutral-layer-2, #fff);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--tp-line);
}

.tp-modal__panel--wide { width: min(860px, 100%); }

.tp-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--tp-line);
}

.tp-modal__header h2 {
    margin: 0;
    font-size: 1.05rem;
}

.tp-modal__close {
    font: inherit;
    font-size: 1.1rem;
    line-height: 1;
    background: none;
    border: none;
    color: var(--tp-muted);
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
}

.tp-modal__close:hover { background-color: var(--neutral-layer-3, #f0f0f0); }

.tp-modal__body { padding: 1.1rem 1.25rem; }

.tp-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.9rem 1.25rem;
    border-top: 1px solid var(--tp-line);
}

/* --- prílohy ------------------------------------------------------------- */

.tp-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tp-attachment {
    width: 190px;
    border: 1px solid var(--tp-line);
    border-radius: 4px;
    padding: 0.5rem;
    font-size: 0.8rem;
}

.tp-attachment img {
    display: block;
    width: 100%;
    height: 120px;
    object-fit: contain;
    background-color: var(--neutral-layer-3, #f5f5f5);
    border-radius: 3px;
    margin-bottom: 0.4rem;
}

.tp-attachment__name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tp-attachment__meta {
    color: var(--tp-muted);
    font-size: 0.75rem;
}

.tp-filelist {
    margin: 0.5rem 0 0;
    padding-inline-start: 1.2rem;
    font-size: 0.85rem;
    color: var(--tp-muted);
}

/* --- jednorazové tajomstvo (heslo, API kľúč) ----------------------------- */

.tp-secret {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0.5rem 0;
}

.tp-secret code {
    font-size: 1rem;
    padding: 0.4rem 0.6rem;
    user-select: all;
    word-break: break-all;
}

/* --- história a drobnosti ------------------------------------------------ */

.tp-timeline {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.85rem;
}

.tp-timeline li {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--tp-line);
    line-height: 1.45;
}

.tp-timeline li:last-child { border-bottom: none; }

.tp-timeline time {
    color: var(--tp-muted);
    margin-inline-end: 0.5rem;
    font-variant-numeric: tabular-nums;
}
