/* Szomszed - mobile-first stylesheet */

:root {
    --bg: #f2f4ef;
    --card: #ffffff;
    --text: #21301f;
    --muted: #67735f;
    --line: #e2e6dc;
    --accent: #2e7d46;
    --accent-dark: #226237;
    --accent-soft: #e7f2ea;
    --danger: #c0392b;
    --danger-soft: #fdecea;
    --warn: #b9770e;
    --warn-soft: #fdf3e3;
    --info-soft: #eaf1fb;
    --radius: 14px;
    --nav-height: 62px;
}

* { box-sizing: border-box; }

/* ---------- SVG ikonok (Lucide sprite) ---------- */

.icon {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: inline-block;
    vertical-align: -0.18em;
    flex: 0 0 auto;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 12px);
}

body.guest { padding-bottom: 24px; }

a { color: var(--accent-dark); text-decoration: none; }

img { max-width: 100%; }

/* ---------- Header ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--accent);
    color: #fff;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.topbar .brand {
    font-weight: 700;
    font-size: 18px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar .top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar a { color: #fff; }

.topbar .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    overflow: hidden;
}

.topbar .avatar img { width: 100%; height: 100%; object-fit: cover; }

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

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 12px 12px 24px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    margin: 10px 2px;
}

.page-sub {
    color: var(--muted);
    font-size: 14px;
    margin: -6px 2px 12px;
}

/* ---------- Cards ---------- */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
}

.card.urgent { border-left: 4px solid var(--danger); }
.card.closed { opacity: .72; }

.card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.card-title {
    font-size: 17px;
    font-weight: 700;
    margin: 2px 0 4px;
}

.card-title a { color: var(--text); }

.card-body { font-size: 15px; white-space: pre-line; }

.card-meta {
    color: var(--muted);
    font-size: 13px;
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    align-items: center;
}

.card-images {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    overflow-x: auto;
}

.card-images img {
    height: 110px;
    border-radius: 8px;
    flex: 0 0 auto;
    cursor: zoom-in;
}

/* Fejléckép: a kártya tetejére feszítve, kattintásra teljes méret */
.card-cover {
    margin: -14px -14px 12px;
    cursor: zoom-in;
}

.card-cover img {
    display: block;
    width: 100%;
    height: 190px;
    object-fit: cover;
    object-position: center;
    border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
    background: var(--line);
}

/* Lightbox: teljes képes nézet */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(8, 12, 10, .9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    cursor: zoom-out;
}

.lightbox img {
    max-width: 100%;
    max-height: 94vh;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}

.lightbox .lb-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* ---------- Publikus profil ---------- */

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 26px;
    overflow: hidden;
    flex: 0 0 auto;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
}

.profile-avatar.sm {
    width: 44px;
    height: 44px;
    font-size: 18px;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12.5px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    white-space: nowrap;
}

.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: #2c5c9e; }
.badge.muted { background: #eef0ea; color: var(--muted); }

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    padding: 10px 16px;
    cursor: pointer;
    text-align: center;
    transition: background .15s;
}

.btn:hover { background: var(--accent-dark); }
.btn:disabled { opacity: .55; cursor: default; }

.btn.secondary {
    background: #fff;
    color: var(--accent-dark);
    border: 1px solid var(--accent);
}

.btn.secondary:hover { background: var(--accent-soft); }

.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #96291d; }

.btn.ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
}

.btn.sm { font-size: 13.5px; padding: 6px 12px; border-radius: 8px; }
.btn.block { width: 100%; }

/* ---------- Filter chips ---------- */

.chip-scroll { position: relative; }

.chip-scroll::before,
.chip-scroll::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 2px;
    width: 30px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    z-index: 2;
}

.chip-scroll::before {
    left: 0;
    background: linear-gradient(to right, var(--bg), rgba(242, 244, 239, 0));
}

.chip-scroll::after {
    right: 0;
    background: linear-gradient(to left, var(--bg), rgba(242, 244, 239, 0));
}

.chip-scroll.can-left::before { opacity: 1; }
.chip-scroll.can-right::after { opacity: 1; }

.chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 2px 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    padding: 7px 14px;
    cursor: pointer;
}

.chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

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

.form-group { margin-bottom: 14px; }

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
}

.form-label .optional { color: var(--muted); font-weight: 400; font-size: 12.5px; }

.form-control {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    padding: 11px 12px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text);
}

.form-control:focus {
    outline: 2px solid var(--accent);
    outline-offset: 0;
    border-color: var(--accent);
}

textarea.form-control { min-height: 110px; resize: vertical; }

.form-check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 14.5px;
    margin-bottom: 10px;
}

.form-check input { width: 19px; height: 19px; margin-top: 2px; flex: 0 0 auto; }

.form-error { color: var(--danger); font-size: 13.5px; margin-top: 4px; }

.form-hint { color: var(--muted); font-size: 13px; margin-top: 4px; }

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

.alert {
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 14.5px;
    margin-bottom: 12px;
}

.alert.success { background: var(--accent-soft); color: var(--accent-dark); }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.info { background: var(--info-soft); color: #2c5c9e; }

/* ---------- Bottom navigation ---------- */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: #fff;
    border-top: 1px solid var(--line);
    display: flex;
    height: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
}

.bottom-nav a .ico { font-size: 21px; line-height: 1; }

.bottom-nav a.active { color: var(--accent-dark); }

.bottom-nav a.report-btn .ico {
    background: var(--accent);
    color: #fff;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-top: -18px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .25);
}

/* ---------- Lists / tables ---------- */

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.table-wrap { overflow-x: auto; }

table.admin {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 14px;
}

table.admin th, table.admin td {
    text-align: left;
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

table.admin th { background: #f7f8f4; font-size: 13px; }

/* ---------- Misc ---------- */

.empty {
    text-align: center;
    color: var(--muted);
    padding: 36px 16px;
    font-size: 15px;
}

.empty .ico { font-size: 40px; display: block; margin-bottom: 8px; }

.section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin: 18px 2px 8px;
    font-size: 13px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.stat {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
}

.stat .num { font-size: 26px; font-weight: 800; }
.stat .lbl { font-size: 13px; color: var(--muted); }
.stat.hot { border-color: var(--danger); }
.stat.hot .num { color: var(--danger); }

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.menu-tile {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 14px;
    text-align: center;
    color: var(--text);
    font-weight: 600;
    font-size: 14.5px;
}

.menu-tile .ico { display: block; font-size: 30px; margin-bottom: 8px; }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }

.pagination a, .pagination span {
    padding: 7px 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 14px;
}

.pagination .active span { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- "Ma Lemhényben" mini áttekintő ---------- */

.today-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 12px;
}

.today-card .today-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 8px;
}

.today-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 14px;
}

.today-grid .item {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
    border-radius: 8px;
}

a.today-grid .item:hover,
.today-grid a.item:hover { background: var(--accent-soft); }

.today-grid .num {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent-dark);
    min-width: 26px;
    text-align: center;
}

.today-grid .item.zero .num { color: var(--muted); font-weight: 700; }

.today-grid .lbl {
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.25;
}

/* ---------- Statisztika diagramok ---------- */

.chart-plot {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 190px;
    margin-top: 26px;
    border-bottom: 2px solid var(--line);
}

.chart-grid {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px solid var(--line);
    pointer-events: none;
}

.chart-grid span {
    position: absolute;
    left: 0;
    top: -16px;
    font-size: 11px;
    color: var(--muted);
    background: var(--card);
    padding-right: 4px;
}

.chart-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

.chart-col .val {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 3px;
    white-space: nowrap;
}

.chart-col .bar {
    width: 100%;
    max-width: 44px;
    background: var(--accent);
    border-radius: 4px 4px 0 0;
}

.chart-x {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.chart-x span {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 11.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Vízszintes top-lista sorok (bar table) */
.bar-row { margin-bottom: 10px; }

.bar-row .bar-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 13.5px;
    margin-bottom: 3px;
}

.bar-row .bar-head .name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-row .bar-head .num { flex: 0 0 auto; font-weight: 700; }

.bar-row .bar-track {
    height: 12px;
    border-radius: 4px;
    background: var(--bg);
}

.bar-row .bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    min-width: 2px;
}

.chart-tip {
    position: fixed;
    z-index: 90;
    background: var(--text);
    color: #fff;
    font-size: 12.5px;
    padding: 6px 10px;
    border-radius: 8px;
    pointer-events: none;
    display: none;
    max-width: 240px;
}

/* Honeypot: képernyőn kívül, de nem display:none (azt a botok kihagyják) */
.hp-wrap {
    position: absolute;
    left: -9999px;
    top: -9999px;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

/* ---------- Beállítás segéd (telepítés + értesítések) ---------- */

.setup-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 12px;
    font-size: 14.5px;
}

.setup-banner-actions { display: flex; gap: 8px; flex: 0 0 auto; }

.status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 600;
}

.status-item .state { font-size: 14px; font-weight: 700; flex: 0 0 auto; }
.status-item .state.ok { color: var(--accent-dark); }
.status-item .state.missing { color: var(--warn); }

.setup-steps {
    margin: 8px 0 0;
    padding-left: 24px;
    font-size: 16px;
    line-height: 1.65;
}

.setup-steps li { margin-bottom: 10px; }

.btn.xl {
    font-size: 17px;
    padding: 14px 20px;
}

.guest-wrap {
    max-width: 440px;
    margin: 0 auto;
    padding: 28px 16px;
}

.guest-logo {
    text-align: center;
    margin-bottom: 18px;
}

.guest-logo .mark {
    width: 68px;
    height: 68px;
    border-radius: 20px;
    background: var(--accent);
    color: #fff;
    font-size: 34px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.guest-logo .logo-img {
    height: 86px;
    width: auto;
    margin-bottom: 10px;
}

.guest-logo h1 { margin: 0; font-size: 24px; }
.guest-logo p { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; }

.divider { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

/* Szekció navigáció (admin): aláhúzásos tab sor */
.tabbar {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-bottom: 2px solid var(--line);
    margin-bottom: 14px;
}

.tabbar::-webkit-scrollbar { display: none; }

.tabbar a {
    flex: 0 0 auto;
    padding: 9px 11px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
}

.tabbar a.active {
    color: var(--accent-dark);
    border-bottom-color: var(--accent);
}

/* Szűrő sor: kompakt lenyíló */
.filter-select {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.filter-select label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--muted);
    flex: 0 0 auto;
}

.filter-select select {
    flex: 1;
    max-width: 320px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    padding: 8px 12px;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text);
}

.admin-nav a {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    padding: 6px 13px;
}

.admin-nav a.active { background: var(--text); border-color: var(--text); color: #fff; }

details.moderation-form { margin-top: 8px; }
details.moderation-form summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--accent-dark); }

@media (min-width: 700px) {
    .container { max-width: 720px; }
    .stat-grid { grid-template-columns: repeat(3, 1fr); }
    .menu-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Egeres (nem érintőképernyős) eszközön nincs swipe:
   a sorok bármilyen ablakszélességnél tördelve mutatnak mindent */
@media (hover: hover) and (pointer: fine) {
    .chips, .tabbar { flex-wrap: wrap; overflow-x: visible; }
    .chip-scroll::before, .chip-scroll::after { display: none; }
}
