/* =========================================================
   Administrace – Potravinová banka Pro Prahu a Středočeský kraj
   Stejný vizuální jazyk jako web: zelená, bílé karty, zaoblení
   ========================================================= */

:root {
    --a-green: #2e9e4f;
    --a-green-dark: #1b7a3d;
    --a-deep: #0f5a2c;
    --a-tint: #eaf6ee;
    --a-tint-2: #f3faf5;
    --a-ink: #14261b;
    --a-soft: #5d6b62;
    --a-line: #e3eae5;
    --a-bg: #f5f7f6;
    --a-danger: #b3261e;
    --a-white: #ffffff;

    --a-ff: "Inter", "Segoe UI", system-ui, sans-serif;
    --a-ff-display: "Poppins", "Inter", sans-serif;

    --a-r-sm: 9px;
    --a-r: 14px;
    --a-r-lg: 20px;
    --a-shadow-sm: 0 4px 14px rgba(15, 90, 44, .06);
    --a-shadow: 0 16px 40px rgba(15, 90, 44, .12);
    --a-sidebar: 272px;
}

*, *::before, *::after { box-sizing: border-box; }
/* atribut hidden musí vyhrát i nad display: flex u hlášek */
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--a-bg);
    color: var(--a-ink);
    font-family: var(--a-ff);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--a-green-dark); text-decoration: none; }
a:hover { color: var(--a-green); }
img { max-width: 100%; display: block; }

h1, h2, h3 { margin: 0 0 .5em; font-family: var(--a-ff-display); font-weight: 600; letter-spacing: -.015em; line-height: 1.2; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }

/* ---------- rozvržení ---------- */
.admin { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--a-sidebar);
    flex: 0 0 var(--a-sidebar);
    background: var(--a-deep);
    color: rgba(255, 255, 255, .76);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 24px 22px; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.sidebar__mark {
    width: 42px; height: 42px;
    border-radius: 13px;
    background: var(--a-green);
    display: grid; place-items: center;
    color: #fff;
    flex: 0 0 auto;
}
.sidebar__mark svg { width: 23px; height: 23px; }
.sidebar__title { color: #fff; font-family: var(--a-ff-display); font-weight: 600; font-size: 1rem; line-height: 1.2; }
.sidebar__subtitle { font-size: .76rem; color: rgba(255, 255, 255, .58); }

.sidebar__nav { padding: 16px 14px; display: grid; gap: 3px; flex: 1; align-content: start; }
.sidebar__group { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: rgba(255, 255, 255, .42); padding: 18px 12px 8px; font-weight: 600; }
.sidebar__nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 11px;
    color: rgba(255, 255, 255, .8);
    font-weight: 500;
    font-size: .93rem;
    transition: background-color .15s ease, color .15s ease;
}
.sidebar__nav a svg { width: 18px; height: 18px; flex: 0 0 auto; opacity: .85; }
.sidebar__nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.sidebar__nav a.is-active { background: var(--a-green); color: #fff; }
.sidebar__badge { margin-left: auto; background: var(--a-green); color: #fff; border-radius: 999px; padding: 1px 9px; font-size: .74rem; font-weight: 700; }
.sidebar__footer { padding: 16px 22px 22px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .85rem; }
.sidebar__footer a { color: rgba(255, 255, 255, .74); }
.sidebar__footer a:hover { color: #fff; }

.admin__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.admin__topbar {
    background: var(--a-white);
    border-bottom: 1px solid var(--a-line);
    padding: 15px 32px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.admin__topbar h1 { margin: 0; font-size: 1.25rem; }
.admin__crumb { font-size: .82rem; color: var(--a-soft); }
.admin__user { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--a-tint); color: var(--a-green-dark); display: grid; place-items: center; font-weight: 700; }
.admin__content { padding: 30px 32px; max-width: 1460px; width: 100%; }

.sidebar-toggle {
    display: none;
    width: 42px; height: 42px;
    border-radius: 11px;
    border: 1px solid var(--a-line);
    background: #fff;
    cursor: pointer;
    align-items: center; justify-content: center;
}
.sidebar-toggle svg { width: 20px; height: 20px; }

/* ---------- karty ---------- */
.panel { background: var(--a-white); border: 1px solid var(--a-line); border-radius: var(--a-r-lg); padding: 26px; }
.panel + .panel { margin-top: 22px; }
.panel__head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.panel__head h2 { margin: 0; }
.panel__head .btn { margin-left: auto; }

.grid { display: grid; gap: 20px; }
.grid--tiles { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--form { grid-template-columns: minmax(0, 2fr) minmax(290px, 1fr); align-items: start; }

.tile { background: var(--a-white); border: 1px solid var(--a-line); border-radius: var(--a-r-lg); padding: 22px; display: flex; gap: 16px; align-items: center; }
.tile__icon { width: 46px; height: 46px; border-radius: 13px; background: var(--a-tint); color: var(--a-green-dark); display: grid; place-items: center; flex: 0 0 auto; }
.tile__icon svg { width: 22px; height: 22px; }
.tile__icon--amber { background: #fdefe3; color: #a75a12; }
.tile__value { font-family: var(--a-ff-display); font-size: 1.85rem; font-weight: 700; line-height: 1; }
.tile__label { font-size: .85rem; color: var(--a-soft); }

/* ---------- tabulky ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--a-r); border: 1px solid var(--a-line); background: var(--a-white); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
thead th {
    text-align: left;
    font-size: .74rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--a-soft);
    padding: 14px 18px;
    border-bottom: 1px solid var(--a-line);
    background: var(--a-tint-2);
    white-space: nowrap;
}
tbody td { padding: 15px 18px; border-bottom: 1px solid var(--a-line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--a-tint-2); }
td.actions { text-align: right; white-space: nowrap; }
td.nowrap, .nowrap { white-space: nowrap; }
td .muted, .muted { color: var(--a-soft); font-size: .87rem; }
.row-title { font-weight: 600; }
.thumb { width: 64px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--a-tint); }
.thumb--contain { object-fit: contain; padding: 4px; background: #fff; border: 1px solid var(--a-line); }

/* ---------- štítky ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: .76rem; font-weight: 600; }
/* více štítků v jedné buňce pod sebou s malou mezerou */
td .pill + .pill { margin-top: 4px; }
td .pill { white-space: nowrap; }
.pill--on { background: var(--a-tint); color: var(--a-green-dark); }
.pill--off { background: #f0f2f0; color: var(--a-soft); }
.pill--new { background: #fdefe3; color: #a75a12; }
.pill--info { background: var(--a-tint); color: var(--a-green-dark); }

/* ---------- tlačítka ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1.5px solid transparent;
    border-radius: var(--a-r-sm);
    font-family: var(--a-ff-display);
    font-size: .86rem;
    font-weight: 600;
    line-height: 1.1;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--a-green-dark); color: #fff; }
.btn--primary:hover { background: var(--a-green); color: #fff; }
.btn--light { background: #fff; border-color: var(--a-line); color: var(--a-ink); }
.btn--light:hover { border-color: var(--a-green); color: var(--a-green-dark); }
.btn--ghost { background: transparent; color: var(--a-soft); }
.btn--ghost:hover { color: var(--a-ink); background: #eef1ef; }
.btn--danger { background: #fff; border-color: #f0cdc9; color: var(--a-danger); }
.btn--danger:hover { background: var(--a-danger); border-color: var(--a-danger); color: #fff; }
.btn--sm { padding: 7px 13px; font-size: .8rem; border-radius: 8px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .35; cursor: not-allowed; transform: none; }
.btn-group { display: inline-flex; gap: 8px; }
.order-btns { display: inline-flex; gap: 6px; }

/* náhled statistiky – white-space:pre, aby byla vidět mezera v předponě/příponě */
.stat-preview {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--a-tint);
    color: var(--a-green-dark);
    font-weight: 700;
    white-space: pre;
}
.order-btns form { display: inline; }
.order-btns .btn { padding: 6px 11px; font-size: .95rem; line-height: 1; }

/* ---------- formuláře ---------- */
.field { margin-bottom: 18px; }
.field > label { display: block; font-weight: 600; font-size: .87rem; margin-bottom: 7px; }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="url"],
.field input[type="tel"],
.field input[type="number"],
.field input[type="date"],
.field input[type="file"],
.field select,
.field textarea {
    width: 100%;
    font: inherit;
    padding: 11px 14px;
    border: 1.5px solid var(--a-line);
    border-radius: var(--a-r-sm);
    background: #fff;
    color: var(--a-ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { min-height: 130px; resize: vertical; }
.field textarea.tall { min-height: 360px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88rem; line-height: 1.65; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--a-green); box-shadow: 0 0 0 4px rgba(46, 158, 79, .13);
}
.field .hint { font-size: .82rem; color: var(--a-soft); margin-top: 6px; }
.form-row { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.switch { display: flex; align-items: center; gap: 11px; font-weight: 600; font-size: .9rem; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--a-green); }

.field-validation-error, .validation-summary-errors { color: var(--a-danger); font-size: .84rem; font-weight: 500; }
.validation-summary-errors ul { margin: 0 0 14px; padding-left: 18px; }
.input-validation-error { border-color: var(--a-danger) !important; }

.form-actions { display: flex; gap: 12px; align-items: center; padding-top: 20px; margin-top: 4px; border-top: 1px solid var(--a-line); }
.form-actions .spacer { margin-left: auto; }

/* ---------- přetahování řádků ---------- */
.drag-handle {
    display: inline-block;
    margin-right: 8px;
    color: #b5bfb9;
    font-size: 1rem;
    letter-spacing: -.25em;
    cursor: grab;
    user-select: none;
    vertical-align: middle;
}
.drag-handle--inline { margin: 0 2px; cursor: default; }
.table--sortable tbody tr[draggable] { cursor: grab; }
.table--sortable tbody tr.is-dragging { opacity: .45; background: var(--a-tint); }
.table--sortable tbody tr.is-dragging td { border-top: 2px dashed var(--a-green); }

/* ---------- modální okno ---------- */
.modal {
    width: min(100%, 560px);
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: var(--a-r-lg);
    background: var(--a-white);
    color: var(--a-ink);
    box-shadow: var(--a-shadow);
}
.modal::backdrop { background: rgba(15, 38, 27, .45); backdrop-filter: blur(2px); }
.modal__form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.modal__head { display: flex; align-items: center; gap: 14px; padding: 20px 26px 14px; border-bottom: 1px solid var(--a-line); }
.modal__head h2 { margin: 0; flex: 1; }
.modal__close {
    width: 36px; height: 36px; border: 0; border-radius: 50%;
    background: transparent; color: var(--a-soft); font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.modal__close:hover { background: #eef1ef; color: var(--a-ink); }
.modal__body { padding: 22px 26px 6px; overflow-y: auto; }
.modal__body .field:last-child { margin-bottom: 0; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 26px 22px; border-top: 1px solid var(--a-line); }

/* ---------- hlášky ---------- */
.flash { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-radius: var(--a-r); font-weight: 500; margin-bottom: 22px; }
.flash svg { width: 20px; height: 20px; flex: 0 0 auto; }
.flash--success { background: var(--a-tint); color: var(--a-deep); border: 1px solid #cbe8d6; }
.flash--warning { background: #fdefe3; color: #8a4a0f; border: 1px solid #f3d9bf; }
.flash--error { background: #fdecea; color: #8c1d18; border: 1px solid #f6c9c4; }

.empty { text-align: center; padding: 54px 20px; color: var(--a-soft); }
.empty svg { width: 44px; height: 44px; margin-bottom: 14px; opacity: .35; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 20px; }
.filters input, .filters select { font: inherit; padding: 9px 14px; border: 1.5px solid var(--a-line); border-radius: var(--a-r-sm); background: #fff; }
.filters input:focus, .filters select:focus { outline: none; border-color: var(--a-green); }

/* ---------- přihlášení ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login__aside {
    background: var(--a-deep);
    color: #fff;
    padding: 56px;
    display: flex; flex-direction: column; justify-content: space-between;
}
.login__aside h2 { font-family: var(--a-ff-display); font-size: 2.2rem; color: #fff; max-width: 440px; }
.login__aside p { color: rgba(255, 255, 255, .8); max-width: 420px; }
.login__aside ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.login__aside li { display: flex; gap: 11px; align-items: center; font-weight: 500; color: rgba(255, 255, 255, .9); }
.login__aside li::before {
    content: "";
    width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
    background: var(--a-green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.login__panel { display: grid; place-items: center; padding: 40px; background: var(--a-white); }
.login__card { width: min(100%, 400px); }
.login__card h1 { font-size: 1.7rem; margin-bottom: 6px; }
.login__card .muted { color: var(--a-soft); margin-bottom: 26px; font-size: .95rem; }
.login__hint { margin-top: 24px; padding: 15px 18px; background: var(--a-tint); border-radius: var(--a-r); font-size: .86rem; color: var(--a-deep); }

/* ---------- responzivita ---------- */
@media (max-width: 1080px) {
    .grid--form { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 60;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: var(--a-shadow);
    }
    body.sidebar-open .sidebar { transform: none; }
    .sidebar-toggle { display: flex; }
    .admin__content { padding: 22px 18px; }
    .admin__topbar { padding: 14px 18px; }
    .login { grid-template-columns: 1fr; }
    .login__aside { display: none; }
}

/* ---------- jazykové karty v editoru obsahu ---------- */
.langtabs { display: flex; gap: 4px; margin: -6px 0 20px; border-bottom: 2px solid var(--a-line); }
.langtabs__tab {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 16px;
    border: 0; border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    background: none;
    font: inherit; font-size: .9rem; font-weight: 600;
    color: var(--a-soft);
    cursor: pointer;
}
.langtabs__tab:hover { color: var(--a-ink); }
.langtabs__tab.is-active { color: var(--a-green-dark); border-bottom-color: var(--a-green); }
/* tečka ukazuje, jestli se sekce v daném jazyce vůbec zobrazuje */
.langtabs__dot { width: 8px; height: 8px; border-radius: 50%; background: #d6dbd8; }
.langtabs__dot.is-on { background: var(--a-green); }

.langitem { padding: 14px 0; border-top: 1px solid var(--a-line); }
.langitem:first-of-type { border-top: 0; padding-top: 4px; }
.langitem__source { font-size: .8rem; color: var(--a-soft); margin-bottom: 8px; }
.langitem__source::before { content: "Česky: "; font-weight: 600; }

/* česká předloha pod polem překladu */
.langitem__czech {
    border-left: 2px solid var(--a-line);
    padding-left: 10px;
    margin-top: 7px;
    white-space: pre-wrap;
    max-height: 5.5em;
    overflow: auto;
}
