/**
 * Map Search Styles
 */

.leaflet-control-search {
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
    z-index: 1000;
}

.map-search-container {
    position: relative;
    z-index: 1000;
}

/* Make the panel escape the control and position relative to map */
.leaflet-map-wrapper {
    position: relative;
}

.map-search-toggle {
    background: white;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 18px;
    color: #333;
    display: block;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-search-toggle:hover {
    background-color: #f4f4f4;
}

.map-search-panel {
    position: fixed;
    top: auto;
    right: auto;
    padding: 10px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    width: 300px;
    overflow-y: scroll;
    z-index: 999;
}

/* Position the panel using JavaScript to align with map */
.map-search-panel[data-positioned="true"] {
    position: fixed;
}

.map-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #ddd;
}

.map-search-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.map-search-close {
    background: transparent;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.2s;
}

.map-search-close:hover {
    background: #f4f4f4;
    color: #333;
}

.map-search-disclaimer {
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    padding: 6px 8px;
    margin-bottom: 8px;
    font-size: 10px;
    color: #856404;
    line-height: 1.4;
    display: block;
}

.map-search-disclaimer a {
    color: #856404 !important;
    text-decoration: underline !important;
    font-weight: 600 !important;
    background: none !important;
    background-color: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    display: inline !important;
    line-height: inherit !important;
}

.map-search-disclaimer a:hover {
    color: #533f03 !important;
    background: none !important;
    background-color: transparent !important;
}

.map-search-input-wrapper {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.map-search-area-btn {
    margin-bottom: 6px;
}

.search-this-area-btn {
    width: 100%;
    padding: 6px 10px;
    background: #0c55cc;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.search-this-area-btn:hover {
    background: #0a47a8;
}

.search-this-area-btn i {
    margin-right: 4px;
}

.map-search-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
}

.map-search-input:focus {
    outline: none;
    border-color: #0c55cc;
}

.map-search-btn,
.map-search-clear {
    background: #0c55cc;
    color: white;
    border: none;
    padding: 6px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.map-search-btn:hover {
    background: #0a47a8;
}

.map-search-clear {
    background: #dc3545;
    padding: 6px 8px;
}

.map-search-clear:hover {
    background: #c82333;
}

.map-search-suggestions {
    margin-bottom: 6px;
}

.search-message {
    padding: 8px;
    text-align: center;
    color: #666;
    font-size: 12px;
}

.search-message.error {
    color: #dc3545;
}

.search-message i.fa-spinner {
    margin-right: 4px;
}

.search-results-list {
    margin-top: 6px;
}

.search-results-header {
    font-weight: 600;
    padding: 6px 0;
    border-bottom: 1px solid #ddd;
    margin-bottom: 6px;
    font-size: 12px;
}

.search-result-item {
    padding: 8px 6px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-result-item:hover {
    background-color: #f0f7ff;
}

.search-result-item:last-child {
    border-bottom: none;
}

.result-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
    font-size: 12px;
}

.result-type {
    color: #666;
    font-size: 11px;
    text-transform: capitalize;
    margin-bottom: 2px;
}

.result-address {
    color: #888;
    font-size: 11px;
    line-height: 1.3;
}

/* Popup styles */
.search-result-popup {
    font-family: 'Montserrat', sans-serif;
    line-height: 1.6;
}

.search-result-popup strong {
    font-size: 14px;
    display: block;
    margin-bottom: 4px;
}

.search-result-popup small {
    font-size: 12px;
    color: #666;
}

.search-result-popup .result-type {
    color: #0c55cc;
    font-weight: 500;
}

.search-result-popup a {
    color: #0c55cc;
    text-decoration: none;
}

.search-result-popup a:hover {
    text-decoration: underline;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .map-search-panel {
        width: 260px;
        padding: 8px;
    }

    .map-search-input {
        font-size: 14px;
    }

    .search-result-item {
        padding: 8px 4px;
    }
}

/* Ensure search control appears above other map controls */
.leaflet-control-search {
    z-index: 800;
}
