/* =========================================================
   SDR PREMIUM MEASURE TOOL & TOOLTIPS
   Modern / Glass / Minimal / Precision
   ========================================================= */


/* =========================================================
   MEASURE PANEL CONTAINER (DOCK)
   ========================================================= */

.measure-panel {
    position: absolute !important;
    top: 175px !important;
    left: 14px !important;
    z-index: 1100 !important;

    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;

    padding: 4px !important;
    margin: 0 !important;
    box-sizing: border-box !important;

    border-radius: 999px !important;
    border: 1px solid rgba(255, 255, 255, 0.92) !important;

    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.88),
        rgba(255, 255, 255, 0.70)
    ) !important;

    box-shadow:
        0 2px 5px rgba(15, 23, 42, 0.04),
        0 8px 24px rgba(15, 23, 42, 0.08),
        0 18px 38px rgba(15, 23, 42, 0.10) !important;

    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);

    user-select: none;
    -webkit-user-select: none;
    isolation: isolate;

    animation: sdr-measure-enter 0.5s cubic-bezier(.16, 1, .3, 1) both;
}

/* Subtle dock glow */
.measure-panel::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.95),
        rgba(207, 244, 228, 0.28),
        rgba(255, 255, 255, 0.85)
    );
    z-index: -1;
    pointer-events: none;
}


/* =========================================================
   MEASURE BUTTONS
   ========================================================= */

.measure-panel .measure-btn {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    width: 36px !important;
    height: 36px !important;
    box-sizing: border-box !important;

    border-radius: 50% !important;
    border: 1px solid transparent !important;
    outline: none !important;

    background: transparent !important;
    color: #173b38 !important;

    font-family: inherit !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1 !important;

    cursor: pointer !important;
    overflow: hidden !important;

    transition:
        transform 0.3s cubic-bezier(.16, 1, .3, 1),
        background 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease,
        color 0.3s ease !important;
}

/* Button light sweep reflection */
.measure-panel .measure-btn::before {
    content: "";
    position: absolute;
    top: -80%;
    left: -50%;
    width: 50%;
    height: 260%;
    transform: rotate(25deg) translateX(-180%);
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.45),
        transparent
    );
    pointer-events: none;
    transition: transform 0.65s cubic-bezier(.16, 1, .3, 1);
}

.measure-panel .measure-btn:hover::before {
    transform: rotate(25deg) translateX(420%);
}


/* =========================================================
   BUTTON HOVER & ACTIVE
   ========================================================= */

.measure-panel .measure-btn:hover {
    transform: scale(1.08) !important;

    background: linear-gradient(
        145deg,
        #ffffff 0%,
        #e8faf2 100%
    ) !important;

    color: #078e80 !important;
    border-color: rgba(7, 145, 130, 0.25) !important;

    box-shadow:
        inset 0 1px 1px #ffffff,
        0 3px 8px rgba(7, 145, 130, 0.12) !important;
}

.measure-panel .measure-btn:active {
    transform: scale(0.95) !important;
    transition-duration: 0.1s !important;
}

.measure-panel .measure-btn:focus-visible {
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.95),
        0 0 0 5px rgba(7, 145, 130, 0.30) !important;
}

/* Active measuring state on button (toggle on) */
.measure-panel .measure-btn.active {
    background: linear-gradient(
        135deg,
        #0b9a89 0%,
        #078e80 48%,
        #06766b 100%
    ) !important;
    color: #fbf1e7 !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.25),
        0 4px 10px rgba(7, 145, 130, 0.22) !important;
}


/* =========================================================
   MEASURE TOOLTIPS (CANVAS LABELS)
   ========================================================= */

/* Base Tooltip Badge */
.map-measure-tooltip {
    position: relative;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;

    padding: 5px 10px;
    border-radius: 999px;

    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;

    color: #173b38;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.95);

    box-shadow:
        0 2px 6px rgba(15, 23, 42, 0.08),
        0 8px 18px rgba(7, 145, 130, 0.10);

    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);

    pointer-events: none;
    user-select: none;
}

/* Floating dynamic tooltip during drawing */
.map-measure-tooltip-active {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.95),
        rgba(232, 250, 242, 0.90)
    );
    border: 1px solid rgba(7, 145, 130, 0.35);
    color: #078e80;
    box-shadow:
        0 4px 12px rgba(7, 145, 130, 0.14),
        0 0 0 3px rgba(7, 145, 130, 0.06);
}

/* Fixed finalized measurement label */
.map-measure-tooltip-static {
    background: linear-gradient(
        135deg,
        #0b9a89 0%,
        #078e80 50%,
        #06766b 100%
    );
    color: #fbf1e7;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.30),
        0 4px 10px rgba(7, 145, 130, 0.22),
        0 8px 18px rgba(15, 23, 42, 0.12);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* Small bottom triangle pointer for static labels */
.map-measure-tooltip-static::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px 5px 0 5px;
    border-style: solid;
    border-color: #06766b transparent transparent transparent;
}


/* =========================================================
   RESPONSIVE (MOBILE & TABLETS)
   ========================================================= */

@media (max-width: 768px) {
    .measure-panel {
        top: 155px !important;
        left: 10px !important;
        gap: 6px !important;
        padding: 3px !important;
    }

    .measure-panel .measure-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
    }

    .map-measure-tooltip {
        padding: 4px 8px;
        font-size: 11px;
    }
}

@media (max-width: 380px) {
    .measure-panel {
        top: 140px !important;
        left: 8px !important;
        padding: 2.5px !important;
    }

    .measure-panel .measure-btn {
        width: 30px !important;
        height: 30px !important;
    }
}


/* =========================================================
   ENTRANCE ANIMATION & ACCESSIBILITY
   ========================================================= */

@keyframes sdr-measure-enter {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
        filter: blur(3px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .measure-panel {
        animation: none !important;
    }
    .measure-panel .measure-btn,
    .measure-panel .measure-btn::before {
        transition: none !important;
    }
}