* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ---- Login modal overlay ---- */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    box-sizing: border-box;
}

.login-form {
    background: #252525;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 280px;
    box-sizing: border-box;
}

.login-form h1 {
    margin: 0 0 8px 0;
    color: #FFD700;
    font-size: 1.4rem;
    text-align: center;
}

.login-form input {
    padding: 10px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #333;
    color: #eee;
    font-size: 0.95rem;
}

.login-form input:focus {
    outline: none;
    border-color: #CD3700;
}

.login-form button {
    padding: 10px;
    border: none;
    border-radius: 4px;
    background: #CD3700;
    color: #FFD700;
    font-weight: 600;
    cursor: pointer;
}

.login-form button:hover {
    background: #FFD700;
    color: #8B0000;
}

/* ---- Top bar with title + upload form ---- */
.topbar {
    background: #8B0000;
    color: #FFD700;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.topbar h1 {
    font-size: 1.1rem;
    margin: 0;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---- Status / results messages ---- */
.status {
    font-size: 0.85rem;
    min-width: 200px;
}

.status.info    { color: #FFD700; }
.status.success { color: #FFD700; }
.status.error   { color: #FF6B6B; }
.status.working { color: #FFD700; }

/* ---- Map fills the rest ---- */
main {
    flex: 1;
    position: relative;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* ---- Side panel ---- */
.side-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 380px;
    height: 100%;
    background: #1a1a1a;
    color: #ddd;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.4);
    transition: transform 0.25s ease;
}

@media (min-width: 769px) {
    .side-panel {
        transform: translateX(0);
    }
    .side-panel.closed {
        transform: translateX(100%);
    }
}

@media (max-width: 768px) {
    .side-panel {
        width: 100%;
        transform: translateX(100%);
    }
    .side-panel.open {
        transform: translateX(0);
    }
}

.side-panel-header {
    display: flex;
    align-items: center;
    background: #8B0000;
    color: #FFD700;
    padding: 10px 14px;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.side-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* ---- Record cards in the side panel ---- */
.record-card {
    background: #252525;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.record-card .row {
    margin: 3px 0;
    font-size: 0.85rem;
}

.record-card .label {
    color: #999;
    display: inline-block;
    width: 70px;
}

.record-card .value {
    color: #eee;
}

.record-card .whatsapp a {
    color: #25D366;
    text-decoration: none;
}

.record-card .whatsapp a:hover {
    text-decoration: underline;
}

.record-card .card-actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
}

.btn-edit {
    cursor: pointer;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #CD3700;
    color: #FFD700;
}

.btn-edit:hover {
    background: #FFD700;
    color: #8B0000;
}

.btn-delete {
    cursor: pointer;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #555;
    color: #FF6B6B;
}

.btn-delete:hover {
    background: #8B0000;
    color: #FF6B6B;
}

/* ---- Edit mode form ---- */
.record-card.editing {
    border-color: #CD3700;
}

.record-card .edit-row {
    margin: 5px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.record-card .edit-row label {
    color: #999;
    width: 70px;
    flex-shrink: 0;
}

.record-card .edit-row input {
    flex: 1;
    background: #333;
    border: 1px solid #555;
    color: #eee;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 0.85rem;
}

.record-card .edit-row input:focus {
    outline: none;
    border-color: #CD3700;
}

.record-card .edit-actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
}

.record-card .edit-actions button {
    cursor: pointer;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.btn-save {
    background: #2E7D32;
    color: #fff;
}

.btn-save:hover {
    background: #388E3C;
}

.btn-cancel {
    background: #555;
    color: #ccc;
}

.btn-cancel:hover {
    background: #666;
}

.edit-coords-hint {
    font-size: 0.75rem;
    color: #81C784;
    margin-top: 4px;
}

/* ---- Menu toggle button in header ---- */
.menu-toggle {
    background: none;
    border: 1px solid #B22222;
    color: #FFD700;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.menu-toggle:hover {
    background: #CD3700;
}

.btn-logout {
    background: none;
    border: 1px solid #B22222;
    color: #FFD700;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.btn-logout:hover {
    background: #FF6B6B;
}

/* ---- Side panel controls ---- */
.panel-controls {
    padding: 10px;
    background: #222;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-upload {
    cursor: pointer;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    background: #CD3700;
    color: #FFD700;
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-upload:hover {
    background: #FFD700;
    color: #8B0000;
}

/* ---- Leaflet popup content ---- */
.leaflet-popup-content .poi-popup {
    min-width: 200px;
}

.leaflet-popup-content .poi-popup h3 {
    margin: 0 0 6px 0;
    font-size: 1rem;
    color: #8B0000;
}

.leaflet-popup-content .poi-popup .row {
    margin: 2px 0;
    font-size: 0.85rem;
}

.leaflet-popup-content .poi-popup .label {
    color: #6b7280;
    display: inline-block;
    width: 70px;
}

.leaflet-popup-content .poi-popup a {
    color: #8B0000;
    text-decoration: none;
}

.leaflet-popup-content .poi-popup a:hover {
    text-decoration: underline;
}

/* ---- Numbered marker: single pin that shows the record count ---- */
.numbered-marker {
    position: relative;
    width: 25px;
    height: 41px;
}

.numbered-marker img {
    display: block;
    width: 25px;
    height: 41px;
}

.numbered-marker .badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: #FFD700;
    color: #8B0000;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border: 1px solid #8B0000;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ---- Red cluster markers (communist theme) ---- */
.marker-cluster-small,
.marker-cluster-small div {
    background-color: rgba(139, 0, 0, 0.6);
}
.marker-cluster-small div { background-color: rgba(205, 55, 0, 0.7); }
.marker-cluster-medium,
.marker-cluster-medium div {
    background-color: rgba(139, 0, 0, 0.6);
}
.marker-cluster-medium div { background-color: rgba(205, 55, 0, 0.7); }
.marker-cluster-large,
.marker-cluster-large div {
    background-color: rgba(139, 0, 0, 0.6);
}
.marker-cluster-large div { background-color: rgba(205, 55, 0, 0.7); }
.marker-cluster { color: #FFD700; }

/* ---- Panel toggle button (mobile, edit mode) ---- */
#panel-toggle {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 1100;
    background: #8B0000;
    color: #FFD700;
    border: none;
    border-radius: 6px;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

#panel-toggle:hover {
    background: #CD3700;
}