*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: system-ui, sans-serif;
    background: #363d35;
    color: #f0f0f0;
}

/* Map fills the viewport */
#map {
    position: fixed;
    inset: 0;
    z-index: 0;
}

/* ── Map chip ── */
#map-chip {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    background: #5aaa6e;
    color: #1a1a1a;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    transition: opacity 0.2s ease;
}
#map-chip:hover { background: #7fcfaa; }

#map-hint {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    background: rgba(28, 33, 27, 0.92);
    color: #ccc;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 20px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    pointer-events: none;
}

.pin-private-chip {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid #c8a030;
    color: #c8a030;
    margin-bottom: 10px;
}

.access-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    margin-bottom: 10px;
}
.access-chip--public   { border: 1px solid #4a9f6a; color: #4a9f6a; }
.access-chip--viewable { border: 1px solid #a08030; color: #b09040; }
.access-chip--private  { border: 1px solid #8a4040; color: #b06060; }
.access-chip--unknown  { border: 1px solid #555; color: #888; }

/* ── Nav ── */
#nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 48px;
    background: #252b24;
    border-top: 1px solid #1e251d;
}

.nav-btn {
    background: none;
    border: none;
    color: #aaa;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 8px 16px;
}

.nav-logo {
    display: none;
}

.nav-btn:hover, .nav-btn.active {
    color: #fff;
}

.nav-btn--create {
    font-size: 1.8rem;
    color: #5aaa6e;
    line-height: 1;
}

/* ── Panel — mobile (bottom sheet) ── */
#panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 48px;
    z-index: 10;
    background: #363d35;
    border-top: 1px solid #2e352d;
    border-radius: 12px 12px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: calc(50vh - 48px);
    display: flex;
    flex-direction: column;
}

#panel.open {
    transform: translateY(0);
}

#panel-handle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px 4px;
    cursor: pointer;
    user-select: none;
    touch-action: none;
}

.panel-logo-text {
    font-family: 'Lato', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    opacity: 0.75;
}
.panel-logo-loci  { color: #7ec870; }
.panel-logo-earth { color: #5bb8d8; }

#btn-handle-logout {
    background: none;
    border: none;
    font-size: 0.7rem;
    color: #5bb8d8;
    opacity: 0.75;
    cursor: pointer;
    padding: 0;
    font-family: 'Lato', sans-serif;
}

#panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px 12px;
}

.panel-nav {
    padding: 4px 0 8px;
}

.panel-back-btn {
    background: none;
    border: none;
    color: #7ec870;
    font-size: 0.875rem;
    cursor: pointer;
    padding: 10px 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* ── Panel — desktop (side panel) ── */
@media (min-width: 768px) {
    #panel {
        top: 56px;
        bottom: 0;
        right: auto;
        left: 0;
        width: 360px;
        border-top: none;
        border-right: 1px solid #2e352d;
        border-radius: 0;
        max-height: none;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    #panel.open {
        transform: translateX(0);
    }

    #panel-handle {
        display: none;
    }

    #panel-content {
        padding-top: 16px;
    }

    #nav {
        top: 0;
        bottom: auto;
        left: 0;
        width: 360px;
        height: 56px;
        border-top: none;
        border-bottom: 1px solid #2e352d;
        border-right: 1px solid #2e352d;
        justify-content: flex-start;
        gap: 4px;
        padding: 0 12px;
    }

    .nav-logo {
        display: inline-flex;
        align-items: baseline;
        font-family: 'Lato', sans-serif;
        font-weight: 700;
        font-size: 1.1rem;
        letter-spacing: 0.04em;
        margin-right: auto;
    }

    #map {
        left: 0;
        transition: left 0.3s ease;
    }

    body.panel-open #map {
        left: 360px;
    }
}

/* ── Forms ── */
.field {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px;
    background: #424843;
    border: 1px solid #3e443d;
    color: #fff;
    border-radius: 6px;
    font-size: 0.875rem;
}

.field-label {
    display: block;
    margin-bottom: 12px;
    font-size: 0.875rem;
}

.btn-primary {
    width: 100%;
    padding: 10px;
    background: #5aaa6e;
    border: none;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}
.btn-primary:disabled {
    background: #3a3a3a;
    color: #666;
    cursor: not-allowed;
}

.btn-secondary {
    background: none;
    border: 1px solid #444;
    color: #aaa;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
}

.btn-outlined {
    background: none;
    border: 1px solid #4a9f6a;
    color: #7ec870;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
}

.hint { font-size: 0.8rem; color: #888; margin-bottom: 12px; }
.hint a { color: #5aaa6e; text-decoration: underline; }
.hint a:hover { color: #7fcfaa; }
.error { font-size: 0.8rem; color: #c8a030; min-height: 1em; margin-bottom: 8px; }

/* ── Panel content sections ── */
.panel-section { margin-bottom: 24px; }
.panel-section h2 { font-size: 0.95rem; font-weight: 500; margin-bottom: 12px; color: #d0d0d0; }
.panel-section p { font-size: 0.875rem; color: #aaa; line-height: 1.5; }

.pin-image { width: 100%; border-radius: 6px; margin-bottom: 12px; display: block; }
.pin-location { font-size: 0.8rem; color: #888; margin-bottom: 8px; }
.pin-meta { display: flex; gap: 16px; margin-top: 12px; font-size: 0.75rem; color: #666; }

.pin-list { list-style: none; }
.pin-list li {
    padding: 10px 0;
    border-bottom: 1px solid #484848;
    font-size: 0.875rem;
    cursor: pointer;
}
.pin-list li:hover { color: #5aaa6e; }

/* ── My pins list (account panel) ── */
.my-pin-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #484848;
    font-size: 0.875rem;
}

.my-pin-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.my-pin-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    border: none;
    cursor: pointer;
}

.badge-public   { background: #2d5a27; color: #7ec870; }
.badge-private  { background: #3a3a1e; color: #a0a060; }

.my-pin-actions { display: flex; gap: 6px; flex-shrink: 0; }

.btn-sm {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #444;
    background: none;
    color: #aaa;
}

.btn-sm:hover { color: #fff; border-color: #666; }

.btn-danger { border-color: #6b4e10; color: #c8a030; }
.btn-danger:hover { background: #3a2c10; }

.panel-section h3 { font-size: 0.875rem; font-weight: 600; color: #aaa; }

/* ── Discover pin list ── */
.discover-pin-item {
    padding: 10px 0;
    border-bottom: 1px solid #484848;
    cursor: pointer;
    font-size: 0.875rem;
    list-style: none;
}
.discover-pin-item:hover { color: #5aaa6e; }

/* ── Interests ── */
.interest-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #1a3328;
    color: #7fcfaa;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 12px;
    margin: 2px 4px 2px 0;
}

.interest-remove {
    background: none;
    border: none;
    color: #7fcfaa;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0;
}

.interest-remove:hover { color: #fff; }

.interest-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #424843;
    border: 1px solid #3e443d;
    border-radius: 0 0 6px 6px;
    list-style: none;
    z-index: 30;
    max-height: 160px;
    overflow-y: auto;
}

.interest-result-item {
    padding: 8px 12px;
    font-size: 0.875rem;
    cursor: pointer;
}

.interest-result-item:hover { background: #3e443d; color: #fff; }

/* ── Groups ── */
.group-row {
    padding: 12px 0;
    border-bottom: 1px solid #484848;
    cursor: pointer;
    font-size: 0.875rem;
}
.group-row:hover { color: #5aaa6e; }

/* ── Discover tabs ── */
.discover-tabs {
    display: flex;
    border-bottom: 1px solid #444;
    margin-bottom: 12px;
}

.discover-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #aaa;
    padding: 8px 16px;
    font-size: 0.875rem;
    cursor: pointer;
    margin-bottom: -1px;
}

.discover-tab.active {
    color: #5aaa6e;
    border-bottom-color: #5aaa6e;
}

/* ── Locate button ── */
#btn-locate {
    position: fixed;
    bottom: 60px;
    right: 16px;
    z-index: 1000;
    width: 32px;
    height: 32px;
    background: rgba(28,33,27,0.92);
    border: 1px solid #3a4a39;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    color: #7fcfaa;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
#btn-locate.locating {
    opacity: 0.4;
    pointer-events: none;
}
@media (min-width: 768px) {
    #btn-locate { bottom: 120px; }
}

/* ── Map markers ── */
.loci-marker-dot {
    width: 14px;
    height: 14px;
    background: #5aaa6e;
    border: 2px solid rgba(255,255,255,0.8);
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.marker-cluster div {
    background: #3a7a50;
    color: #fff;
}
.marker-cluster {
    background: rgba(90,170,110,0.25);
}

/* ── Leaflet zoom control ── */
@media (max-width: 767px) {
    .leaflet-control-zoom { display: none; }
}

.leaflet-control-zoom {
    border: 1px solid #444 !important;
    border-radius: 6px !important;
    overflow: hidden;
    box-shadow: none !important;
    margin-bottom: 16px !important;
    margin-right: 16px !important;
}

.leaflet-control-zoom a {
    background: #363d35 !important;
    color: #5aaa6e !important;
    border-bottom: 1px solid #444 !important;
    width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
    font-size: 1.1rem !important;
}

.leaflet-control-zoom a:last-child { border-bottom: none !important; }
.leaflet-control-zoom a:hover { background: #484848 !important; color: #7fcfaa !important; }
