﻿/* ============================================================
   TrackMyRide Public Map
   ============================================================ */

/* ------------------------------------------------------------
   Main page layout
   ------------------------------------------------------------ */

#right-column {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow: hidden;
}


/* ------------------------------------------------------------
   Main map/device container
   ------------------------------------------------------------ */

#map-container {
    display: flex;
    flex-direction: row;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow: hidden;
}


/* ------------------------------------------------------------
   Map
   ------------------------------------------------------------ */

#map {
    flex: 0 0 85%;
    width: 85%;
    height: 100%;
    min-height: 0;
}


/* ------------------------------------------------------------
   Device panel
   ------------------------------------------------------------ */

#device-panel {
    flex: 0 0 15%;
    width: 15%;
    padding: 10px;
    background: #f5f5f5;
    border-left: 1px solid #ccc;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* Do not allow the entire panel to scroll */
    overflow: hidden;
}


    /* ------------------------------------------------------------
   Device panel heading
   ------------------------------------------------------------ */

    #device-panel h3 {
        margin-top: 0;
    }


/* ------------------------------------------------------------
   Device list
   ------------------------------------------------------------ */

#device-list {
    list-style: none;
    padding-left: 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}


    /* ------------------------------------------------------------
   Device list items
   ------------------------------------------------------------ */

    #device-list li {
        padding: 6px 4px;
        border-bottom: 1px solid #ddd;
        cursor: pointer;
    }


/* ------------------------------------------------------------
   Hidden elements
   ------------------------------------------------------------ */

.hidden {
    display: none !important;
}


/* ------------------------------------------------------------
   Device list caret
   ------------------------------------------------------------ */

.caret {
    margin-left: 8px;
    font-size: 14px;
    transition: transform 0.2s ease;
    display: inline-block;
}

.caret-right {
    transform: rotate(0deg);
}

.caret-down {
    transform: rotate(90deg);
}


/* ------------------------------------------------------------
   Bottom message bar
   ------------------------------------------------------------ */

#bottom-bar {
    flex: 0 0 150px;
    height: 150px;
    min-height: 150px;
    padding: 10px;
    background: #eee;
    border-top: 1px solid #ccc;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
}


/* ------------------------------------------------------------
   Device checkbox
   ------------------------------------------------------------ */

.device-checkbox {
    margin-right: 6px;
}


/* ------------------------------------------------------------
   Highlight marker when popup is open
   ------------------------------------------------------------ */

.leaflet-marker-icon.active-marker {
    filter: drop-shadow(0 0 6px #00aaff);
    transition: filter 0.2s ease;
}


/* ------------------------------------------------------------
   Track button
   ------------------------------------------------------------ */

.track-btn {
    margin-top: 8px;
    padding: 6px 10px;
    background: #eee;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    font-size: 13px;
    border: 1px solid #ccc;
}

    .track-btn.active {
        background: #00aaff;
        color: white;
        border-color: #0088cc;
    }


/* ------------------------------------------------------------
   Popup close button
   ------------------------------------------------------------ */

.popup-close-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

    .popup-close-btn:hover svg path {
        stroke: #ff4444;
    }


/* ------------------------------------------------------------
   Font Awesome map icon
   ------------------------------------------------------------ */

.fa-map-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.fa-icon-wrapper {
    transition: transform 0.2s linear;
}


/* ------------------------------------------------------------
   Device marker icon
   ------------------------------------------------------------ */

/* FIX: Make the wrapper actually wrap the image */
.device-icon {
    width: 50px !important;
    height: 50px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: auto !important;
}


    /* Allow click-through on the image itself */
    .device-icon img {
        pointer-events: none;
    }


/* Ensure Leaflet marker receives clicks */
.leaflet-marker-icon,
.leaflet-marker-icon * {
    pointer-events: auto !important;
}


/* Keep marker above other layers */
.leaflet-marker-pane .leaflet-marker-icon {
    z-index: 600 !important;
}


/* ------------------------------------------------------------
   History popup close button
   ------------------------------------------------------------ */

#mdlHistoryModal .close {
    font-size: 2rem;
    padding: 0.75rem 1rem;
    line-height: 1;
}

#clear-device-selection,
#pause-mqtt {
    margin-bottom: 8px;
    padding: 5px 10px;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #eee;
    font-size: 14px;
    width: 100%;
}

    #clear-device-selection:hover,
    #pause-mqtt:hover {
        background: #ddd;
    }

/* ------------------------------------------------------------
   Device search
   ------------------------------------------------------------ */

.device-search {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
}

    .device-search:focus {
        border-color: #888;
        box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
    }

.device-list-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    vertical-align: middle;
    margin-left: 4px;
    margin-right: 6px;
}