/**
 * Plik: map-styles.css
 * Wersja: 3.1.1
 * Migracja: Nowe style dla Terra Draw toolbar i PlaceAutocompleteElement.
 */

/* --- 1. Kontener główny --- */
#gmac-map-container {
    border: none;
    padding: 0;
    box-shadow: none;
    position: relative; 
}

#gmac-map {
    margin-bottom: 10px;
}

/* --- 2. Kontener wyszukiwania --- */
#gmac-search-container {
    position: absolute;
    top: 10px;
    left: 75px;
    z-index: 5;
    width: 300px;
    max-width: calc(100% - 370px);
    box-sizing: border-box;
    margin: 0;
}

/* Stylowanie Web Componentu PlaceAutocompleteElement */
#gmac-pac-element,
gmp-place-autocomplete {
    display: block;
    width: 100%;
    box-sizing: border-box;
    color-scheme: light !important;
    background-color: #ffffff !important;
    color: #333333 !important;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Stylowanie pola autouzupełniania input */
#gmac-pac-input {
    background-color: #ffffff;
    color: #333333;
    font-family: Roboto, Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    padding: 9px 12px;
    width: 100%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    margin: 0;
    outline: none;
}

#gmac-pac-input:focus {
    border-color: #4d90fe;
}

/* Zapobieganie przesłanianiu wyszukiwarki przez wyniki autouzupełniania */
.pac-container {
    z-index: 10000 !important;
}

/* --- 3. Toolbar rysowania (zamiennik DrawingManager controls) --- */
#gmac-toolbar {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    display: flex;
    gap: 0;
    background: #fff;
    border-radius: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.gmac-toolbar-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    border: none;
    background: #fff;
    color: #333;
    font-family: Roboto, Arial, sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    line-height: 1;
    white-space: nowrap;
}

.gmac-toolbar-btn:not(:last-child) {
    border-right: 1px solid #e0e0e0;
}

.gmac-toolbar-btn:hover {
    background-color: #f5f5f5;
}

.gmac-toolbar-btn--active {
    background-color: #e8f5e9 !important;
    color: #2e7d32;
}

/* Przycisk "Wyczyść" (kosz) — akcent destrukcyjny na hover */
.gmac-toolbar-btn--clear:hover {
    color: #c62828;
}

.gmac-toolbar-btn svg {
    flex-shrink: 0;
}

/* --- 3b. Etykieta powierzchni w środku wielokąta --- */
.gmac-area-label {
    position: absolute;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    color: #1b5e20;
    font-family: Roboto, Arial, sans-serif;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
}

/* --- 4. KONTROLKI MAPY --- */

/* ZOOM (+/-) (Top Left) */
.gm-style .gmnoprint[style*="left"] {
    transform: scale(1.15);
    transform-origin: top left;
}

/* --- 5. Sekcja Wynik / Przycisk --- */

#gmac-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    flex-wrap: wrap; 
    line-height: 1; 
}

.gmac-clear-btn {
    all: unset; 
    display: inline-block; 
    cursor: pointer;
    text-decoration: none; 
    margin: 0 !important; 
    vertical-align: top;
    line-height: 1;
    padding-bottom: 0 !important;
}


/* --- 6. Media Queries (Mobile) --- */
@media (max-width: 600px) {
    #gmac-search-container {
        position: absolute; 
        left: 75px;
        top: 10px;
        width: calc(100% - 90px); 
        max-width: 250px;
        margin: 0;
    }

    /* Bez skalowania kontrolki zoomu na mobile — inaczej dolny przycisk (−)
       nachodzi na toolbar poniżej. */
    .gm-style .gmnoprint[style*="left"] {
        transform: none;
    }

    #gmac-toolbar {
        top: 105px;
        left: 10px;
        right: auto;
        bottom: auto;
        width: 40px;
        box-sizing: border-box;
        flex-direction: column;
        align-items: center;
        border-radius: 0;
    }

    .gmac-toolbar-btn {
        width: 100%;
        padding: 11px 0;
        justify-content: center;
        box-sizing: border-box;
    }

    .gmac-toolbar-btn span {
        display: none; /* Na mobile ukryj tekst, pokaż tylko ikony */
    }

    .gmac-toolbar-btn:not(:last-child) {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    #gmac-controls {
        flex-direction: column;
        align-items: flex-start; 
        line-height: normal; 
    }

    #gmac-result-display {
        width: 100%;
        margin-bottom: 10px; 
        line-height: normal;
    }

    .gmac-clear-btn {
        width: 100%; 
        text-align: center; 
        line-height: normal; 
    }
}