/* ==========================================================================
   Archaea Locations Map – base stylesheet (rev 2025-05-22b)
   Matches Google Maps control aesthetics; no duplicate rules.
   ========================================================================== */

/* Global layout ----------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    /* universal border-box */
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: Roboto, Arial, sans-serif;
    /* Google Maps default stack */
    font-size: 14px;
}

#map {
    height: 100%;
}

h3 {
    margin-top: 0;
}

/* “Card” appearance (mirrors .gm-style-control) -------------------------- */
.gm-card {
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 2px;
    box-shadow: 0 2px 6px rgba(60, 64, 67, .30);
}

/* ------------------------------------------------------------------------ */
/* Legend                                                                   */
/* ------------------------------------------------------------------------ */
#legend {
    position: absolute;
    top: 80px;
    /* leaves room for Map/Satellite buttons */
    left: 10px;
    z-index: 998;
    padding: 10px 12px;
    min-width: 160px;
}

#legend {
    composes: gm-card;
}

/* (static CSS: repeated below) */
#legend {
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 2px;
    box-shadow: 0 2px 6px rgba(60, 64, 67, .30);
}

#legend h2 {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}

#legendList,
.subcategory-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0;
    cursor: pointer;
    line-height: 20px;
}

.legend-item:hover {
    background: #f1f3f4;
}

.legend-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.legend-label {
    flex: 1 1 auto;
}

.subcategory-list {
    margin-left: 26px;
}

/* -------------------------------------------------------------------- */
/* Dataset-download links                                               */
/* -------------------------------------------------------------------- */
#downloadLinks {
    margin-top: 15px;
}

#downloadLinks a {
    display: block;
    font-size: 13px;
    color: #1a73e8;
    text-decoration: none;
}

#downloadLinks a:hover {
    text-decoration: underline;
}

/* ------------------------------------------------------------------------ */
/* Search                                                                   */
/* ------------------------------------------------------------------------ */
#searchContainer {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    /* centre horizontally */
    z-index: 998;
    width: 280px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 2px;
    box-shadow: 0 2px 6px rgba(60, 64, 67, .30);
}

.search-input-wrapper {
    position: relative;
}

#searchBox {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #dadce0;
    border-radius: 2px;
    outline: none;
}

#searchBox:focus {
    border-color: #4285f4;
}

/* clear (“×”) button ----------------------------------------------------- */
.clear-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    color: #5f6368;
    cursor: pointer;
}

.clear-btn:hover {
    background: #f1f3f4;
    border-radius: 50%;
}

.clear-btn:focus {
    outline: none;
}

/* results list ----------------------------------------------------------- */
#searchResults {
    max-height: 220px;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 0;
}

.search-item {
    padding: 4px 6px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-item:hover,
.search-item.active {
    background: #f1f3f4;
}

/* ------------------------------------------------------------------------ */
/* InfoWindow table                                                         */
/* ------------------------------------------------------------------------ */
#infoWindowProps {
    font-size: 13px;
}

.propName {
    padding-right: 12px;
    font-weight: 600;
}

/* ------------------------------------------------------------------------ */
/* Loading overlay                                                          */
/* ------------------------------------------------------------------------ */
#loadingIndicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    padding: 20px 30px;
    text-align: center;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(60, 64, 67, .30);
    display: none;
}

#loadingIndicator .spinner {
    width: 56px;
    height: 56px;
    margin: 12px auto;
    border: 8px solid #f3f3f3;
    border-top: 8px solid #4285f4;
    border-radius: 50%;
    animation: spin 1.4s linear infinite;
}

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

#dimBackground {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999;
    display: none;
}