:root {
    --map-editor-left-sidebar-width: 240px;
    --map-editor-right-sidebar-width: 160px;
}

/* --- Global Reset & Fonts --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family:
        "Inter",
        system-ui,
        -apple-system,
        sans-serif;
}

*:focus {
    outline: none;
}

/* --- Page Layout --- */
body {
    background-color: #f9fafb;
    height: 100vh;
}

body {
    font-family:
        "Inter",
        --apple-system,
        BlinkMacSystemFont,
        Segoe UI,
        Roboto,
        Oxygen,
        Ubuntu,
        Cantarell,
        Fira Sans,
        Droid Sans,
        Helvetica Neue,
        sans-serif;
}

/* Full-screen overlay */
#device-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(20, 20, 20, 0.95);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    z-index: 9999;
    padding: 20px;
    font-size: 1.5rem;
    display: none; /* hidden by default */
}

#device-overlay h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

#device-overlay p {
    font-size: 1.2rem;
    opacity: 0.8;
}

/*Common*/

.btn {
    display: block;
}

.btn:hover {
    cursor: pointer;
}

.link-underline {
    text-decoration: underline;
}

/*Auth forms*/
.auth-form-container {
    max-width: 500px;
    height: 400px;
    border-radius: 30px;
    border-style: solid;
    border-width: 1px;
    border-color: #d3d3d3;
    box-shadow:
        0 1px 3px 0 rgba(0, 0, 0, 0.1),
        0 1px 2px -1px rgba(0, 0, 0, 0.1);
    padding: 30px;
    position: absolute;
    left: 50%;
    top: 50%;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
}

/*Editor*/
editor-tree-view {
    height: 100%;
    /* Full-height: remove this if you want "auto" height */
    width: var(--map-editor-left-sidebar-width);
    /* Set the width of the sidebar */
    position: absolute;
    /* Fixed Sidebar (stay in place on scroll) */
    z-index: 1;
    /* Stay on top */
    top: 0;
    /* Stay at the top */
    left: 0;
    background-color: #fdfdfd;
    overflow-x: hidden;
    /* Disable horizontal scroll */
}

editor-map-view {
    position: absolute;
    /* Fixed Sidebar (stay in place on scroll) */
    left: var(--map-editor-left-sidebar-width);
    /* Same as the width of the sidebar */
    right: var(--map-editor-right-sidebar-width);
    /* Same as the width of the sidebar */
    top: 0;
    bottom: 0;
}

editor-settings-view {
    height: 100%;
    /* Full-height: remove this if you want "auto" height */
    width: var(--map-editor-right-sidebar-width);
    /* Set the width of the sidebar */
    position: absolute;
    /* Fixed Sidebar (stay in place on scroll) */
    z-index: 1;
    /* Stay on top */
    top: 0;
    /* Stay at the top */
    right: 0;
    background-color: #fdfdfd;
    overflow-x: hidden;
    /* Disable horizontal scroll */
}

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

.tree-view-header {
    position: absolute;
    left: 0;
    top: 0;
    height: 60px;
    width: 100%;
    border-bottom: 1px solid rgba(189, 189, 189, 0.562);
}

#tree-view-header-left-btn {
    cursor: pointer;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    line-height: 55px;
    text-align: center;
    padding-left: 5px;
}

#tree-view-header-left-btn:hover {
    opacity: 0.8;
}

#tree-view-header-right-btn {
    cursor: pointer;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    line-height: 55px;
    text-align: center;
    padding-right: 5px;
}

#tree-view-header-right-btn:hover {
    opacity: 0.8;
}

.tree-view-header-title {
    position: absolute;
    right: 40px;
    top: 0;
    left: 40px;
    bottom: 0;
    margin-left: 5px;
    margin-right: 5px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    line-height: 60px;
}

.tree-view-header-title-input {
    position: absolute;
    right: 0px;
    top: 15px;
    left: 0px;
    text-align: center;
    border-width: 0px;
    height: 30px;
}

.tree-view-subheader {
    position: absolute;
    left: 0;
    top: 60px;
    height: 40px;
    width: 100%;
    border-bottom: 1px solid rgba(189, 189, 189, 0.562);
    padding-left: 10px;
}

.tree-view-subheader-btn {
    cursor: pointer;
    width: 30px;
    line-height: 40px;
    text-align: center;
    display: inline-block;
}

.tree-view-subheader-btn:hover {
    opacity: 0.8;
}

.tree-view-share-btn {
    display: inline-block;
    cursor: pointer;
    margin-left: 30px;
    vertical-align: middle;
    width: 100px;
    height: 25px;
    background-color: black;
    border-radius: 20px;
    color: #fdfdfd;
    text-align: center;
    line-height: 25px;
    font-size: 13px;
    font-weight: 700;
}

.tree-view-share-btn:hover {
    opacity: 0.8;
}

/*Settings, right tab*/
.settings-view-header {
    right: 0;
    height: 40px;
    line-height: 40px;
    width: 100%;
    border-bottom: 1px solid rgba(189, 189, 189, 0.562);
    padding-left: 10px;
}

.settings-view-header-title {
    font-size: 14px;
    font-weight: 700;
}

.settings-view-section {
    right: 0;
    width: 100%;
    border-bottom: 1px solid rgba(189, 189, 189, 0.562);
    padding-left: 10px;
    padding-bottom: 16px;
}

.settings-view-section-title {
    padding-top: 16px;
    padding-bottom: 10px;
    font-size: 12px;
    font-weight: 600;
}

.settings-view-section-label {
    padding-top: 10px;
    padding-bottom: 4px;
    font-size: 11px;
    font-weight: 500;
    color: rgb(120, 120, 120);
}

.settings-view-section-input {
    border: none;
    border-radius: 6px;
    background-color: rgba(220, 220, 220, 0.562);
    height: 24px;
    font-size: 12px;
    padding-right: 4px;
    padding-left: 4px;
}

.settings-view-section-input-file {
    border: none;
    border-radius: 6px;
    background-color: rgba(220, 220, 220, 0.562);
    height: 24px;
    font-size: 12px;
    padding-right: 4px;
    padding-left: 4px;
    margin-top: 4px;
    padding-top: 2px;
    width: calc(var(--map-editor-right-sidebar-width) - 20px);
}

.settings-view-section-textarea {
    border: none;
    border-radius: 6px;
    background-color: rgba(220, 220, 220, 0.562);
    height: 24px;
    font-size: 12px;
    padding-right: 4px;
    padding-left: 4px;
    height: 100px;
    width: calc(var(--map-editor-right-sidebar-width) - 20px);
}

.settings-view-section-select {
    border: none;
    border-radius: 6px;
    background-color: rgba(220, 220, 220, 0.562);
    font-size: 12px;
    height: 24px;
    width: calc(var(--map-editor-right-sidebar-width) - 20px);
}

.settings-view-section-small-label {
    margin-top: 3px;
    font-size: 11px;
    font-weight: 400;
    color: rgb(120, 120, 120);
}

.settings-view-section-button {
    margin-top: 5px;
    cursor: pointer;
    width: 70px;
    height: 20px;
    background-color: black;
    border-radius: 20px;
    color: #fdfdfd;
    text-align: center;
    line-height: 20px;
    font-size: 11px;
    font-weight: 400;
}

.settings-view-section-button:hover {
    opacity: 0.8;
}

#map-settings-view {
    display: none;
}

#group-settings-view {
    display: none;
}

#pin-settings-view {
    display: none;
}

.map-layers-list-container {
    position: absolute;
    right: 0px;
    top: 101px;
    bottom: 1px;
    left: 0px;
    overflow-y: auto;
    overflow-x: hidden;
}

.editor-map-tree-view-bottom-container {
    position: absolute;
    height: 100px;
    bottom: 0px;
    left: 0px;
    right: 0px;
    border-top: 1px solid rgba(189, 189, 189, 0.562);
    text-align: center;
    background-color: rgba(250, 250, 250, 1);
}

#editor-map-tree-publish-btn {
    cursor: pointer;
    margin-left: auto;
    margin-right: auto;
    margin-top: 20px;
    margin-bottom: 10px;
    width: 150px;
    height: 40px;
    background-color: black;
    border-radius: 20px;
    color: #fdfdfd;
    text-align: center;
    line-height: 40px;
    font-size: 16px;
    font-weight: 700;
}

#editor-map-tree-publish-btn:hover {
    opacity: 0.8;
}

.editor-map-tree-hint-link {
    text-decoration: underline;
    text-align: center;
    font-size: 13px;
}

/*Map list*/
.map-list-container {
    margin-left: auto;
    margin-right: auto;
    padding-top: 20px;
    padding-right: 20px;
    width: 300px;
}

.map-list-row {
    display: flex;
    justify-content: space-between;
    cursor: pointer;
}

.map-list-map-title {
    max-width: 200px;
    white-space: nowrap; /*keep text on one line */
    overflow: hidden; /*prevent text from being shown outside the border */
    text-overflow: ellipsis; /*cut off text with an ellipsis*/
}
.map-list-map-btn {
    display: block;
    width: 30px;
}

#map-context-menu ul li {
    padding: 5px 10px;
    cursor: pointer;
}

#map-context-menu ul li:hover {
    background-color: #eee;
}

/* Tree view on a map editor*/
ul,
#map-layers-list {
    list-style-type: none;
}

#map-layers-list {
    margin: 10px;
    padding: 0;
    font-size: 14px;
    font-weight: 400;
    border: none;
}

.tree-list-item {
    display: inline-block;
    height: 30px;
    width: 200px;
    border-radius: 6px;
    line-height: 30px;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    margin-top: 2px;
    margin-bottom: 2px;
}

.tree-list-item-selected {
    background-color: #f0f0ef;
}

.tree-list-item:hover {
    background-color: #e9e9e9;
}

.tree-list-item-icon {
    padding-left: 5px;
}

.tree-list-delete-icon {
    margin-right: 10px;
    float: right;
}

.tree-list-delete-icon:hover {
    opacity: 0.8;
    cursor: pointer;
}

.tree-list-item-title {
    display: inline-block;
    vertical-align: middle; /* Align vertically with input */
    padding-left: 5px;
    border: 0;
    outline: 0;
    background: transparent;
}

.tree-list-item-title:focus {
    outline: none !important;
}

.tree-list-item-nested {
    margin-left: 20px;
    line-height: 30px;
}

.tree-list-item-folded {
    display: none;
}

.tree-list-item-shown {
    display: block;
}

/*Markers*/

.tree-marker-icon {
    display: inline-block;
    vertical-align: middle; /* Align vertically with input */

    border: none;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    margin-left: 5px;
}

.marker-background {
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    border: 2px solid white;
}

.marker-background-hightlighted {
    border-style: solid;
    border-color: #ffff;
    border: 0px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0px 6px white; /* White shadow */
}

.cluster-marker {
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    border: 2px solid white;
}

.maplibregl-popup-content {
    border-radius: 10px;
    margin: 0px;
    padding: 0;
    overflow: hidden;
}

.map-object-popup {
    max-width: 400px;
    border-radius: 10px;
}

.map-object-popup-img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* fill while keeping aspect ratio */
    object-position: center;
    padding-bottom: 10px;
}

.map-object-popup-title {
    font-weight: 600;
    font-size: 16px;
    margin: 0px;
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 5px;
    padding-bottom: 5px;
}
.map-object-popup-description {
    font-weight: 400;
    font-size: 12px;
    margin: 0px;
    padding-top: 5px;
    padding-bottom: 5px;
    padding-left: 10px;
    padding-right: 10px;
}

.map-object-popup-btn {
    cursor: pointer;
    margin-left: auto;
    margin-right: auto;
    margin-top: 20px;
    margin-bottom: 10px;
    width: 150px;
    height: 30px;
    background-color: black;
    border-radius: 20px;
    color: #fdfdfd;
    text-align: center;
    line-height: 30px;
    font-size: 15px;
    font-weight: 500;
}

.map-object-popup-btn:hover {
    opacity: 0.8;
}

/*Login*/

/* --- Auth Form Container --- */
.auth-form-container {
    background-color: #fff;
    padding: 2rem 2.5rem;
    border-radius: 1rem;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 360px;
}

.auth-title {
    font-size: 1.8rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1.8rem;
    color: #111827;
}

/* --- Input Fields --- */
.auth-input-hint {
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.4rem;
}

input.auth-input[type="text"],
input.auth-input[type="password"] {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background-color: #f9fafb;
    font-size: 0.95rem;
    margin-bottom: 1.2rem;
    transition: all 0.2s ease;
}

input.auth-input:focus {
    border-color: #2563eb;
    background-color: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* --- Buttons --- */
.auth-btn-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.btn {
    cursor: pointer;
    padding: 0.75rem;
    font-size: 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    border: none;
    transition: all 0.25s ease;
}

.black-btn {
    background-color: #111827;
    color: white;
}

.black-btn:hover {
    background-color: #1f2937;
}

.clear-btn {
    background: transparent;
    color: #111827;
    border: 1px solid #d1d5db;
}

.clear-btn:hover {
    background-color: #f3f4f6;
}

/* --- Bottom Hint --- */
.auth-hint {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: #6b7280;
}

.auth-hint a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.auth-hint a:hover {
    text-decoration: underline;
}

/*Maps View*/

/* --- Container --- */
#tab-maps-content {
    max-width: 600px;
    margin: 4rem auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* --- New Map Button (reuse existing styles) --- */
#new-map-btn {
    margin: auto;
}

/* --- Floating + Button --- */
.add-map-btn {
    right: 0.5rem;
    width: 42px;
    height: 42px;
    background-color: #111827;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.25s ease;
    line-height: 42px;
}

.add-map-btn:hover {
    background-color: #1f2937;
    transform: translateY(-1px);
}

.add-map-btn:active {
    transform: scale(0.95);
}

/* --- Map List Container --- */
.map-list-container {
    background-color: #fff;
    border-radius: 1rem;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
    padding: 1rem 1.25rem;
}

/* --- Map List Rows --- */
.map-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1rem;
    border-radius: 0.6rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
    margin-bottom: 0.6rem;
}

.map-list-row:last-child {
    margin-bottom: 0;
}

/* --- Row Hover / Active States --- */
.map-list-row:hover {
    background-color: #f9fafb;
    border-color: #e5e7eb;
    transform: translateY(-1px);
}

/* --- Map Title --- */
.map-list-map-title {
    font-size: 1rem;
    color: #111827;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Map Delete Button --- */
.map-list-map-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    background: transparent;
    border-radius: 0.5rem;
    padding: 0.4rem;
    transition: all 0.2s ease;
}

.map-list-map-btn:hover {
    color: #ef4444;
    background-color: #fef2f2;
}

/* --- SVG Icon --- */
.map-list-map-btn svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

/* --- Responsive --- */
@media (max-width: 480px) {
    #tab-maps-content {
        margin: 2rem 1rem;
    }

    .map-list-row {
        padding: 0.75rem 0.9rem;
    }
}

/*Profile button*/
/* --- Circular Profile Button --- */
.profile-btn {
    position: fixed;
    top: 1.25rem;
    right: 1.5rem;
    width: 42px;
    height: 42px;
    background-color: #111827;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.25s ease;
    z-index: 1000;
}

.profile-btn:hover {
    background-color: #1f2937;
    transform: translateY(-1px);
}

/* Optional subtle ripple effect on click */
.profile-btn:active {
    transform: scale(0.95);
}

/* Smaller screens */
@media (max-width: 480px) {
    .profile-btn {
        top: 1rem;
        right: 1rem;
        width: 38px;
        height: 38px;
        font-size: 0.9rem;
    }
}

/* --- Profile Container --- */
.profile-container {
    border-radius: 1rem;
    width: 100%;
    max-width: 400px;
    margin: 4rem auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* --- Title --- */
.profile-title {
    font-size: 1.8rem;
    font-weight: 600;
    text-align: center;
    color: #111827;
    margin-bottom: 0.5rem;
}

/* --- Field --- */
.profile-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.profile-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
}

/* --- Input --- */
#profile-email-input {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background-color: #f9fafb;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

#profile-email-input:focus {
    border-color: #2563eb;
    background-color: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* --- Buttons --- */
.profile-btn-container {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    margin-top: 1rem;
}

.btn {
    cursor: pointer;
    padding: 0.75rem 1.2rem;
    font-size: 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    border: none;
    transition: all 0.25s ease;
}

.black-btn {
    background-color: #111827;
    color: white;
}

.black-btn:hover {
    background-color: #1f2937;
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .profile-container {
        padding: 1.5rem;
        margin: 2rem 1rem;
    }

    .profile-btn-container {
        flex-direction: column;
    }
}
