/* admin.css – administrace obchodu (back-office ve stylu Shoptetu) */

:root {
    --bg: #f2f4f7;
    --panel: #ffffff;
    --line: #e3e6eb;
    --line-strong: #cfd4dc;
    --text: #1d2330;
    --muted: #6b7384;
    --side: #1f2430;
    --side-hover: #2a3140;
    --side-text: #b9c0cd;
    --accent: #1f6feb;
    --accent-hover: #185bc4;
    --accent-soft: #e8f0fd;
    --success: #1f9d55;
    --success-soft: #e3f5ea;
    --warn: #b7791f;
    --warn-soft: #fdf3e1;
    --danger: #d64545;
    --danger-soft: #fdeaea;
    --violet: #6d4fd1;
    --violet-soft: #efebfc;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

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

html, body { margin: 0; }

body {
    font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
[hidden] { display: none !important; }

.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.muted { color: var(--muted); }
.small, small { font-size: 12.5px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: var(--bg); padding: 2px 5px; border-radius: 4px; word-break: break-all; }

/* ---------- Layout ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    flex: none;
    background: var(--side);
    color: var(--side-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand img { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; background: #fff; }
.sidebar-brand span { font-weight: 600; line-height: 1.2; }
.sidebar-brand small { display: block; font-weight: 400; color: var(--side-text); font-size: 12px; }

.sidebar-nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.sidebar-nav a,
.sidebar-foot a,
.sidebar-foot button {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 9px 12px;
    border-radius: 6px;
    color: var(--side-text);
    font: inherit;
    background: none;
    border: 0;
    cursor: pointer;
    text-align: left;
}
.sidebar-nav a:hover,
.sidebar-foot a:hover,
.sidebar-foot button:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: var(--accent); color: #fff; }
.sidebar-nav em {
    margin-left: auto;
    font-style: normal;
    font-size: 11.5px;
    font-weight: 600;
    background: #e8563f;
    color: #fff;
    border-radius: 10px;
    padding: 0 7px;
    line-height: 19px;
}
.sidebar-foot { padding: 8px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.sidebar-foot form { margin: 0; }

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

.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 58px;
    padding: 0 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar-search { flex: 1; max-width: 520px; position: relative; margin: 0; }
.topbar-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar-search input { width: 100%; padding-left: 36px; background: var(--bg); border-color: transparent; }
.topbar-right { margin-left: auto; display: flex; gap: 8px; }
.menu-toggle { display: none; border: 0; background: none; font-size: 22px; cursor: pointer; padding: 4px 8px; }

.content { padding: 24px; max-width: 1440px; width: 100%; }

/* ---------- Page head ---------- */

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.page-head h1 { font-size: 22px; font-weight: 650; }
.page-head p { margin: 4px 0 0; }
.page-head .back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.head-actions form { margin: 0; }

/* ---------- Panels ---------- */

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    margin-bottom: 18px;
}
.panel-flush { padding: 0; overflow: hidden; }
.panel-flush > .panel-head { padding: 14px 20px; margin: 0; border-bottom: 1px solid var(--line); }
.panel-body { padding: 16px 20px; border-top: 1px solid var(--line); }
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}
.panel-head h2 { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.panel-packeta { border-top: 3px solid #ba1b02; }
.empty { padding: 28px 20px; margin: 0; text-align: center; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.detail-side .panel { padding: 16px 18px; }

/* ---------- KPI ---------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    color: var(--text);
    box-shadow: var(--shadow);
}
a.kpi:hover { border-color: var(--accent); text-decoration: none; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi strong { font-size: 24px; font-weight: 650; }
.kpi small { color: var(--muted); }

.todo { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.todo-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--warn-soft);
    color: #7a4f0e;
    border: 1px solid #f3dcb2;
}
.todo-item:hover { text-decoration: none; filter: brightness(0.98); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    background: #f8f9fb;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table-click tbody tr { cursor: pointer; }
.table-click tbody tr:hover td { background: #f7f9fc; }
.table tr.selected td { background: var(--accent-soft) !important; }
.table .check { width: 40px; padding-right: 0; }
.table input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.order-no { font-weight: 600; }
.panel:not(.panel-flush) > .table { margin: 0 -20px -18px; width: calc(100% + 40px); }

.thumb-col { width: 60px; }
.thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; display: block; background: var(--bg); border: 1px solid var(--line); }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* ---------- Badges ---------- */

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
    white-space: nowrap;
    background: var(--bg);
    color: var(--muted);
}
.st-new { background: var(--accent-soft); color: var(--accent); }
.st-processing { background: var(--warn-soft); color: var(--warn); }
.st-ready { background: var(--violet-soft); color: var(--violet); }
.st-shipped { background: #e1f3f8; color: #13748f; }
.st-done { background: var(--success-soft); color: var(--success); }
.st-cancelled { background: var(--danger-soft); color: var(--danger); }
.pay-paid { background: var(--success-soft); color: var(--success); }
.pay-pending { background: #f1f2f5; color: var(--muted); }
.badge-packet { background: #fbe9e6; color: #ba1b02; font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 500; }

/* ---------- Tabs & filters ---------- */

.status-tabs {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line-strong);
    margin-bottom: 16px;
}
.status-tabs a {
    padding: 9px 14px;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    font-weight: 500;
}
.status-tabs a:hover { color: var(--text); text-decoration: none; }
.status-tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.status-tabs em { font-style: normal; font-size: 12px; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 0 7px; margin-left: 4px; }

.filters {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}
.filter-search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.filter-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filter-search input { width: 100%; padding-left: 34px; }

.bulk-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #f8f9fb;
    border-bottom: 1px solid var(--line);
}
.bulk-bar span { color: var(--muted); min-width: 80px; }
.bulk-bar.has-selection { background: var(--accent-soft); }
.bulk-bar.has-selection span { color: var(--accent); font-weight: 600; }

.pager { display: flex; gap: 4px; padding: 12px 16px; border-top: 1px solid var(--line); }
.pager a { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line); color: var(--text); }
.pager a.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Forms ---------- */

input, select, textarea {
    font: inherit;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    padding: 7px 10px;
    min-height: 36px;
    max-width: 100%;
}
textarea { width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.15); }
input[type="checkbox"] { min-height: 0; accent-color: var(--accent); }
form { margin: 0; }
form.inline { display: inline-block; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 500; color: #3a4252; }
.field input, .field select { width: 100%; }
.field-inline { flex-direction: row; align-items: center; gap: 10px; margin: 0; }
.field-inline > span { white-space: nowrap; }
.field-inline select, .field-inline input { width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; }
.inline-form .field { margin: 0; }
.inline-form .grow { flex: 1; }
.check-label { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; }
.hint { color: var(--muted); font-size: 12.5px; margin: -6px 0 14px; }
.field-inline + .hint { margin-top: 8px; margin-bottom: 0; }
.input-num { width: 110px; text-align: right; }
.status-form { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.status-form .check-label { margin: 0; }
.sticky-save { position: sticky; bottom: 16px; }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-strong); border-radius: 22px; cursor: pointer; transition: background 0.15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform 0.15s; }
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::before { transform: translateX(16px); }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font: inherit;
    font-weight: 550;
    padding: 7px 14px;
    min-height: 36px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none !important;
    transition: background 0.12s, border-color 0.12s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(0.95); }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { background: #f5f6f8; }
.btn-danger-ghost { background: #fff; color: var(--danger); border-color: #f0c4c4; }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-small { padding: 3px 10px; min-height: 28px; font-size: 13px; }
.btn-block { width: 100%; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.link { color: var(--accent); font-weight: 500; }

/* ---------- Alerts ---------- */

.alert { padding: 11px 16px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid; }
.alert-success { background: var(--success-soft); border-color: #bfe6cd; color: #146c3b; }
.alert-error { background: var(--danger-soft); border-color: #f3c3c3; color: #9f2a2a; }

/* ---------- Order detail ---------- */

.totals { padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.totals div { display: flex; justify-content: space-between; padding: 3px 0; color: var(--muted); }
.totals .grand { color: var(--text); font-size: 17px; font-weight: 700; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }

.dl { display: grid; grid-template-columns: 105px 1fr; gap: 7px 10px; margin: 0 0 12px; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; word-break: break-word; }
.note-text { margin: 0; background: var(--warn-soft); padding: 10px 12px; border-radius: 6px; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.history li:last-child { border-bottom: 0; }
.history time { color: var(--muted); font-size: 12.5px; margin-right: 8px; }
.packet-form .field { margin-bottom: 10px; }

.cost-list { list-style: none; margin: 0; padding: 0; }
.cost-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.cost-list li:last-child { border-bottom: 0; }
.steps { margin: 0; padding-left: 18px; }
.steps li { margin-bottom: 10px; }
.qr-preview { display: flex; align-items: center; gap: 14px; }
.qr-preview img { border: 1px solid var(--line); border-radius: 6px; }

/* ---------- Stats ---------- */

.bars { display: flex; align-items: flex-end; gap: 10px; height: 220px; overflow-x: auto; padding-top: 18px; }
.bar-col { flex: 1; min-width: 42px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar { width: 100%; max-width: 46px; background: var(--accent); border-radius: 4px 4px 0 0; }
.bar-value, .bar-label { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* ---------- Login ---------- */

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--side); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 12px; padding: 28px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand img { width: 44px; height: 44px; border-radius: 8px; }
.login-brand span { display: block; color: var(--muted); font-size: 13px; }
.login-back { display: block; text-align: center; margin-top: 14px; color: var(--muted); font-size: 13px; }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
    .detail-grid { grid-template-columns: minmax(0, 1fr); }
    .grid-3 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
    .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform 0.2s; }
    .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, 0.35); }
    .menu-toggle { display: block; }
    .topbar { padding: 0 16px; }
    .topbar-right { display: none; }
    .content { padding: 16px; }
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
    .bulk-bar { flex-wrap: wrap; }
    .inline-form { flex-wrap: wrap; }
}
