/* === Albánie rodinný plánovač – mobile-first responsive === */
:root {
    --bg: #fafaf7;
    --bg-card: #ffffff;
    --ink: #1f2937;
    --ink-soft: #6b7280;
    --line: #e5e7eb;
    --primary: #dc2626;
    --primary-soft: #fee2e2;
    --accent: #0ea5e9;
    --shadow: 0 4px 16px rgba(15, 23, 42, .08);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, .18);
    --r: 16px;
    --r-sm: 10px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 80px;
}
h1, h2, h3, h4 { margin: 0; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select { font-family: inherit; font-size: inherit; }
a { color: inherit; }

/* === TOPBAR === */
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: #fff;
    box-shadow: var(--shadow);
    padding-top: env(safe-area-inset-top);
}
.topbar-inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px 8px;
    gap: 10px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .flag { font-size: 28px; }
.brand h1 { font-size: 17px; font-weight: 700; line-height: 1.1; }
.brand .sub { font-size: 11px; opacity: .85; }
.who-pick { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.who-pick label { opacity: .85; }
.who-pick select {
    background: rgba(255,255,255,.18);
    color: #fff; border: 1px solid rgba(255,255,255,.3);
    border-radius: 8px; padding: 4px 6px;
}
.who-pick select option { color: #000; }

.tabs { display: flex; padding: 0 8px; gap: 4px; overflow-x: auto; }
.tab {
    padding: 10px 12px;
    font-size: 13px; font-weight: 600;
    color: rgba(255,255,255,.7);
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    flex-shrink: 0;
}
.tab-active { color: #fff; border-bottom-color: #fff; }
.badge {
    background: #fff; color: var(--primary);
    border-radius: 999px; padding: 1px 7px;
    font-size: 11px; font-weight: 700; margin-left: 4px;
}

/* === CAT BAR === */
.cat-bar {
    position: sticky; top: 88px; z-index: 40;
    display: flex; gap: 8px; padding: 10px 12px;
    overflow-x: auto; scrollbar-width: none;
    background: var(--bg-card); border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat {
    --cat-color: #6b7280;
    display: flex; align-items: center; gap: 6px;
    padding: 7px 12px; flex-shrink: 0;
    border-radius: 999px;
    background: #f3f4f6;
    font-size: 13px; font-weight: 500;
    color: var(--ink);
    transition: all .15s;
}
.cat-ico { font-size: 16px; }
.cat-lbl { font-weight: 600; }
.cat-cnt { font-size: 11px; opacity: .65; background: rgba(0,0,0,.06); padding: 1px 6px; border-radius: 999px; }
.cat-active {
    background: var(--cat-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.cat-active .cat-cnt { background: rgba(255,255,255,.2); color: #fff; opacity: 1; }

/* === SEARCH === */
.search-row { padding: 10px 14px 6px; }
#search {
    width: 100%; padding: 12px 14px;
    border: 1px solid var(--line); border-radius: 12px;
    background: var(--bg-card);
    font-size: 15px;
    box-shadow: var(--shadow);
}
#search:focus { outline: none; border-color: var(--primary); }

/* === KATALOG MŘÍŽKA === */
.catalog {
    display: grid; gap: 14px;
    padding: 8px 12px 24px;
    grid-template-columns: 1fr;
}
@media (min-width: 600px) { .catalog { grid-template-columns: 1fr 1fr; padding: 12px; } }
@media (min-width: 900px) { .catalog { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .catalog { grid-template-columns: repeat(4, 1fr); max-width: 1400px; margin: 0 auto; } }

/* === KARTA === */
.card {
    --cat-color: #6b7280;
    background: var(--bg-card);
    border-radius: var(--r);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex; flex-direction: column;
    transition: transform .15s, box-shadow .15s;
    border: 1px solid var(--line);
}
.card.hidden-card { display: none; }
.card:active { transform: scale(.99); }
@media (hover: hover) {
    .card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
}
.card-hero {
    position: relative;
    aspect-ratio: 16 / 10;
    background: #f3f4f6;
    overflow: hidden;
}
.photos {
    display: flex; height: 100%;
    overflow-x: auto; scroll-snap-type: x mandatory;
    scrollbar-width: none;
}
.photos::-webkit-scrollbar { display: none; }
.photo {
    flex: 0 0 100%; width: 100%; height: 100%;
    object-fit: cover; scroll-snap-align: start;
    background: linear-gradient(135deg, #ddd, #f3f4f6);
}
.photos-dots {
    position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 5px;
    background: rgba(0,0,0,.35); border-radius: 999px; padding: 4px 8px;
}
.dot { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.5); }
.dot-active { background: #fff; width: 16px; border-radius: 999px; }

.cat-chip {
    position: absolute; top: 10px; left: 10px;
    background: rgba(255,255,255,.95); color: var(--cat-color);
    padding: 4px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 700;
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
    backdrop-filter: blur(4px);
}
.kids-chip {
    position: absolute; bottom: 10px; right: 10px;
    background: rgba(255,255,255,.95);
    padding: 3px 8px; border-radius: 999px;
    font-size: 11px; letter-spacing: -1px;
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
}

.heart {
    position: absolute; top: 8px; right: 8px;
    width: 42px; height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,.18);
    transition: transform .15s;
}
.heart:active { transform: scale(.9); }
.heart svg { fill: #cbd5e1; transition: fill .2s, transform .2s; }
.heart.is-fav svg { fill: var(--primary); transform: scale(1.15); }
.heart.is-fav { animation: pop .35s ease-out; }
@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

.card-body { padding: 12px 14px 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.card-body h3 { font-size: 16px; font-weight: 700; line-height: 1.25; }
.meta { font-size: 12px; color: var(--ink-soft); }
.card-body p { font-size: 13px; color: #374151; margin: 4px 0 0; line-height: 1.4; }
.hearts-row {
    display: flex; gap: 4px; flex-wrap: wrap; min-height: 18px; margin-top: 4px;
}
.hearts-row .who {
    font-size: 10px; padding: 2px 8px;
    background: var(--primary-soft); color: var(--primary);
    border-radius: 999px; font-weight: 600;
}
.card-actions { display: flex; gap: 6px; margin-top: 10px; }
.btn {
    flex: 1; padding: 8px 10px;
    border-radius: 10px; font-size: 12px; font-weight: 600;
    text-align: center; text-decoration: none;
    background: var(--primary); color: #fff;
}
.btn-ghost {
    background: #f3f4f6; color: var(--ink);
    border: 1px solid var(--line);
}

/* === MAPA === */
.view { animation: fadeIn .2s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.view-map { padding: 0; }
#leaflet-map {
    height: calc(100vh - 150px);
    min-height: 500px;
    width: 100%;
}
.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: var(--shadow-lg); }
.leaflet-popup-content { margin: 0; min-width: 220px; max-width: 280px; }
.popup-card { display: block; }
.popup-card img { width: 100%; height: 120px; object-fit: cover; border-top-left-radius: 12px; border-top-right-radius: 12px; }
.popup-card .pc-body { padding: 10px 12px 12px; }
.popup-card h4 { font-size: 14px; margin: 0 0 4px; }
.popup-card .pc-area { font-size: 11px; color: var(--ink-soft); }
.popup-card .pc-desc { font-size: 12px; color: #374151; margin: 6px 0; }
.popup-card .pc-row { display: flex; gap: 6px; }
.popup-card .pc-row a { flex: 1; padding: 6px; text-align: center; background: #f3f4f6; border-radius: 8px; font-size: 11px; text-decoration: none; font-weight: 600; }
.popup-card .pc-heart { background: var(--primary-soft) !important; color: var(--primary); border: 0; cursor: pointer; }
.popup-card .pc-heart.is-fav { background: var(--primary) !important; color: #fff; }
.cluster-icon {
    background: var(--primary); color: #fff;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 700; box-shadow: 0 2px 8px rgba(0,0,0,.3);
    border: 3px solid #fff;
}

/* === MODAL === */
.modal {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: flex-end; justify-content: center;
    animation: fadeIn .2s;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
.modal-card {
    position: relative; z-index: 1;
    width: 100%; max-width: 600px;
    max-height: 90vh; overflow-y: auto;
    background: #fff; border-radius: 20px 20px 0 0;
    animation: slideUp .25s ease-out;
}
@media (min-width: 600px) {
    .modal { align-items: center; }
    .modal-card { border-radius: 20px; }
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-close {
    position: absolute; top: 12px; right: 12px; z-index: 2;
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,.95); font-size: 16px; font-weight: 700;
    box-shadow: var(--shadow);
}
.modal-body img { width: 100%; height: 220px; object-fit: cover; }
.modal-body .mb-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.modal-body .mb-photos img { height: 110px; }
.modal-body .mb-photos img:first-child { grid-column: 1 / -1; height: 220px; }
.modal-body .mb-content { padding: 16px 20px 20px; }
.modal-body h2 { font-size: 22px; margin-bottom: 6px; }
.modal-body .mb-area { font-size: 13px; color: var(--ink-soft); margin-bottom: 12px; }
.modal-body .mb-desc { font-size: 15px; line-height: 1.55; margin-bottom: 14px; }
.modal-body textarea {
    width: 100%; min-height: 70px; padding: 10px;
    border: 1px solid var(--line); border-radius: 10px;
    font-family: inherit; font-size: 14px; resize: vertical;
}
.modal-body .mb-actions { display: flex; gap: 8px; margin-top: 12px; }
.modal-body .mb-actions .btn { padding: 12px; font-size: 14px; }

/* === FOOTER === */
.foot {
    text-align: center; font-size: 11px; color: var(--ink-soft);
    padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: #fff;
}
.foot-sub { margin-top: 4px; opacity: .7; }
