:root {
    --bg: #080b12;
    --panel: #0d111b;
    --panel-soft: #111725;

    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);

    --text: #f4f6fb;
    --muted: #7f899f;
    --muted-light: #aeb6c7;

    --accent: #8295ff;
    --accent-soft: rgba(130, 149, 255, 0.13);

    --green: #61d49c;

    --sidebar: 360px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: var(--bg);
    color: var(--text);
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.app {
    height: 100vh;

    display: grid;
    grid-template-columns: var(--sidebar) 1fr;
}


/* SIDEBAR */

.sidebar {
    position: relative;
    z-index: 1000;

    min-width: 0;

    display: flex;
    flex-direction: column;

    padding: 24px;

    background:
        linear-gradient(
            160deg,
            #101624,
            #090d15 70%
        );

    border-right: 1px solid var(--border);

    box-shadow:
        20px 0 50px rgba(0, 0, 0, 0.18);
}

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

.brand-icon {
    width: 42px;
    height: 42px;

    display: grid;
    place-items: center;

    border: 1px solid var(--border);
    border-radius: 13px;

    background:
        linear-gradient(
            145deg,
            rgba(130, 149, 255, 0.28),
            rgba(255, 255, 255, 0.03)
        );

    font-weight: 700;
}

.brand strong,
.brand span {
    display: block;
}

.brand strong {
    font-size: 15px;
}

.brand span {
    margin-top: 3px;

    color: var(--muted);

    font-size: 11px;
}

.sidebar-actions {
    margin-top: 30px;

    display: grid;
    gap: 9px;
}

.primary-button,
.secondary-button {
    min-height: 43px;

    padding: 10px 14px;

    border-radius: 12px;

    transition:
        background .18s,
        border-color .18s,
        transform .18s;
}

.primary-button {
    border:
        1px solid
        rgba(130, 149, 255, .34);

    background:
        rgba(130, 149, 255, .14);

    color: #d6dcff;

    font-weight: 600;
}

.primary-button:hover {
    background:
        rgba(130, 149, 255, .22);

    border-color:
        rgba(130, 149, 255, .52);
}

.primary-button.active {
    background: var(--accent);
    color: #080b12;
}

.secondary-button {
    border: 1px solid var(--border);

    background:
        rgba(255, 255, 255, .025);

    color: var(--muted-light);
}

.secondary-button:hover {
    border-color: var(--border-hover);

    background:
        rgba(255, 255, 255, .05);
}

.places-header {
    margin-top: 40px;
    margin-bottom: 17px;

    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.eyebrow {
    color: #9aa8ff;

    font-size: 9px;
    font-weight: 700;
    letter-spacing: .17em;
}

.places-header h2 {
    margin: 7px 0 0;

    font-size: 19px;
    letter-spacing: -.025em;
}

.counter {
    min-width: 27px;
    height: 27px;

    padding: 0 8px;

    display: grid;
    place-items: center;

    border: 1px solid var(--border);
    border-radius: 9px;

    color: var(--muted);

    font-size: 11px;
}

.places {
    min-height: 0;

    display: grid;
    gap: 8px;

    overflow-y: auto;
}

.place {
    padding: 14px;

    border: 1px solid var(--border);
    border-radius: 14px;

    background:
        rgba(255, 255, 255, .025);

    cursor: pointer;

    transition:
        background .18s,
        border-color .18s;
}

.place:hover {
    background:
        rgba(255, 255, 255, .05);

    border-color:
        var(--border-hover);
}

.place-top {
    display: flex;
    align-items: center;
    gap: 9px;
}

.place-color {
    width: 8px;
    height: 8px;

    flex-shrink: 0;

    border-radius: 50%;
}

.place-name {
    flex: 1;

    overflow: hidden;

    font-size: 13px;
    font-weight: 600;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.place-category {
    margin-top: 7px;

    color: var(--muted);

    font-size: 10px;
}

.place-note {
    margin-top: 8px;

    color: var(--muted-light);

    font-size: 11px;
    line-height: 1.45;

    overflow: hidden;

    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.empty-state {
    margin-top: 15px;

    padding: 28px 20px;

    border:
        1px dashed
        rgba(255, 255, 255, .1);

    border-radius: 17px;

    color: var(--muted);

    text-align: center;
}

.empty-state.hidden {
    display: none;
}

.empty-icon {
    margin-bottom: 10px;

    color: #8e9dff;

    font-size: 28px;
}

.empty-state strong {
    display: block;

    color: var(--muted-light);

    font-size: 12px;
}

.empty-state p {
    margin:
        7px auto 0;

    max-width: 220px;

    font-size: 10px;
    line-height: 1.5;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;

    display: flex;
    justify-content: space-between;

    border-top: 1px solid var(--border);

    color: var(--muted);

    font-size: 10px;
}

.sidebar-footer a {
    color: var(--muted-light);
    text-decoration: none;
}


/* MAP */

.map-area {
    position: relative;

    min-width: 0;
    min-height: 0;
}

#map {
    width: 100%;
    height: 100%;
}

.map-topbar {
    position: absolute;
    z-index: 500;

    top: 18px;
    left: 50%;

    transform: translateX(-50%);

    min-width: 270px;

    padding: 10px 14px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;

    border: 1px solid var(--border);
    border-radius: 13px;

    background:
        rgba(10, 14, 23, .88);

    backdrop-filter: blur(18px);

    box-shadow:
        0 15px 40px
        rgba(0, 0, 0, .24);

    pointer-events: none;
}

.map-title {
    display: flex;
    align-items: center;
    gap: 7px;

    color: #c7cedd;

    font-size: 10px;
}

.online-dot {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: var(--green);

    box-shadow:
        0 0 9px
        rgba(97, 212, 156, .6);
}

.hint {
    padding-left: 15px;

    border-left: 1px solid var(--border);

    color: var(--muted);

    font-size: 10px;
}


/* LEAFLET */

.leaflet-container {
    background: #111827;

    font-family: inherit;
}

.leaflet-control-zoom {
    overflow: hidden;

    border: 1px solid var(--border) !important;
    border-radius: 12px !important;

    box-shadow:
        0 10px 30px
        rgba(0, 0, 0, .18) !important;
}

.leaflet-control-zoom a {
    background:
        rgba(10, 14, 23, .94) !important;

    color: #d7dceb !important;

    border-bottom:
        1px solid
        var(--border) !important;
}

.leaflet-control-attribution {
    background:
        rgba(9, 12, 19, .8) !important;

    color: #8992a4 !important;

    font-size: 9px !important;
}

.leaflet-control-attribution a {
    color: #aab4c8 !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: #101620;

    color: var(--text);
}

.leaflet-popup-content-wrapper {
    border:
        1px solid
        rgba(255, 255, 255, .09);

    border-radius: 14px;

    box-shadow:
        0 18px 50px
        rgba(0, 0, 0, .35);
}

.popup-title {
    margin-bottom: 5px;

    font-size: 13px;
    font-weight: 700;
}

.popup-category {
    color: #9ba7bc;

    font-size: 10px;
}

.popup-note {
    max-width: 230px;

    margin-top: 9px;

    color: #c2c9d6;

    font-size: 11px;
    line-height: 1.45;
}

.popup-delete {
    margin-top: 12px;

    padding: 6px 8px;

    border:
        1px solid
        rgba(255, 100, 110, .2);

    border-radius: 7px;

    background:
        rgba(255, 100, 110, .07);

    color: #ff9299;

    font-size: 9px;
}


/* DIALOG */

dialog {
    width:
        min(
            440px,
            calc(100% - 30px)
        );

    padding: 0;

    border: 1px solid var(--border);
    border-radius: 22px;

    background:
        linear-gradient(
            160deg,
            #111725,
            #0b0f18
        );

    color: var(--text);

    box-shadow:
        0 35px 100px
        rgba(0, 0, 0, .55);
}

dialog::backdrop {
    background:
        rgba(2, 4, 8, .66);

    backdrop-filter: blur(5px);
}

#place-form {
    padding: 24px;
}

.dialog-header {
    margin-bottom: 24px;

    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.dialog-header h2 {
    margin: 7px 0 0;

    font-size: 22px;
}

.close-button {
    width: 34px;
    height: 34px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background:
        rgba(255, 255, 255, .03);

    color: var(--muted-light);

    font-size: 20px;
}

label {
    margin-top: 16px;

    display: grid;
    gap: 8px;

    color: var(--muted-light);

    font-size: 11px;
}

input,
select,
textarea {
    width: 100%;

    padding: 11px 12px;

    outline: none;

    border: 1px solid var(--border);
    border-radius: 11px;

    background:
        rgba(255, 255, 255, .035);

    color: var(--text);
}

select option {
    background: #111725;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color:
        rgba(130, 149, 255, .55);
}

.coordinates {
    margin-top: 14px;

    color: var(--muted);

    font-size: 9px;
}

.dialog-actions {
    margin-top: 25px;

    display: flex;
    justify-content: flex-end;
    gap: 9px;
}


/* TOAST */

.toast {
    position: fixed;
    z-index: 3000;

    right: 22px;
    bottom: 22px;

    padding: 11px 15px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: #111725;

    color: #d6dbea;

    font-size: 11px;

    box-shadow:
        0 15px 40px
        rgba(0, 0, 0, .35);

    opacity: 0;
    transform: translateY(10px);

    pointer-events: none;

    transition:
        opacity .2s,
        transform .2s;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}


/* MOBILE */

@media (max-width: 760px) {

    .app {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 270px;
    }

    .map-area {
        grid-row: 1;
    }

    .sidebar {
        grid-row: 2;

        padding: 16px;

        border-right: 0;
        border-top: 1px solid var(--border);

        overflow-y: auto;
    }

    .brand,
    .sidebar-footer {
        display: none;
    }

    .sidebar-actions {
        margin-top: 0;

        grid-template-columns: 1fr 1fr;
    }

    .places-header {
        margin-top: 18px;
    }

    .empty-state {
        padding: 15px;
    }

    .map-topbar {
        top: 12px;

        width:
            calc(100% - 100px);

        min-width: 0;
    }

    .hint {
        display: none;
    }
}
