:root {
    --primary: #2563eb; /* Moderní modrá */
    --primary-dark: #1e40af;
    --secondary: #f3f4f6;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --danger: #ef4444;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    overflow: hidden; /* Zabrání scrollování stránky, scroluje jen mapa */
}

/* MAPA NA POZADÍ */
#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

/* === OPRAVA 1: Skrytí vlaječky Leaflet === */
.leaflet-attribution-flag {
    display: none !important;
}

/* PLOVOUCÍ PANEL */
.floating-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 380px;
    max-height: 90vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    transition: transform 0.3s ease-in-out;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-main);
    font-weight: 700;
}

/* VYHLEDÁVÁNÍ */
.search-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group {
    display: flex;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

#search-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-right: none;
    border-radius: 8px 0 0 8px;
    font-size: 0.95rem;
    outline: none;
}

#btn-search {
    padding: 0 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
}

.btn-icon-text {
    background: transparent;
    border: 1px solid #e5e7eb;
    padding: 8px;
    border-radius: 8px;
    color: var(--text-main);
    font-weight: 500;
    cursor: pointer;
    text-align: center;
}

.btn-icon-text:hover { background: #f9fafb; }

/* VÝSLEDKY GRID */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-card {
    background: var(--secondary);
    padding: 12px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-card.primary {
    grid-column: span 2; /* Plocha přes celou šířku */
    background: #eff6ff;
    border: 1px solid #dbeafe;
}

.stat-card.primary .stat-value { color: var(--primary); font-size: 1.8rem; }
.stat-card.primary .stat-label { color: var(--primary-dark); }

.stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 1.2rem; font-weight: 700; color: var(--text-main); }
.stat-unit { font-size: 0.8rem; color: var(--text-muted); }

/* AKCE */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.export-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn {
    padding: 10px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-secondary { background: var(--text-main); color: white; }
.btn-secondary:hover { background: black; }

.btn-outline-danger {
    background: transparent;
    border: 1px solid #fecaca;
    color: var(--danger);
}
.btn-outline-danger:hover { background: #fef2f2; }

/* REKLAMA */
.ad-container {
    margin-top: auto;
    text-align: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 10px;
}
.ad-label { font-size: 0.6rem; color: #94a3b8; display: block; margin-bottom: 4px; }
.ad-slot { min-height: 80px; display: flex; align-items: center; justify-content: center; color: #cbd5e1; font-weight: bold; }

/* MOBILNÍ PRVKY */
.mobile-toggle-btn {
    display: none; /* Na PC skryté */
    position: absolute;
    bottom: 20px;
    /* === OPRAVA 4: Přesunuto vlevo, aby nepřekáželo === */
    left: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    font-size: 1.2rem;
    z-index: 1001;
    cursor: pointer;
}

.mobile-only { display: none; }

/* COOKIE TOAST */
.cookie-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius); /* Sjednocení s designem */
    display: flex;
    flex-direction: column; /* Upraveno pro lepší layout */
    align-items: center;
    gap: 12px;
    z-index: 9999;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    font-size: 0.9rem;
    width: 90%;
    max-width: 450px;
    box-sizing: border-box;
    text-align: center;
}

/* === ZMĚNA 2: Tlačítka pro cookie lištu === */
.cookie-buttons {
    display: flex;
    gap: 10px;
    width: 100%;
}

.btn-small-primary,
.btn-small-outline {
    flex: 1;
    background: var(--primary);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-small-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}


/* RESPONZIVITA (Mobil) */
@media (max-width: 768px) {
    .floating-panel {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        transform: translateY(100%); /* Výchozí stav: skryto dole */
        padding-top: 60px; /* Místo pro křížek */
        /* === OPRAVA 3: Prevence přetečení === */
        box-sizing: border-box;
    }

    .floating-panel.active {
        transform: translateY(0);
    }

    .mobile-toggle-btn {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .mobile-only {
        display: block;
    }
    
    /* === ZMĚNA 3: Zobrazení tlačítka na mobilu === */
    #btn-show-map.mobile-only {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        margin-top: 8px; /* Odsazení */
    }

    .close-btn {
        position: absolute;
        top: 20px;
        right: 20px;
        background: transparent;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        padding: 10px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr; /* Na mobilu pod sebou pro lepší čitelnost */
    }
    
    .cookie-toast {
        bottom: 10px;
        left: 10px;
        right: 10px;
        width: auto;
        transform: none;
    }
}

/* === STYL PRO LABEL S PLOCHOU NA MAPĚ (OPRAVENO) === */

/* Cílíme přímo na kontejner L.divIcon */
.area-label {
    /* Ujistíme se, že kontejner je inline-block pro správné rozměry */
    display: inline-block; 
    /* KRITICKÁ OPRAVA: Centrování popisku na bod. 
       -50% posune popisek o polovinu jeho šířky/výšky doleva/nahoru */
    transform: translate(-50%, -50%); 
    font-family: 'Inter', sans-serif;
    text-align: center;
    white-space: nowrap; /* ZMĚNA: Zabrání zalomení textu (jednorádkový) */
}

/* Styl pro samotný text plochy (SPAN) */
.area-label .label-area {
    font-size: 1.0rem;
    font-weight: 700;
    color: #ffffff;
}

/* === KRITICKÁ OPRAVA: Stabilizace HTML elementů pro html2canvas === */
/* Třídy, které Leaflet používá pro markery (Div Icon) a SVG (Polygon) */
.leaflet-pane.leaflet-marker-pane,
.leaflet-pane.leaflet-overlay-pane {
    /* Toto by mělo zabránit grafickým artefaktům a bílým okrajům při snímání */
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
}