* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    color: #1f2937;
    background: #f3f4f6;
}

header {
    background: #1e3a8a;
    color: #fff;
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.auth-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.auth-status {
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
}

.auth-status.auth-anonymous {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.auth-status.auth-authenticated {
    background: #16a34a;
    color: #fff;
}

.auth-area button {
    padding: 0.3rem 0.7rem;
    border: 0;
    border-radius: 4px;
    background: #f3f4f6;
    color: #1f2937;
    cursor: pointer;
    font-weight: 500;
}

.auth-area button:hover { background: #e5e7eb; }

/* Login modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal[hidden] { display: none; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-card {
    position: relative;
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    width: 320px;
    max-width: 90vw;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-card h2 {
    margin: 0 0 1rem 0;
    color: #1e3a8a;
    font-size: 1.1rem;
}

.modal-card label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0.6rem 0 0.2rem;
}

.modal-card input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.95rem;
}

.modal-card .form-buttons {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.modal-card .form-buttons button {
    padding: 0.5rem 1rem;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.modal-card .form-buttons button[type="submit"] {
    background: #3b82f6;
    color: #fff;
}

.modal-card .form-buttons button[type="submit"]:hover { background: #2563eb; }

.modal-card .form-buttons button[type="button"] {
    background: #e5e7eb;
    color: #1f2937;
}

#login-status {
    margin: 0.6rem 0 0;
    min-height: 1.2em;
    font-size: 0.85rem;
    color: #dc2626;
}

#login-status.success { color: #15803d; }

/* Disabled stav formuláře pro nepřihlášené */
#point-form.locked {
    opacity: 0.55;
    pointer-events: none;
}

/* Tlačítko stylované jako odkaz - používá se např. pro "načíst z mapy" u adresy */
.link-btn {
    background: none;
    border: none;
    color: #2563eb;
    cursor: pointer;
    font-size: 0.78rem;
    padding: 0 0 0 0.4rem;
    text-decoration: underline;
}
.link-btn:hover { color: #1d4ed8; }
.link-btn:disabled { color: #9ca3af; cursor: wait; text-decoration: none; }

.toolbar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.toolbar input[type="search"] {
    flex: 1;
    min-width: 180px;
    padding: 0.4rem 0.6rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
}

.toolbar select {
    padding: 0.4rem 0.6rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
}

.toolbar button {
    padding: 0.4rem 0.9rem;
    border: 0;
    border-radius: 4px;
    background: #3b82f6;
    color: #fff;
    cursor: pointer;
}

.toolbar button:hover { background: #2563eb; }

.hint {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-left: auto;
}

main {
    display: flex;
    height: calc(100% - 96px);
}

#map {
    flex: 1;
    height: 100%;
}

#sidebar {
    width: 380px;
    max-width: 42%;
    background: #fff;
    border-left: 1px solid #e5e7eb;
    padding: 1rem;
    overflow-y: auto;
}

#sidebar h2 {
    font-size: 1rem;
    margin: 1rem 0 0.5rem 0;
    color: #1e3a8a;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.25rem;
}

#sidebar h2:first-of-type { margin-top: 0; }

form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.6rem;
    margin-bottom: 0.2rem;
}

form input, form textarea, form select {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    background: #fff;
}

form textarea { resize: vertical; }

.form-row {
    display: flex;
    gap: 0.5rem;
}

.form-row > div {
    flex: 1;
}

.muted {
    display: block;
    color: #6b7280;
    font-size: 0.78rem;
    margin-top: 0.15rem;
}

.form-buttons {
    margin-top: 0.8rem;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.form-buttons button {
    padding: 0.45rem 0.9rem;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    background: #3b82f6;
    color: #fff;
    font-weight: 500;
}

.form-buttons button:hover { background: #2563eb; }
.form-buttons button.danger { background: #dc2626; }
.form-buttons button.danger:hover { background: #b91c1c; }

#btn-clear { background: #6b7280; }
#btn-clear:hover { background: #4b5563; }

#form-status {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    min-height: 1.2em;
}

#form-status.error { color: #dc2626; }
#form-status.success { color: #15803d; }

.legend {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
}

.legend li {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
}

.legend .swatch {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid #1f2937;
    flex-shrink: 0;
}

#points-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#points-list li {
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    margin-bottom: 0.4rem;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

#points-list li:hover { background: #f1f5f9; }

#points-list .li-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    margin-top: 2px;
}

#points-list .li-body { flex: 1; min-width: 0; }

#points-list li .pt-name {
    font-weight: 600;
    color: #1e3a8a;
}

#points-list li .pt-coords {
    font-size: 0.8rem;
    color: #6b7280;
    font-family: monospace;
}

#points-list li .pt-desc {
    font-size: 0.85rem;
    color: #374151;
    margin-top: 0.2rem;
}

#points-list li .pt-type {
    font-size: 0.75rem;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

#points-list li .pt-address {
    font-size: 0.8rem;
    color: #374151;
    margin-top: 0.15rem;
    font-style: italic;
}

/* Custom marker (divIcon) styling - removes Leaflet's default white box */
.mp-marker { background: transparent !important; border: 0 !important; }
.mp-marker svg { display: block; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3)); }
.mp-marker img.custom-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    background: #fff;
    object-fit: cover;
}

@media (max-width: 700px) {
    main { flex-direction: column; }
    #sidebar { width: 100%; max-width: none; height: 50%; border-left: 0; border-top: 1px solid #e5e7eb; }
    #map { height: 50%; }
    .hint { display: none; }
}
