/* ===== PKNK Pointing Map styles ===== */
:root {
    --bg: #0f172a;
    --panel: #ffffff;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --border: #e2e8f0;
    --danger: #dc2626;
    --ok: #16a34a;
    --shadow: 0 2px 10px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: #0f172a;
}


#app {
    display: grid;
    grid-template-columns: 360px 1fr;
    height: 100vh;
}

/* ---- Sidebar ---- */
#sidebar {
    background: #f8fafc;
    border-right: 1px solid var(--border);
    padding: 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-header h1 {
    font-size: 1.35rem;
    margin: 0 0 4px;
}

.muted { color: var(--muted); font-size: .85rem; margin: 0; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 9px 14px;
    font-size: .9rem;
    cursor: pointer;
    transition: background .15s, border-color .15s, opacity .15s;
    /* allow <a> elements styled as buttons */
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; border-color: var(--border); color: #334155; }
.btn-ghost:hover { background: #f1f5f9; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---- Form card ---- */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.card h2 { margin: 0 0 4px; font-size: 1rem; }

label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: #334155; }

input, select, textarea {
    font: inherit;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(37, 99, 235, .35);
    border-color: var(--primary);
}
textarea { resize: vertical; }

.coords {
    display: flex;
    justify-content: space-between;
    font-size: .8rem;
    color: var(--muted);
    background: #f1f5f9;
    border-radius: 8px;
    padding: 8px 10px;
}

.form-actions { display: flex; gap: 8px; }

.msg { font-size: .82rem; margin: 0; min-height: 1em; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--danger); }

/* ---- Point list ---- */
.list-section h2 { font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.badge {
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    font-size: .72rem;
    padding: 2px 9px;
}

.point-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.point-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    cursor: pointer;
    transition: box-shadow .15s, border-color .15s;
}
.point-item:hover { box-shadow: var(--shadow); border-color: #cbd5e1; }
.point-item .pi-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.point-item .pi-title { font-weight: 600; font-size: .92rem; }
.point-item .pi-cat {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--primary);
    background: #eff6ff;
    border-radius: 6px;
    padding: 2px 7px;
}
.point-item .pi-desc { font-size: .8rem; color: var(--muted); margin: 4px 0 0; }
.point-item .pi-meta { font-size: .72rem; color: #94a3b8; margin-top: 6px; display: flex; justify-content: space-between; }
.pi-actions { display: flex; gap: 10px; }
.pi-del,
.pi-edit {
    border: none;
    background: none;
    cursor: pointer;
    font-size: .75rem;
    padding: 0;
}
.pi-del { color: var(--danger); }
.pi-edit { color: var(--primary); }
.pi-del:hover, .pi-edit:hover { text-decoration: underline; }


.empty { color: var(--muted); font-size: .85rem; padding: 8px 0; }

.sidebar-footer { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); }

/* ---- Colour picker ---- */
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type="color"] {
    width: 44px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}
.color-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--border);
    cursor: pointer;
    padding: 0;
}
.swatch:hover { transform: scale(1.12); }

/* Coloured dot beside each saved point in the list */
.pi-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

/* ---- Map ---- */
#map { height: 100%; width: 100%; }

/* ---- Pulsing marker icon ---- */
.pulse-marker {
    position: relative;
    display: block;
    width: 34px;
    height: 34px;
}
.pulse-marker .pulse-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    background: var(--pulse-color, #2563eb);
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
    z-index: 2;
    /* Centre the initial letter */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    text-transform: uppercase;
}
.pulse-marker .pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    background: var(--pulse-color, #2563eb);
    border-radius: 50%;
    opacity: .55;
    z-index: 1;
    animation: pknk-pulse 1.6s ease-out infinite;
}
@keyframes pknk-pulse {
    0%   { transform: scale(0.7); opacity: .55; }
    70%  { transform: scale(2.2); opacity: 0; }
    100% { transform: scale(2.2); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .pulse-marker .pulse-ring { animation: none; opacity: 0; }
}



/* Make Leaflet controls/popups use Inter too */
.leaflet-container,
.leaflet-control,
.leaflet-popup-content {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* Current zoom level shown between the +/- buttons */
.leaflet-control-zoom .zoom-level {
    display: block;
    width: 30px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    background: #fff;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    border-bottom: 1px solid #ccc;
    user-select: none;
}



.leaflet-popup-content { font-size: .85rem; line-height: 1.4; }
.popup-title { font-weight: 600; display: block; margin-bottom: 4px; }
/* Category shown as a coloured pill (uses the shared .badge styles too) */
.popup-cat {
    display: inline-block;
    font-size: .66rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}


/* ---- Read-only mode: hide all editing controls ---- */
body.is-readonly [data-role="edit-only"] { display: none !important; }

/* Read-only: map only, no sidebar */
body.is-readonly #sidebar { display: none; }
body.is-readonly #app { grid-template-columns: 1fr; }


/* ---- Embed mode: tighter, fits nicely inside an iframe ---- */
body.is-embed { font-size: 14px; }
body.is-embed #app { grid-template-columns: 300px 1fr; height: 100vh; }
body.is-embed #sidebar { padding: 12px; gap: 12px; }
body.is-embed .sidebar-header h1 { font-size: 1.1rem; }

/* Read-only embed: still map-only (override embed grid) */
body.is-readonly.is-embed #app { grid-template-columns: 1fr; }


/* ---- Responsive ---- */
@media (max-width: 760px) {
    #app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    #sidebar { max-height: 45vh; }
    body.is-embed #app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
}


