/* Panel administracyjny - korzysta ze zmiennych i przycisków z css/site.css */

.admin-bar { background: var(--surface); border-bottom: 1px solid var(--line); }
.admin-bar-inner { display: flex; align-items: center; gap: 24px; min-height: 60px; flex-wrap: wrap; }
.admin-bar .logo small { font: 500 .75rem var(--sans); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-left: 4px; }
.admin-nav { display: flex; gap: 4px; flex: 1; }
.admin-nav a { padding: .45rem .9rem; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; }
.admin-nav a:hover { color: var(--text); background: var(--tint); }
.admin-nav a.is-active { background: var(--chip-bg); color: var(--chip-text); }
.admin-user { display: flex; align-items: center; gap: 16px; font-size: .9rem; }
.admin-user a { color: var(--muted); text-decoration: none; }
.admin-user a:hover { color: var(--text); }
.admin-user form { margin: 0; }

.admin-main { padding-top: 32px; padding-bottom: 64px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-head h1 { margin: 0; font-size: 1.9rem; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

.notice { padding: 12px 16px; border-radius: 12px; margin: 0 0 20px; font-weight: 500; }
.notice-success { background: var(--success-bg); color: var(--success-text); }
.notice-error { background: var(--error-bg); color: var(--error-text); }

.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
.link-button:hover { color: var(--text); text-decoration: underline; }
.link-danger { color: var(--error-text); }
.link-danger:hover { color: var(--error-text); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--tint); }
.chip-muted { background: var(--tint); color: var(--muted); margin-left: 6px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Tabela */
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.admin-table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: var(--tint); }
.row-title { color: var(--text); font-weight: 600; text-decoration: none; }
.row-title:hover { color: var(--primary); text-decoration: underline; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions a, .row-actions form { display: inline; margin-left: 14px; font-size: .9rem; }
.row-actions a { color: var(--muted); text-decoration: none; }
.row-actions a:hover { color: var(--text); text-decoration: underline; }

/* Formularze */
.login-box { max-width: 400px; margin: 40px auto; padding: 32px; }
.login-box h1 { margin: 0 0 20px; font-size: 1.6rem; }
.login-box .field { margin-bottom: 16px; }
.admin-form { padding: 28px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-wide { grid-column: 1 / -1; }
.field > label, .field > span { font-weight: 600; font-size: .9rem; }
.req { color: var(--accent); }
.field input, .field select, .field textarea {
    width: 100%;
    padding: .7rem .9rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    font: 400 1rem/1.5 var(--sans);
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--error-text); }
.field-error { margin: 0; color: var(--error-text); font-size: .85rem; font-weight: 500; }
.field-help { margin: 0; color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.form-actions { display: flex; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }

@media (max-width: 720px) {
    .admin-nav { order: 3; flex-basis: 100%; overflow-x: auto; }
    .admin-user { margin-left: auto; }
    .admin-form { padding: 20px 16px; }

    /* Tabela jako karty na telefonie */
    .admin-table thead { display: none; }
    .admin-table tr { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); }
    .admin-table td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; }
    .admin-table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .85rem; }
    .admin-table td:first-child { display: block; padding-bottom: 6px; }
    .admin-table td:first-child::before { content: none; }
    .row-actions { justify-content: flex-start; padding-top: 8px !important; }
    .row-actions a:first-child { margin-left: 0; }
}

/* Zdjęcia */
.photos-field { border: 0; padding: 0; margin: 0; min-width: 0; }
.photos-field legend { font-weight: 600; font-size: .9rem; padding: 0; margin-bottom: 6px; }
.photo-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo-item { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; }
.photo-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--tint); }
.photo-item label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 500; }
.photo-item input { width: auto; accent-color: var(--primary); }
.photo-item:has(.photo-remove input:checked) img { opacity: .35; }
.photo-remove { color: var(--error-text); }
.photo-add { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; cursor: pointer; }
.photos-field:has(#f-photos:focus-visible) .photo-add .btn { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Właściciele i akceptacja wpisów */
.nav-badge { display: inline-grid; place-items: center; min-width: 1.35em; height: 1.35em; padding: 0 .35em; margin-left: 2px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1; }
.chip-status { margin-left: 6px; font-size: .78rem; }
.chip-pending, .chip-changes { background: #fdecc8; color: #7a4a00; }
.chip-rejected { background: var(--error-bg); color: var(--error-text); }
.chip-published { background: var(--success-bg); color: var(--success-text); }
@media (prefers-color-scheme: dark) {
    .chip-pending, .chip-changes { background: rgba(245, 158, 11, .18); color: #fcd34d; }
}
.row-owner { margin-top: 4px; font-size: .85rem; color: var(--muted); }
.row-owner a { color: inherit; }
.review-box { margin: 0 0 24px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--tint); }
.review-box p { margin: 0 0 6px; }
.review-pending, .review-changes { border-color: #f0c36d; }
.review-rejected { border-color: var(--error-text); }
.review-reject { margin-top: 10px; }
.review-reject summary { cursor: pointer; color: var(--error-text); font-weight: 600; }
.review-reject .field { margin: 10px 0; max-width: 520px; }
.owner-card { padding: 20px 24px; margin-bottom: 28px; }
.owner-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 24px; margin: 0 0 18px; }
.owner-facts dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.owner-facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.owner-actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 10px; }
.owner-actions form { margin: 0; }

/* Konto właściciela na stronie publicznej */
.account-page { padding-top: 32px; padding-bottom: 32px; }
.account-box { max-width: 460px; margin: 24px auto; padding: 32px; }
.account-box h1 { margin: 0 0 8px; font-size: 1.8rem; }
.account-box .field { margin-bottom: 16px; }
.account-box .switch { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: .95rem; }
.account-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.account-head h1 { margin: 0; }
.account-section { margin-top: 32px; }
.account-section .admin-head h2 { margin: 0; }
.status-note { margin: 4px 0 0; font-size: .85rem; color: var(--error-text); }
.field label.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; cursor: pointer; }
.field label.check input { width: auto; margin-top: 4px; accent-color: var(--primary); }
.owner-delete { margin: 6px 0 10px; }
.owner-delete summary { cursor: pointer; color: var(--error-text); font-weight: 600; }
.owner-delete form { margin-top: 12px; padding: 16px; border: 1px solid var(--error-text); border-radius: 14px; max-width: 620px; }
.owner-delete fieldset { border: 0; padding: 0; margin: 0 0 14px; }
.owner-delete legend { font-weight: 600; margin-bottom: 10px; }
.delete-option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; cursor: pointer; }
.delete-option input { margin-top: 5px; accent-color: var(--error-text); }
.delete-option:has(input:disabled) { opacity: .55; cursor: default; }

/* Statystyki */
.range-switch { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--tint); }
.range-switch a { padding: .35rem .9rem; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; }
.range-switch a:hover { color: var(--text); }
.range-switch a.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

.stats-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stats-tile { position: relative; padding: 18px 20px; overflow: hidden; }
.stats-tile h2, .stats-section h2 { margin: 0 0 8px; font: 600 .78rem var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stats-tile p { margin: 0; }
.stats-big { font: 700 2.2rem/1.15 var(--sans); color: var(--text); }
.stats-big span { font-size: .95rem; font-weight: 500; color: var(--muted); }
.stats-sub { margin-top: 4px !important; font-size: .85rem; color: var(--muted); }
.delta { font-weight: 700; color: var(--muted); }
.delta-up { color: var(--success-text); }
.delta-down { color: var(--error-text); }
.spark-wrap { position: relative; height: 36px; margin-top: 12px; }
.spark { display: block; width: 100%; height: 100%; overflow: visible; }
.spark polyline { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; opacity: .7; }
.spark-dot { position: absolute; right: -4px; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 2px var(--surface); }

.stats-section { padding: 20px; margin-bottom: 20px; min-width: 0; }
.stats-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 20px; }

/* Wykres dzienny: słupki = odwiedzający, linia = wyświetlenia, wspólna oś */
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.chart-head h2 { margin: 0; }
.chart-legend { display: flex; gap: 18px; margin: 0; padding: 0; list-style: none; font-size: .85rem; color: var(--muted); }
.chart-legend li { display: flex; align-items: center; gap: 6px; }
.key-bar { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--primary); }
.key-line { display: inline-block; width: 14px; height: 2px; border-radius: 1px; background: var(--accent); vertical-align: middle; }
.chart { --axis: 44px; position: relative; padding-left: var(--axis); }
.chart-grid { position: absolute; inset: 0 0 24px var(--axis); pointer-events: none; }
.chart-gridline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.chart-gridline span { position: absolute; right: calc(100% + 8px); top: -.6em; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-plot { position: relative; display: grid; grid-template-columns: repeat(var(--days), 1fr); height: 240px; }
.chart-line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 1; }
.chart-line polyline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-col { position: relative; display: flex; align-items: flex-end; justify-content: center; padding: 0 1px; outline: none; cursor: default; }
.chart-col:hover, .chart-col:focus-visible { background: color-mix(in srgb, var(--tint) 70%, transparent); }
.chart-col:focus-visible { box-shadow: inset 0 0 0 2px var(--primary); border-radius: 4px; }
.chart-bar { width: 100%; max-width: 24px; min-height: 1px; border-radius: 4px 4px 0 0; background: var(--primary); }
.chart-col:hover .chart-bar, .chart-col:focus-visible .chart-bar { background: var(--primary-hover); }
.chart-dot { display: none; position: absolute; left: 50%; width: 10px; height: 10px; margin: 0 0 -5px -5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); z-index: 2; }
.chart-col:hover .chart-dot, .chart-col:focus-visible .chart-dot { display: block; }
.chart-tip { position: absolute; top: -8px; z-index: 3; display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: .85rem; color: var(--muted); white-space: nowrap; pointer-events: none; }
.chart-tip strong { color: var(--text); }
.chart-tip b { color: var(--text); }
.chart-axis { display: grid; grid-template-columns: repeat(var(--days), 1fr); height: 24px; border-top: 1px solid var(--muted); }
.chart-axis span { position: relative; font-size: .75rem; color: var(--muted); white-space: nowrap; display: flex; justify-content: center; padding-top: 6px; overflow: visible; }
.chart-axis span:last-child { justify-content: flex-end; }

/* Listy z poziomymi słupkami */
.bar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.bar-list-label { font-size: .92rem; font-weight: 600; overflow-wrap: anywhere; }
.bar-list-label a { color: var(--text); text-decoration: none; }
.bar-list-label a:hover { color: var(--primary); text-decoration: underline; }
.bar-list-note { font-weight: 400; font-size: .8rem; color: var(--muted); }
.bar-list-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.bar-list-track { flex: 1; height: 10px; border-radius: 0 4px 4px 0; }
.bar-list-track span { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--primary); }
.bar-list-value { min-width: 3ch; text-align: right; font-size: .9rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.stats-details { margin-top: 14px; }
.stats-details summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.stats-note { font-size: .85rem; max-width: 80ch; }
.stat-cell { white-space: nowrap; }
.stat-cell small { display: block; color: var(--muted); font-size: .8rem; }
