/* Style ekranowe aplikacji (panel administracyjny) */

:root {
    --bg: #f4f4f5;
    --fg: #1f2937;
    --muted: #6b7280;
    --border: #d1d5db;
    --primary: #1f2937;
    --primary-fg: #ffffff;
    --error-bg: #fee2e2;
    --error-fg: #991b1b;
    --card-bg: #ffffff;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.5;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: var(--primary-fg);
}

.topbar .brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-fg);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.topnav a { color: var(--primary-fg); text-decoration: none; }
.topnav a:hover { text-decoration: underline; }
.topnav__user { color: #cbd5e1; font-size: 0.9rem; }

.container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

h1 { margin-top: 0; }

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
}

.card--narrow {
    max-width: 380px;
    margin: 3rem auto;
}

.form { display: flex; flex-direction: column; gap: 1rem; }
.form__label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; color: var(--muted); }
.form__input {
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    color: var(--fg);
}
.form__input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.form__actions { display: flex; gap: 0.75rem; align-items: center; }

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--fg);
    text-decoration: none;
    font-size: 0.95rem;
    cursor: pointer;
}
.btn:hover { background: #f9fafb; }
.btn--primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.btn--primary:hover { opacity: 0.9; }

.alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.alert--error { background: var(--error-bg); color: var(--error-fg); }
.alert ul { margin: 0; padding-left: 1.2rem; }

.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); }
.table th { background: #f9fafb; font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.table tr:last-child td { border-bottom: none; }
.table__actions { white-space: nowrap; }
.table__actions a { margin-right: 0.75rem; }

.muted { color: var(--muted); }

.sitefooter { text-align: center; color: var(--muted); padding: 2rem 0; }

/* --- Edytor szablonow --- */

.card + .card { margin-top: 1.5rem; }
.card h2 { margin-top: 0; }

/* Formularz w jednej linii (np. dodawanie / zmiana nazwy) */
.form--inline {
    flex-direction: row;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.form--inline .form__input { min-width: 220px; }

/* Maly formularz osadzony w komorce akcji */
.inline-form { display: inline; margin: 0; }

/* Przycisk wygladajacy jak link (akcje w tabeli) */
.link-btn {
    background: none;
    border: none;
    padding: 0;
    margin-right: 0.5rem;
    color: #2563eb;
    cursor: pointer;
    font-size: 0.95rem;
}
.link-btn:hover { text-decoration: underline; }
.link-btn:disabled { color: #cbd5e1; cursor: default; text-decoration: none; }
.link-btn--danger { color: #b91c1c; }

/* Odznaki typu sekcji */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge--text { background: #e0e7ff; color: #3730a3; }
.badge--image { background: #dcfce7; color: #166534; }

/* Miniatury obrazkow */
.thumb { max-height: 48px; max-width: 120px; border: 1px solid var(--border); border-radius: 4px; vertical-align: middle; }
.thumb--lg { max-height: 160px; max-width: 320px; }
.section-preview { max-width: 320px; }

/* Podpowiedz ze zmiennymi */
.hint { background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; padding: 0.75rem 1rem; font-size: 0.9rem; }
.var-list { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.var-list code { background: #eef2ff; padding: 0.1rem 0.35rem; border-radius: 4px; }
