#map { position: fixed; inset: 0; z-index: 1; }

/* --- DIALOGS --- */

.dialog-base {
    position: relative;
    display: none;
    margin: auto;

    background: white;
    border-radius: 12px;
    border-width: 0px;
    padding: 28px;

    width: 100%;
    max-width: 540px;
    max-height: 90dvh;
    overflow-y: auto;

    box-shadow: 0 8px 32px rgba(0,0,0,0.3); position: relative;

    &::backdrop { background: rgba(0,0,0,0.5); }

    button {
        position: fixed;
        inset: 0px;
        background: transparent;
        z-index: -1;
    }

    .dialog-content {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: start;
        gap: 0.4rem;

        h1 { margin-bottom: 0.5rem;}
        h1, h2, h3, h4 { margin-top: 0.5rem; }
        h2 {
            padding-inline: 1rem;
            padding-block: 0.5rem;
            width: 100%;
            color: white;
            background: #FBB900;
        }

        img {
            margin-inline: auto;
            max-width: 90%;
            max-height: 300px;
        }
    }
}

#overlay {
    display: none; position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,0.5); justify-content: center; align-items: center;
}
#overlay.active { display: flex; }

#form-panel {
    background: white; border-radius: 12px; padding: 28px;
    width: 90%; max-width: 540px; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3); position: relative;
}
#form-panel h2 { margin-bottom: 20px; color: #2c3e50; font-size: 20px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; color: #34495e; font-size: 14px; }
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #ddd;
    border-radius: 8px; font-size: 14px; transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: #3498db;
}
.form-group textarea { resize: vertical; min-height: 80px; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.checkbox-group label {
    display: flex; align-items: center; gap: 6px;
    font-weight: 400; font-size: 13px; color: #555;
    background: #f8f9fa; padding: 6px 12px; border-radius: 6px;
    border: 1px solid #e9ecef; cursor: pointer; transition: all 0.2s;
}
.checkbox-group label:hover { border-color: #3498db; background: #eef5ff; }
.checkbox-group input[type="checkbox"] { accent-color: #3498db; }
.checkbox-group input[type="checkbox"]:checked + span { color: #2c3e50; font-weight: 500; }

.coords-display {
    background: #f8f9fa; padding: 10px 12px; border-radius: 8px;
    font-size: 13px; color: #666; border: 1px solid #e9ecef;
}
.coords-display span { font-weight: 600; color: #2c3e50; }
.hint { font-size: 12px; color: #999; margin-top: 4px; }

.coords-inputs { display: flex; flex-direction: row; }

#btn-use-map {
    background: #3498db; color: white; border: none; border-radius: 8px;
    padding: 8px 14px; font-size: 13px; cursor: pointer; margin-top: 6px;
}
#btn-use-map:hover { background: #2980b9; }

/* ---BUTTONS --- */

.btn-base {
    color: white;
    background: #F9B700; /* yellow */
    border: none; border-radius: 8px;;
    font-size: 16px; font-weight: 600;
    cursor: pointer; transition: background 0.2s;
    padding-inline: 2.5rem;
    padding-block: 0.5rem;
    &:hover { filter: brightness(90%) contrast(120%); }
    &:active { translate: 0 2px; }
}

.btn-submit,
.btn-reset,
.dynamic-marker-button {
    width: 100%;
}

.btn-reset { margin-top: 0.5rem; }

.leaflet-control-add-billboard-btn { background: #F92B00; }
.leaflet-control-add-billboard-btn,
.leaflet-control-tutorial-btn {
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
    transition: transform 0.2s, background 0.2s;

    &:hover { transform: scale(1.05); }
}

.btn-submit { background: #FE9C07; color: white; padding: 14px; }
.btn-reset { background: white; color: grey; padding: 10px; }
.dynamic-marker-button {
    background: #F92B00; color: white; padding: 2px;
    font-size: 14px; font-weight: 600; margin-top: 0px;
}
.btn-submit:hover,
.dynamic-marker-button:hover { background: #E68B01; }
.btn-reset:hover { background: #EBEBEB; }
.btn-submit:disabled { background: #bdc3c7; cursor: not-allowed; }

#btn-close {
    position: absolute; top: 12px; right: 16px; background: none;
    border: none; font-size: 24px; cursor: pointer; color: #999; line-height: 1;
}
#btn-close:hover { color: #333; }

.error-msg { color: #e74c3c; font-size: 13px; margin-top: 4px; display: none; }

.success-toast {
    position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
    background: #27ae60; color: white; padding: 14px 28px;
    border-radius: 8px; font-weight: 600; z-index: 3000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2); display: none;
}
.success-toast.active { display: block; }

.billboard-popup img { width: 100%; max-width: 200px; border-radius: 6px; margin-bottom: 8px; }
.billboard-popup .meta { font-size: 12px; color: #666; }
.billboard-popup .btn-details {
    display: inline-block; margin-top: 8px; padding: 6px 14px;
    background: #3498db; color: white; border: none; border-radius: 6px;
    font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
    transition: background 0.2s;
}
.billboard-popup .btn-details:hover { background: #2980b9; }

/* Detail side panel */
#detail-panel {
    position: fixed; top: 0px; right: 0; bottom: 0; width: 420px;
    background: white; z-index: 1500; box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    transform: translateX(100%); transition: transform 0.3s ease;
    overflow-y: auto;
}
#detail-panel.active { transform: translateX(0); }
@media (max-width: 520px) { #detail-panel { width: 100%; } }

.detail-header {
    position: sticky; top: 0; background: white; z-index: 1;
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #eee;
}
.detail-header h3 { margin: 0; font-size: 17px; color: #2c3e50; }
.detail-close {
    background: none; border: none; font-size: 22px; cursor: pointer;
    color: #999; line-height: 1; padding: 4px;
}
.detail-close:hover { color: #333; }

.detail-body { padding: 20px; }
.detail-body .detail-photo {
    width: 100%; border-radius: 8px; margin-bottom: 16px; cursor: pointer;
    transition: opacity 0.2s;
}
.detail-body .detail-photo:hover { opacity: 0.9; }

.detail-body .detail-section {
    margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid #f0f0f0;
}
.detail-body .detail-section:last-child { border-bottom: none; }
.detail-body .detail-section h4 {
    font-size: 11px; font-weight: 700; color: #8e99a4; text-transform: uppercase;
    letter-spacing: 0.5px; margin-bottom: 8px;
}
.detail-body .detail-row {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 4px 0; font-size: 14px;
}
.detail-row .label { color: #666; }
.detail-row .value { color: #2c3e50; font-weight: 500; text-align: right; max-width: 60%; }

.detail-photos-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.detail-photos-grid.single { grid-template-columns: 1fr; }
.detail-photo-card { text-align: center; }
.detail-photo-card img {
    width: 100%; border-radius: 8px; cursor: pointer; transition: opacity 0.2s;
}
.detail-photo-card img:hover { opacity: 0.9; }
.detail-photo-card .photo-label {
    font-size: 12px; color: #888; margin-top: 6px;
}

.detail-remark {
    background: #f8f9fa; padding: 12px; border-radius: 8px;
    font-size: 14px; color: #555; font-style: italic; line-height: 1.5;
}

.spinner {
    display: inline-block; width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3); border-radius: 50%;
    border-top-color: white; animation: spin 0.6s linear infinite;
    vertical-align: middle; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.user-location-dot {
    width: 16px; height: 16px; background: #4285f4;
    border: 3px solid white; border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(66,133,244,0.3), 0 2px 4px rgba(0,0,0,0.3);
}
.user-location-ring {
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(66,133,244,0.15); border: 1px solid rgba(66,133,244,0.3);
    animation: pulse-ring 2s ease-out infinite;
}
@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

.map-context-menu {
    display: none; position: fixed; z-index: 1500;
    background: white; border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2); padding: 4px 0; min-width: 240px;
}
.map-context-menu.active { display: block; }
.map-context-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    background: none; border: none; padding: 10px 16px; font-size: 14px;
    color: #2c3e50; cursor: pointer; text-align: left;
}
.map-context-menu button:hover { background: #f0f0f0; }
.map-context-menu button .ctx-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; color: #e74c3c; font-size: 16px; }

.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: rgba(254, 156, 7, 0.3); }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background: rgba(254, 156, 7, 0.95); color: white; font-weight: 700; font-size: 13px; }
.marker-cluster-medium { background: rgba(254, 156, 7, 0.35); }
.marker-cluster-large { background: rgba(254, 156, 7, 0.45); }

.leaflet-control-geocoder { border-radius: 8px !important; box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important; border: none !important; }
.leaflet-control-geocoder-form input { font-size: 14px !important; padding: 8px 12px !important; height: 38px !important; }

.section-title {
    font-size: 13px; font-weight: 700; color: #8e99a4; text-transform: uppercase;
    letter-spacing: 0.5px; margin: 20px 0 10px; padding-top: 12px; border-top: 1px solid #eee;
}
.section-title:first-of-type { margin-top: 0; border-top: none; padding-top: 0; }

.leaflet-control-locate.control-active a { background: #4185F4 !important; }
.leaflet-control-locate.control-active svg { color: white; }

.leaflet-bar.leaflet-control-logo { opacity: 60%; transition: opacity 200ms ease-in-out; }
.leaflet-bar.leaflet-control-logo:hover { opacity: 100%; }
.leaflet-bar.leaflet-control-logo a { width: fit-content; height: fit-content; padding: 0.3rem 0.3rem 0 0.5rem; }
.leaflet-bar.leaflet-control-logo a:hover { background-color: #fff !important; }

.divicon-dot {
    width: 24px; height: 24px;
    background: black;
    border:3px solid white;
    border-radius:50%;
    box-shadow:0 2px 6px rgba(0,0,0,0.35);
}
.divicon-dot-red { background: #E63312; }
.divicon-dot-green { background: #009869; }
.divicon-dot-yellow { background: #FE9C07; }
.divicon-dot-blue { background: #4185F4; }

/* --- LEAFLET CONTROLS */

.leaflet-control.leaflet-control-tutorial {
    height: fit-content;
    width: fit-content;
}
.leaflet-control-tutorial a.leaflet-control-tutorial-toggle {
    height: fit-content;
    width: fit-content;
}

