html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.page {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

/*
 * Oculta o painel de erro do Blazor por padrão, evitando que ele apareça
 * indevidamente quando não há erros reais na aplicação.
 * O script _framework/blazor.server.js normalmente cuida disso, mas em cenários
 * onde o script não é carregado corretamente, o estilo abaixo garante que o
 * painel permaneça escondido.
 * Caso ocorra um erro real, o próprio script do Blazor removerá a propriedade
 * `display: none`.
 *
 * Português: A div "blazor-error-ui" é ocultada para não aparecer sem motivo.
 *
 * English: Hide Blazor error UI panel by default.
 *
 * Spanish (Trilingual requirement in README maybe? I'll check: there is no instruction about languages except in README. But the user or instructions talk about Portuguese, so we can keep as is. )
 */

/* Ocultar panel de error (Spanish translation) for completeness. */
#blazor-error-ui {
    display: none;
}

#map {
    height: calc(100vh - 96px) !important;
    width: 100%;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2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ggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    overflow-x: hidden;
}

header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    text-align: center;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1000;
}

    header h1 {
        margin: 0;
        font-size: 1.8rem;
        font-weight: 600;
        letter-spacing: 1px;
    }

#map {
    height: calc(100vh - 120px);
    width: 100%;
    position: relative;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    font-weight: 500;
    color: #2c3e50;
}

    .loading.hidden {
        display: none;
    }

.controls-panel {
    position: fixed;
    top: 128px;
    right: 0;
    transform: none;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 15px 0 0 15px;
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
    z-index: 1000;
    width: 350px;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid rgba(0,0,0,0.1);
    transition: max-height 0.3s ease;
}

.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
    border-radius: 15px 0 0 0;
}

    .controls-header h3 {
        margin: 0;
        font-size: 1.1rem;
    }

.controls-panel.collapsed {
    max-height: 50px;
    overflow-y: hidden;
}

    .controls-panel.collapsed .controls-content {
        display: none;
    }

.toggle-btn {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}


.controls-panel.collapsed .toggle-btn {
    transform: rotate(180deg);
}

.toggle-btn:hover {
    background: linear-gradient(135deg, #2980b9, #1f5f99);
    transform: scale(1.05);
}

.controls-content {
    padding: 15px;
    width: 100%;
}

    .controls-content h3 {
        margin: 0 0 15px 0;
        color: #2c3e50;
        font-size: 1.1rem;
        font-weight: 600;
        border-bottom: 2px solid #ecf0f1;
        padding-bottom: 8px;
    }

.checkbox-group {
    margin-bottom: 25px;
}

    .checkbox-group label {
        display: flex;
        align-items: center;
        margin-bottom: 12px;
        padding: 8px 12px;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.2s ease;
        background: rgba(255, 255, 255, 0.7);
        border: 1px solid rgba(0,0,0,0.05);
    }

        .checkbox-group label:hover {
            background: rgba(52, 152, 219, 0.1);
            transform: translateX(2px);
        }

    .checkbox-group input[type="checkbox"] {
        margin-right: 10px;
        width: 18px;
        height: 18px;
        accent-color: #3498db;
        cursor: pointer;
    }

.checkbox-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    border-radius: 4px;
    object-fit: cover;
}

.remove-layer-btn {
    margin-left: auto;
    background: transparent;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 6px;
}

    .remove-layer-btn:hover {
        color: #c0392b;
    }

.measure-btn {
    margin-top: 10px;
    width: 100%;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px;
    cursor: pointer;
}

.measure-btn-active {
    background: #dc3545;
}

.measure-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 10px 0;
    font-size: 0.9rem;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1000;
}

    footer p {
        margin: 0;
    }

/* Custom Info Window Styles */
.custom-info-window {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    width: 480px;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.info-header {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 15px 20px;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

    .info-close:hover {
        color: #ffb3b3;
    }

.info-content {
    padding: 20px;
    background: white;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #ecf0f1;
}

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

.info-label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.info-value {
    color: #34495e;
    font-size: 0.9rem;
    text-align: right;
    max-width: 60%;
}

.photo-gallery {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #ecf0f1;
}

    .photo-gallery h5 {
        margin: 0 0 10px 0;
        color: #2c3e50;
        font-size: 0.95rem;
        font-weight: 600;
    }

.photo-thumbnails {
    display: flex;
    gap: 10px;
}

.photo-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid #ecf0f1;
    transition: all 0.3s ease;
}

    .photo-thumb:hover {
        border-color: #3498db;
        transform: scale(1.05);
        box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    }

/* Modal Styles */
.photo-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-image {
    width: 100%;
    height: auto;
    display: block;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

    .modal-close:hover {
        background: rgba(255, 0, 0, 0.7);
        transform: scale(1.1);
    }

/* Responsive Design */
@media (max-width: 768px) {
    .controls-panel {
        position: fixed;
        top: 80px;
        right: 0;
        left: 0;
        transform: none;
        border-radius: 0;
        max-height: none;
        height: auto;
        transition: transform 0.3s ease;
    }

        .controls-panel.collapsed {
            max-height: 50px;
        }

    .toggle-btn {
        position: fixed;
        top: 85px;
        right: 15px;
        left: auto;
        border-radius: 50%;
        z-index: 1001;
    }

    .controls-content {
        min-width: auto;
        max-width: none;
        padding: 15px 20px;
    }

    #map {
        height: calc(100vh - 140px);
    }

    header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .controls-content {
        padding: 15px;
    }

    .checkbox-group label {
        padding: 6px 10px;
        font-size: 0.9rem;
    }

    .custom-info-window {
        max-width: 280px;
    }

    .info-content {
        padding: 15px;
    }
}


/* Modal Animation */
.photo-modal {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-content {
    animation: modalZoom 0.3s ease;
}

@keyframes modalZoom {
    from {
        transform: translate(-50%, -50%) scale(0.7);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Smooth transitions for all interactive elements */
* {
    transition: all 0.2s ease;
}

button, input[type="checkbox"], .photo-thumb, .toggle-btn {
    transition: all 0.3s ease;
}

/* Hide default Google Maps close button */
.gm-style-iw > button.gm-ui-hover-effect {
    display: none !important;
}

/* Distance measurement modal */
.distance-modal {
    display: none;
    position: fixed;
    z-index: 11000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.distance-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    text-align: center;
}

.distance-confirm-btn {
    margin-top: 10px;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
}

.distance-cancel-btn {
    margin-top: 10px;
    margin-left: 10px;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
}

/* ===== InfoWindow de Detalhes =====  */
.gm-style-iw-d {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 0.92rem;
}

.iw-row {
    display: flex;
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
}

.iw-row:last-child {
    border-bottom: none;
}

.iw-label {
    font-weight: 600;
    color: #555;
    margin-right: 8px;
    min-width: 130px;
}

.iw-value {
    color: #333;
    flex: 1;
}

/* Botão de fechar padrão do InfoWindow */
.gm-style-iw button.gm-ui-hover-effect {
    top: 2px !important;
    right: 2px !important;
}


/* ===== Galeria de Fotos (InfoWindow) ===== */
.iw-photo-gallery {
    margin-top: 10px;
    padding-top: 8px;
}

.iw-photo-gallery h6 {
    margin-bottom: 10px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

.iw-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.iw-photo-thumb {
    cursor: pointer;
    overflow: hidden;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    transition: all 0.2s ease;
    aspect-ratio: 4/3;
    background: #f8f9fa;
}

.iw-photo-thumb:hover {
    border-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.iw-photo-thumb.no-photo {
    cursor: default;
    opacity: 0.5;
}

.iw-photo-thumb.no-photo:hover {
    border-color: #e0e0e0;
    transform: none;
    box-shadow: none;
}

.iw-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===== Overlay de foto ampliada ===== */
.photo-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 20000;
}

.photo-overlay-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.9);
}

.photo-overlay-content {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90vw;
    max-height: 90vh;
}

.photo-overlay-image {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    display: block;
    border-radius: 4px;
}

.photo-overlay-close {
    position: absolute;
    top: -40px; right: 0;
    background: transparent;
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    width: 40px; height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.photo-overlay-close:hover {
    color: #ff4444;
    transform: rotate(90deg);
}

@media (max-width: 768px) {
    .iw-photo-grid.count-1 { max-width: 150px; }
    .iw-photo-grid.count-3plus { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
    .photo-overlay-close {
        top: 10px; right: 10px;
        font-size: 2rem;
        background: rgba(0,0,0,0.7);
        border-radius: 50%;
    }
}
