:root {
    --page-shell-max-width: 1100px;
    --app-page-bg: #D3F4F4;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, system-ui, sans-serif;
    background: var(--app-page-bg);
    color: #111111;
}

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    padding: 0.95rem 1.75rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}

button:hover,
.btn:hover {
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
}

.btn {
    background: rgba(255, 255, 255, 0.08);
}

.btn-primary {
    background-color: #428CEA;
    color: #ffffff;
}

.btn-danger {
    background-color: #f02724;
    color: #ffffff;
}

.page {
    min-height: 100vh;
    padding: 2rem 1rem 4rem;
}

/* main + header; !important — Bootstrap 3 ma własny .page-header (margines, obramowanie) */
/* Grid: tytuł zawsze w pierwszej kolumnie, „Cofnij” w drugiej — nie spada pod długi h1 jak przy flex-wrap */
main.page > header.page-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    max-width: var(--page-shell-max-width);
    width: 100%;
    margin: 0 auto 1.5rem !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
}

main.page > header.page-header h1 {
    margin: 0;
    flex: 0 1 auto;
    min-width: 0;
    text-align: left;
    font-size: clamp(1.6rem, 2.5vw, 2.4rem);
}

/* Nagłówek jak instrukcja.php: kapibara + h1 + blok z „Cofnij” (tekst lub ikona+tekst) */
.header-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.header-hero .header-image {
    display: block;
    flex-shrink: 0;
    height: 5em;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

@media (max-width: 40rem) {
    .header-hero .header-image {
        height: auto;
        max-height: 3rem;
        max-width: min(32vw, 5.5rem);
        width: auto;
    }
}

main.page > header.page-header .header-hero h1 {
    margin: 0;
    flex: 1 1 0;
    min-width: 0;
    text-align: left;
    font-size: clamp(1.15rem, 1.75vw, 1.65rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Opis klasy pod tytułem (nagrania / dziennik), nadal w kolumnie obok „Cofnij” */
main.page > header.page-header .header-hero .teacher-class-desc {
    flex: 1 1 100%;
    min-width: 0;
    margin: 0.35rem 0 0;
}

/* Bootstrap 3 .btn — w nagłówku zachowaj pogrubienie i inline-flex jak w common */
main.page > header.page-header .action-block .btn,
main.page > header.page-header .action-block a.btn {
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Nagłówek: „Cofnij” z małą ikoną (includes/header_cofnij.php) */
main.page > header.page-header .action-block a.btn.header-cofnij-link {
    gap: 0;
    padding: 0.5rem 0.8rem;
    font-size: 1rem;
}

main.page > header.page-header .header-cofnij-icon {
    flex-shrink: 0;
    height: 1.5em;
    width: auto;
    max-height: 1em;
    object-fit: contain;
    display: block;
}

main.page > header.page-header .action-block {
    justify-self: end;
    align-self: center;
}

.top-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
    flex: 0 0 auto;
}

/* Nawigacja pomocnicza pod ujednoliconym nagłówkiem (np. panel nauczyciela, lista nagrań) */
main.page > nav.top-nav {
    max-width: var(--page-shell-max-width);
    width: 100%;
    margin: 0 auto 1rem;
    justify-content: flex-end;
}

.card {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 24px;
    padding: 1.75rem;
    max-width: var(--page-shell-max-width);
    margin: 0 auto 1.5rem;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

.content-card h2 {
    margin-top: 0;
}

.text-muted {
    color: #64748b;
}

.alert {
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.12);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 16px;
    color: #111111;
}

label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
select {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: #e6e8ea;
    color: #040404;
}

input[type="file"] {
    padding: 0.6rem 1rem;
}

button[type="submit"] {
    min-width: 160px;
}

.recordings-table {
    width: 100%;
    margin: 0;
    padding: 0;
    border-collapse: collapse;
}

.recordings-table th,
.recordings-table td {
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.recordings-table th {
    text-align: left;
    color: #94a3b8;
    font-size: 0.92rem;
}

.recordings-table td {
    vertical-align: top;
}

/* Jedna kolumna: etykiety „Data” / „Czas” (nagrania, nagrywanie) */
.recordings-col-datetime {
    overflow-wrap: anywhere;
}

.recordings-col-datetime__head-line {
    display: block;
    line-height: 1.3;
}

.recordings-col-datetime__head-line--sub {
    font-size: 0.88em;
    font-weight: 600;
}

.recordings-col-datetime__date {
    display: block;
    font-weight: 500;
    line-height: 1.35;
}

.recordings-col-datetime__duration {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.9em;
    font-weight: 500;
    color: #64748b;
    line-height: 1.3;
}

/* Wspólna treść regulaminu (includes/regulamin-article.html — strona + modal) */
.regulamin-doc {
    text-align: left;
    line-height: 1.55;
}

.regulamin-doc p {
    margin: 0 0 0.65em;
}

.regulamin-doc .doc-li {
    margin-left: 1.25em;
}

.regulamin-doc .doc-li.doc-li-deep {
    margin-left: 2.75em;
    position: relative;
}

.regulamin-doc .doc-li.doc-li-deep::before {
    content: '\2022';
    position: absolute;
    left: -0.9em;
}

.regulamin-doc .doc-li-encourage {
    color: #c00;
}

.regulamin-doc .regulamin-inline-icon {
    height: 2.6em;
    width: auto;
    vertical-align: -1.1em;
    margin-left: 0.12em;
}

.regulamin-doc .doc-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75em 0;
}

.regulamin-doc .doc-table td {
    border: 1px solid rgba(15, 23, 42, 0.15);
    padding: 0.5rem 0.75rem;
    vertical-align: top;
}

.regulamin-doc .doc-table div {
    margin: 0;
}

@media (max-width: 700px) {
    .top-nav {
        flex-direction: column;
        align-items: flex-end;
    }

    .card {
        padding: 1.25rem;
    }
}

.modal-content {
    width: 120%;
    max-width: 1000px;
}

.modal-body { max-height: 70vh; overflow-y: auto; }

/* Karta z przyciskami: regulamin.php, menu.php, instrukcja.php */
.regulamin-content-card > .action-block {
    display: flex;
    justify-content: center;
    width: 100%;
}

/* Baner instalacji PWA (js/pwa-install.js) */
.pwa-install-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10050;
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(15, 23, 42, 0) 0%, rgba(15, 23, 42, 0.92) 12%, rgba(15, 23, 42, 0.96) 100%);
    color: #f8fafc;
    box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.35);
}

.pwa-install-banner[hidden] {
    display: none !important;
}

.pwa-install-banner__inner {
    max-width: var(--page-shell-max-width);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}

.pwa-install-banner__text {
    margin: 0;
    flex: 1 1 220px;
    font-size: 0.9rem;
    line-height: 1.45;
}

.pwa-install-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    flex: 0 1 auto;
}

.pwa-install-banner .btn {
    padding: 0.65rem 1.15rem;
    font-size: 0.88rem;
}

.pwa-install-banner .btn-secondary {
    background: rgba(248, 250, 252, 0.12);
    color: #f8fafc;
    border: 1px solid rgba(248, 250, 252, 0.28);
}
