/* custom.css
   Side panel that shows attribute information for a clicked feature
   on the qgis2web-generated map. */

/* Shrink the map so the panel has room beside it, and let both
   fill the viewport instead of a fixed pixel size. */
html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto !important;
    height: auto !important;
    transition: right 0.25s ease;
}

/* When the panel is open, push the map's right edge over so the
   panel doesn't cover it. */
#map.panel-open {
    right: 340px;
}

/* Hide qgis2web's own floating popup so the side panel is the only
   attribute display (avoids showing the same info twice). */
.ol-popup {
    display: none !important;
}

/* --- Side panel --- */
#side-panel {
    position: fixed;
    top: 0;
    right: -340px; /* hidden off-screen until .open is added */
    width: 340px;
    height: 100%;
    background: #ffffff;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    font-family: Arial, Helvetica, sans-serif;
    transition: right 0.25s ease;
    box-sizing: border-box;
}

#side-panel.open {
    right: 0;
}

#side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #2c3e50;
    color: #ffffff;
    flex: 0 0 auto;
}

#side-panel-title {
    font-size: 15px;
    font-weight: bold;
    margin: 0;
    padding-right: 8px;
    word-break: break-word;
}

#side-panel-close {
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    background: none;
    border: none;
    color: #ffffff;
    padding: 0 4px;
}

#side-panel-close:hover {
    color: #cccccc;
}

#side-panel-content {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 16px;
}

#side-panel-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

#side-panel-content table tr {
    border-bottom: 1px solid #eeeeee;
}

#side-panel-content table td {
    padding: 6px 4px;
    vertical-align: top;
}

#side-panel-content table td.attr-label {
    font-weight: bold;
    color: #2c3e50;
    width: 40%;
    padding-right: 8px;
}

#side-panel-content table td.attr-value {
    color: #333333;
    word-break: break-word;
}

#side-panel-empty {
    color: #888888;
    font-size: 13px;
    font-style: italic;
}

/* Collapse the panel to a full-width overlay on small/mobile screens */
@media (max-width: 600px) {
    #map.panel-open {
        right: 0;
    }
    #side-panel {
        width: 100%;
        right: -100%;
    }
    #side-panel.open {
        right: 0;
    }
}
