html,
body,
#map {
    height: 100%;
    margin: 0;
}

.day-start-icon {
    font-size: 22px;
    text-align: center;
}

.debug-point {
    color: magenta;
    font-size: 16px;
    font-weight: bold;
}

.fa-solid {
    transition: transform 0.15s ease;
}

.fa-solid:hover {
    transform: scale(1.2);
}

/* Overlay */
.modal {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 40px;
    box-sizing: border-box;
}

.modal > div {
    box-sizing: border-box;
}

/* Waypoint modal */
.waypoint-modal {
    background: #fff;
    width: min(92vw, 420px);
    max-height: 90vh;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.waypoint-modal-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.waypoint-modal h2 {
    margin: 0;
    padding: 20px 20px 14px;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 1px solid #edf0f3;
}

.waypoint-form-body {
    background: #fff;
    padding: 16px 20px 0;
    overflow-y: auto;
    flex: 1;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cfd4dc;
    border-radius: 8px;
    padding: 10px 11px;
    font-size: 15px;
    background: #fff;
}

.form-group textarea {
    min-height: 76px;
    resize: vertical;
}

.point-type-list {
    max-height: 35vh;
    overflow-y: auto;
    padding-right: 4px;
    margin-top: 6px;
}

.pointtype-option {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 22px;
    padding: 2px 12px;
    border: 1px solid #ddd;
    border-radius: 9px;
    cursor: pointer;
    background: #fff;
    transition: background .15s, border-color .15s, box-shadow .15s;
    user-select: none;
}

.pointtype-option + .pointtype-option {
    margin-top: 3px;
}

.pointtype-option:hover {
    background: #f7f7f7;
}

.pointtype-option i {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex: 0 0 24px;
}

.pointtype-option.selected {
    border-color: #3388ff;
    background: #eef5ff;
    box-shadow: 0 0 0 2px rgba(51, 136, 255, .15);
}

.pointtype-name {
    font-size: 14px;
    font-weight: 500;
}

.modal-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 12px 20px 16px;
    margin-top: 14px;
    display: flex;
    gap: 10px;
    border-top: 1px solid #edf0f3;
    z-index: 2;
}

.modal-actions button {
    flex: 1;
    border: 0;
    border-radius: 8px;
    padding: 11px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
}

/* Popup */
.waypoint-popup {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 13px;
    line-height: 1.4;
    max-width: 260px;
}

.waypoint-popup h3 {
    margin: 0 0 4px 0;
    font-size: 15px;
}

.waypoint-popup .time {
    color: #666;
    font-size: 12px;
    margin-bottom: 6px;
}

.waypoint-popup .description {
    margin-bottom: 6px;
}

.waypoint-popup .actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #ddd;
}

.waypoint-popup .actions button {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #444;
}

.waypoint-popup .actions button:hover {
    color: #000;
}

/* Loader */
.loader-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0f172a, #020617);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loader-card {
    width: 320px;
    background: rgba(15, 23, 42, 0.9);
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
    text-align: center;
    color: #e5e7eb;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.loader-card::before {
    content: "";
    width: 36px;
    height: 36px;
    border: 3px solid #1e293b;
    border-top-color: #38bdf8;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: block;
    animation: spin 1s linear infinite;
}

.loader-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

.loader-status {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 14px;
    min-height: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #1e293b;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #38bdf8, #22c55e);
    transition: width 0.3s ease;
}

.loader-percent {
    margin-top: 10px;
    font-size: 12px;
    color: #64748b;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Leaflet controls */
.leaflet-control-camera,
.leaflet-control-upload {
    background: white;
    width: 34px;
    height: 34px;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.leaflet-control-camera i,
.leaflet-control-upload i {
    font-size: 16px;
    color: #333;
}

.leaflet-control-camera:hover,
.leaflet-control-upload:hover {
    background: #f4f4f4;
}


/* 36x36 på alla */
.leaflet-touch .leaflet-bar a,
.leaflet-control-camera,
.leaflet-control-upload,
.leaflet-control-layers-toggle {
    width: 36px;
    height: 36px;
    line-height: 36px;
    background-size: 20px 20px;
}

/* Lagerknappen */

.leaflet-control-layers-toggle {
    width: 36px !important;
    height: 36px !important;
    background-size: 20px 20px;
}




/* Login */
.login-badge {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1000;
    background: white;
    padding: 7px 10px;
    border-radius: 6px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, .35);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 13px;
}

.login-badge button {
    border: none;
    background: none;
    cursor: pointer;
    margin-left: 8px;
}



.measure-btn.active {
    background: #dbeafe;
    box-shadow: inset 0 0 0 2px #2563eb;
}
.measure-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    text-decoration: none;
    background: #fff;
    color: #333;
}

.measure-btn:hover {
    background: #f4f4f4;
}

.measure-btn.active {
    background: #dbeafe;
    box-shadow: inset 0 0 0 2px #2563eb;
}


@media (max-width: 600px) {

    .waypoint-modal {
        height: calc(100dvh - env(safe-area-inset-top));
        max-height: calc(100dvh - env(safe-area-inset-top));
    }

    .waypoint-modal-content {
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .waypoint-form-body {
        flex: 1;
        overflow-y: auto;
    }

    .modal-actions {
        flex-shrink: 0;
        padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
    }
}
