/* =========================================================
   JOEMAP / ABEOJEMAP
   FILE    : css/coordinateTool.css
   MODULE  : COORDINATE & NAVIGATION
   VERSION : FINAL-V1

   FITUR:
   - Coordinate marker
   - Marker pulse
   - Popup koordinat
   - Tombol salin dan Google Maps
   - Panel koordinat terpilih
   - Toast notifikasi
   - Mode pemilihan titik
   - Android / WebView responsive
========================================================= */


/* =========================================================
   1. COORDINATE MARKER
========================================================= */

.abejoe-coordinate-marker-wrap {
    background: transparent !important;
    border: none !important;
}

.abejoe-coordinate-marker {
    position: relative;
    width: 54px;
    height: 68px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    pointer-events: none;
}


/* =========================================================
   2. MARKER PULSE
========================================================= */

.abejoe-coordinate-pulse {
    position: absolute;
    top: 20px;
    left: 7px;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(0, 120, 215, 0.7);
    border-radius: 50%;
    background: rgba(0, 120, 215, 0.16);
    animation: abejoe-coordinate-pulse 1.8s ease-out infinite;
}

@keyframes abejoe-coordinate-pulse {
    0% {
        transform: scale(0.45);
        opacity: 0.9;
    }

    75% {
        transform: scale(1.45);
        opacity: 0.15;
    }

    100% {
        transform: scale(1.65);
        opacity: 0;
    }
}


/* =========================================================
   3. MARKER PIN
========================================================= */

.abejoe-coordinate-pin {
    position: relative;
    z-index: 2;
    width: 34px;
    height: 34px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: linear-gradient(145deg, #168bff, #0055b8);
    border: 3px solid #ffffff;
    border-radius: 50% 50% 50% 8px;
    transform: rotate(-45deg);
    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.35),
        0 0 0 2px rgba(0, 120, 215, 0.2);
}

.abejoe-coordinate-center {
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(45deg);
    font-size: 15px;
    line-height: 1;
}


/* =========================================================
   4. LEAFLET POPUP
========================================================= */

.leaflet-popup-content-wrapper {
    border-radius: 12px;
}

.abejoe-coordinate-popup {
    min-width: 205px;
    max-width: 260px;
    padding: 3px;
    color: #0f172a;
    font-family: Arial, Helvetica, sans-serif;
}

.abejoe-coordinate-popup-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    color: #075985;
    font-size: 13px;
}

.abejoe-coordinate-popup-title i {
    font-size: 16px;
    color: #0284c7;
}

.abejoe-coordinate-popup-value {
    padding: 10px;
    margin-bottom: 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: monospace;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    overflow-wrap: anywhere;
    user-select: text;
    -webkit-user-select: text;
}

.abejoe-coordinate-popup-actions {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.abejoe-coordinate-popup-actions button,
.abejoe-coordinate-popup-actions a {
    flex: 1;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border: none;
    border-radius: 7px;
    color: #ffffff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

.abejoe-coordinate-copy {
    background: #0f766e;
}

.abejoe-coordinate-google {
    background: #1677d2;
}

.abejoe-coordinate-popup-actions button:active,
.abejoe-coordinate-popup-actions a:active {
    filter: brightness(0.9);
    transform: scale(0.98);
}


/* =========================================================
   5. COORDINATE PANEL
========================================================= */

#coordinateBox {
    position: relative;
    width: 100%;
    margin-top: 12px;
}

#coordinateBox[hidden] {
    display: none !important;
}

.coordinate-selected {
    padding: 12px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #dbeafe;
    border-left: 4px solid #0284c7;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.07);
    color: #0f172a;
}

.coordinate-selected-title {
    margin-bottom: 10px;
    color: #0369a1;
    font-size: 13px;
    font-weight: 800;
}

.coordinate-selected-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
}

.coordinate-selected-row span {
    color: #64748b;
}

.coordinate-selected-row strong {
    color: #0f172a;
    font-family: monospace;
    font-size: 12px;
    text-align: right;
    overflow-wrap: anywhere;
    user-select: text;
    -webkit-user-select: text;
}

.coordinate-selected-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.coordinate-selected-actions button {
    flex: 1;
    min-height: 38px;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.coordinate-selected-actions button:first-child {
    background: #0f766e;
}

.coordinate-selected-actions button:last-child {
    background: #1677d2;
}

.coordinate-selected-actions button:active {
    filter: brightness(0.9);
}


/* =========================================================
   6. TOAST NOTIFICATION
========================================================= */

.abejoe-coordinate-toast {
    position: fixed;
    z-index: 10050;
    left: 50%;
    bottom: calc(26px + env(safe-area-inset-bottom, 0px));
    width: max-content;
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    padding: 11px 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    background: #0f172a;
    color: #ffffff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition:
        opacity 0.2s ease,
        transform 0.2s ease,
        visibility 0.2s ease;
}

.abejoe-coordinate-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.abejoe-coordinate-toast.success {
    background: #065f46;
}

.abejoe-coordinate-toast.error {
    background: #991b1b;
}


/* =========================================================
   7. MAP SELECT MODE
========================================================= */

#map.abejoe-coordinate-selecting,
.leaflet-container.abejoe-coordinate-selecting {
    cursor: crosshair;
}

.abejoe-coordinate-selecting .leaflet-interactive {
    cursor: crosshair;
}


/* =========================================================
   8. COORDINATE INPUT
   Menyesuaikan panelCoordinate yang sudah ada.
========================================================= */

#panelCoordinate #currentCoordsDisplay {
    overflow-wrap: anywhere;
    user-select: text;
    -webkit-user-select: text;
}

#panelCoordinate #inputLat,
#panelCoordinate #inputLon {
    min-width: 0;
    box-sizing: border-box;
    outline: none;
}

#panelCoordinate #inputLat:focus,
#panelCoordinate #inputLon:focus {
    border-color: #0284c7 !important;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.12);
}

#panelCoordinate #btnGoCoord {
    min-height: 38px;
    transition:
        filter 0.15s ease,
        transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

#panelCoordinate #btnGoCoord:active {
    filter: brightness(0.92);
    transform: scale(0.99);
}


/* =========================================================
   9. ANDROID / MOBILE
========================================================= */

@media (max-width: 600px) {

    .abejoe-coordinate-popup {
        min-width: 190px;
    }

    .abejoe-coordinate-popup-actions button,
    .abejoe-coordinate-popup-actions a {
        min-height: 40px;
        font-size: 12px;
    }

    .coordinate-selected {
        padding: 10px;
    }

    .coordinate-selected-actions button {
        min-height: 42px;
    }

    .abejoe-coordinate-toast {
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        font-size: 12px;
    }
}


/* =========================================================
   10. REDUCE ANIMATION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .abejoe-coordinate-pulse {
        animation: none;
    }

    .abejoe-coordinate-toast {
        transition: none;
    }
}

/* Crosshair tetap di tengah area peta */
.abejoe-coordinate-crosshair {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 1000;
    width: 34px;
    height: 34px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    display: none;
}

.abejoe-coordinate-crosshair.active {
    display: block;
}

.abejoe-coordinate-crosshair::before,
.abejoe-coordinate-crosshair::after {
    content: "";
    position: absolute;
    background: #e53935;
    border-radius: 2px;
    box-shadow: 0 0 2px #fff;
}

.abejoe-coordinate-crosshair::before {
    width: 2px;
    height: 34px;
    left: 16px;
    top: 0;
}

.abejoe-coordinate-crosshair::after {
    width: 34px;
    height: 2px;
    left: 0;
    top: 16px;
}

.abejoe-coordinate-crosshair .crosshair-center {
    position: absolute;
    width: 7px;
    height: 7px;
    left: 13.5px;
    top: 13.5px;
    border: 2px solid white;
    background: #e53935;
    border-radius: 50%;
}
