/*
 * ftp.e-learning.pl - wygląd (Brand & Design System 2.0 e-learning.pl).
 * Logowanie = okładka papieru firmowego (pas Blue 500 po prawej), lista plików = strona wewnętrzna.
 * Kolory i krój jak w src/brand.js generatora dokumentów.
 */

@font-face { font-family: "Bai Jamjuree"; font-weight: 400; font-display: swap; src: url("fonts/bai-jamjuree-regular.woff2") format("woff2"); }
@font-face { font-family: "Bai Jamjuree"; font-weight: 500; font-display: swap; src: url("fonts/bai-jamjuree-medium.woff2") format("woff2"); }
@font-face { font-family: "Bai Jamjuree"; font-weight: 600; font-display: swap; src: url("fonts/bai-jamjuree-semibold.woff2") format("woff2"); }
@font-face { font-family: "Bai Jamjuree"; font-weight: 700; font-display: swap; src: url("fonts/bai-jamjuree-bold.woff2") format("woff2"); }

:root {
    --ink: #101828;          /* Brand / Ink / 900 - tekst, nagłówki, główne akcje */
    --ink-2: #4f4f4f;        /* Neutral / 600 - tekst drugorzędny */
    --muted: #767676;        /* Neutral / 500 - tekst pomocniczy (4.5:1 na bieli) */
    --line: #e0e0e0;         /* Neutral / 200 - obramowania */
    --line-strong: #bdbdbd;  /* Neutral / 300 - obramowania pól */
    --surface: #f2f2f2;      /* Neutral / 50 - nagłówek tabeli, subtelne tła */
    --paper: #ffffff;
    --blue: #009ee3;         /* Brand / Blue / 500 - kolor marki, pas */
    --blue-text: #007eb6;    /* Brand / Blue / 600 - linki, akcenty tekstowe */
    --blue-strong: #006f9f;  /* Brand / Blue / 700 - hover */
    --blue-soft: #eaf7fc;    /* Brand / Blue / 50 - jasne tła */
    --ok: #027a48;   --ok-bg: #ecfdf3;
    --warn: #b54708; --warn-bg: #fffaeb;
    --err: #b3261e;  --err-bg: #fef3f2;
    --info: #175cd3; --info-bg: #eff8ff;

    --font: "Bai Jamjuree", "Segoe UI", system-ui, sans-serif;
    --radius: 6px;
    --gutter: clamp(16px, 4vw, 48px);
    --measure: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
}

a { color: var(--blue-text); text-underline-offset: 3px; }
a:hover { color: var(--blue-strong); }

:focus-visible { outline: 3px solid var(--blue-text); outline-offset: 2px; border-radius: 2px; }

img { max-width: 100%; }

.icon { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75;
    stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.25em; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Okładka: logowanie i komunikaty ---------- */

.cover {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(96px, 34vw, 520px);
}

.cover__band { background: var(--blue); }

.cover__sheet {
    display: flex;
    flex-direction: column;
    padding: clamp(28px, 6vw, 72px) var(--gutter) 28px;
    max-width: 760px;
    width: 100%;
    margin-left: auto;
}

.cover__body { margin: auto 0; padding: 48px 0; max-width: 520px; }
.cover__body .form, .cover__body .lead, .cover__body .notice { max-width: 460px; }

.brand { display: inline-block; line-height: 0; }
.brand img { height: 30px; width: auto; }

/* Etykieta nad tytułem jak „KATEGORIA DOKUMENTU” na okładce papieru firmowego. */
.kicker {
    margin: 0 0 12px;
    color: var(--blue-text);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.doc-title {
    margin: 0;
    font-size: clamp(30px, 4.6vw, 44px);
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: -0.01em;
    overflow-wrap: break-word;
}

.doc-sub {
    margin: 14px 0 0;
    color: var(--blue-text);
    font-size: 19px;
    font-weight: 500;
}

.lead { margin: 18px 0 0; color: var(--ink-2); max-width: 52ch; }

/* ---------- Formularz ---------- */

.form { margin-top: 32px; display: grid; gap: 18px; }

.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 500; }
.field input {
    font: inherit;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 11px 14px;
    min-height: 46px;
    width: 100%;
}
.field input:hover { border-color: var(--muted); }
.field input:focus-visible { outline: none; border-color: var(--blue-text); box-shadow: 0 0 0 3px var(--blue-soft), 0 0 0 4px var(--blue-text); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: #1d2939; color: #fff; }
.btn--secondary { background: var(--paper); color: var(--ink); border-color: var(--line-strong); }
.btn--secondary:hover { border-color: var(--ink); color: var(--ink); }
.btn--ghost { background: transparent; color: var(--blue-text); padding-inline: 10px; }
.btn--ghost:hover { background: var(--blue-soft); color: var(--blue-strong); }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- Komunikaty ---------- */

.notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin: 24px 0 0;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid;
    font-size: 15px;
}
.notice .icon { margin-top: 2px; }
.notice--error { color: var(--err); background: var(--err-bg); border-color: #f7c6c2; }
.notice--warn { color: var(--warn); background: var(--warn-bg); border-color: #fedf89; }
.notice--ok { color: var(--ok); background: var(--ok-bg); border-color: #a6f4c5; }
.notice--info { color: var(--info); background: var(--info-bg); border-color: #b2ddff; }
.notice p { margin: 0; color: var(--ink); }
.notice strong { color: inherit; }

/* ---------- Strona wewnętrzna: lista plików ---------- */

.page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
    border-bottom: 1px solid var(--line);
    background: var(--paper);
}
.topbar__inner, .content, .footer__inner {
    width: 100%;
    max-width: calc(var(--measure) + 2 * var(--gutter));
    margin: 0 auto;
    padding-inline: var(--gutter);
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }

.session { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; min-width: 0; }
.session__user { display: inline-flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.content { flex: 1; padding-top: clamp(28px, 5vw, 56px); padding-bottom: 56px; }

.crumbs { margin: 0 0 14px; font-size: 15px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0; padding: 0; }
.crumbs li { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.crumbs li + li::before { content: "/"; color: var(--line-strong); }
.crumbs a { font-weight: 500; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs [aria-current] { color: var(--ink-2); }

/* Blok metadanych jak „KLIENT / DATA / PRZYGOTOWAŁ” na okładce. */
.meta { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 22px 0 0; font-size: 15px; }
.meta div { display: flex; gap: 8px; align-items: baseline; }
.meta dt { color: var(--muted); font-size: 13px; }
.meta dd { margin: 0; font-weight: 500; }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 36px 0 0;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--ink);
}
.search { position: relative; flex: 1 1 260px; max-width: 420px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
    font: inherit;
    width: 100%;
    min-height: 44px;
    padding: 9px 14px 9px 40px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    color: var(--ink);
    background: var(--paper);
}
.search input:focus-visible { outline: none; border-color: var(--blue-text); box-shadow: 0 0 0 3px var(--blue-soft), 0 0 0 4px var(--blue-text); }
.toolbar__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

/* Tabela plików */
.files { width: 100%; border-collapse: collapse; font-size: 15px; }
.files th {
    text-align: left;
    font-weight: 500;
    font-size: 13px;
    color: var(--muted);
    padding: 12px 12px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.files th[aria-sort] { padding: 0; }
.sort {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 12px 12px;
    width: 100%;
    text-align: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.sort:hover { color: var(--ink); }
.sort .icon { width: 14px; height: 14px; opacity: 0; }
th[aria-sort="ascending"] .sort .icon, th[aria-sort="descending"] .sort .icon { opacity: 1; color: var(--ink); }
th[aria-sort="descending"] .sort .icon { transform: rotate(180deg); }
.files td { padding: 10px 12px; height: 62px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.files th.num { text-align: right; }
.files th.num .sort { justify-content: flex-end; }
.files tbody tr:hover { background: var(--blue-soft); }
.files .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.files .when { white-space: nowrap; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.files .act { text-align: right; width: 1%; white-space: nowrap; }

.file { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; color: var(--ink); font-weight: 500; }
.file:hover { color: var(--blue-strong); }
.file:hover .file__name { text-decoration: underline; }
.file__icon {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink-2);
}
.file--dir .file__icon { background: var(--blue-soft); color: var(--blue-text); }
.file__name { overflow-wrap: break-word; min-width: 0; }
.file__ext { display: none; }

.empty { margin: 48px 0; color: var(--ink-2); }
.empty strong { display: block; color: var(--ink); font-size: 19px; font-weight: 600; margin-bottom: 4px; }
.noresults[hidden] { display: none; }

/* ---------- Stopka (jak w papierze firmowym) ---------- */

.footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; padding-block: 18px; }
.footer a { color: var(--muted); margin-left: 16px; }
.footer a:hover { color: var(--blue-text); }
.cover .footer { border-top: 0; }
.cover .footer__inner { padding-inline: 0; }

/* ---------- Okno przesyłania ---------- */

dialog.upload {
    border: 0;
    border-radius: 10px;
    padding: 0;
    width: min(520px, calc(100vw - 32px));
    color: var(--ink);
    box-shadow: 0 24px 48px rgba(16, 24, 40, 0.18);
}
dialog.upload::backdrop { background: rgba(16, 24, 40, 0.45); }
.upload__head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 0; }
.upload__head h2 { margin: 0; font-size: 20px; font-weight: 600; }
.upload__body { padding: 16px 24px 24px; display: grid; gap: 16px; }
.drop {
    display: grid;
    place-items: center;
    gap: 6px;
    text-align: center;
    padding: 28px 16px;
    border: 2px dashed var(--line-strong);
    border-radius: 10px;
    color: var(--ink-2);
    cursor: pointer;
}
.drop:hover, .drop.is-over { border-color: var(--blue); background: var(--blue-soft); }
.drop .icon { width: 28px; height: 28px; color: var(--blue-text); }
.drop strong { color: var(--ink); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop:focus-within { outline: 3px solid var(--blue-text); outline-offset: 2px; }
.upload__hint { margin: 0; font-size: 13px; color: var(--muted); }
.upload__file { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.upload__actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Telefony ---------- */

@media (max-width: 760px) {
    .cover { grid-template-columns: 1fr; grid-template-rows: 10px 1fr; }
    .cover__band { grid-row: 1; }
    .cover__sheet { grid-row: 2; margin: 0; }
    .cover__body { padding: 36px 0; }

    .topbar__inner { min-height: 60px; }
    .brand img { height: 24px; }
    .session__user { max-width: 40vw; }
    .session .btn span { display: none; }

    .toolbar { gap: 10px; }
    .search { max-width: none; flex-basis: 100%; }
    .toolbar__actions { margin-left: 0; width: 100%; }
    .toolbar__actions .btn { flex: 1; }

    /* Tabela jako lista: nazwa w pierwszej linii, rozmiar i data pod spodem. */
    .files thead { display: none; }
    .files, .files tbody, .files tr, .files td { display: block; }
    .files tr {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas: "name name act" "size when act";
        column-gap: 12px;
        padding: 12px 0;
        border-bottom: 1px solid var(--line);
    }
    .files td { border: 0; padding: 0; height: auto; }
    .files .c-name { grid-area: name; }
    .files .c-size, .files .c-when { font-size: 13px; color: var(--muted); text-align: left; }
    .files .c-size { grid-area: size; padding-left: 48px; }
    .files .c-when { grid-area: when; }
    .files .act { grid-area: act; align-self: center; }
    .files .act .btn span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
    .cover__band, .toolbar, .act, .session .btn { display: none; }
}
