/* Base Layout & Typography */
body {
    margin: 0;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a1a;
    color: #f0f0f0;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

h1 {
    color: #fff;
    margin-bottom: 10px;
}

.map-info {
    color: #aaa;
    font-size: 14px;
    margin-bottom: 20px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #aaa;
    font-size: 18px;
}

.error {
    background: #5a1a1a;
    color: #ffaaaa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #8a2a2a;
    display: none; /* Hidden by default */
}

/* Map Component Container */
.map-component-wrapper {
    position: relative;
    border: 2px solid #444;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

/* Controls (Used in Editor) */
.controls {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

label {
    font-size: 14px;
    color: #ccc;
    font-weight: 600;
}

select {
    padding: 8px 12px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #2a2a2a;
    color: #fff;
    font-size: 14px;
    min-width: 250px;
    cursor: pointer;
}

select:hover {
    border-color: #666;
}

.info-text {
    color: #aaa;
    font-size: 14px;
    font-style: italic;
}

/* Leaflet Popup Overrides */
.leaflet-popup-content-wrapper {
    background: #ffffff !important; 
    color: #333333 !important;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
}

.leaflet-popup-content h3 {
    color: #58180D;
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.leaflet-popup-content p {
    margin: 8px 0;
    color: #333;
}

.leaflet-popup-content a {
    color: #58180D;
    text-decoration: none;
    font-weight: 600;
}

.leaflet-popup-content a:hover {
    text-decoration: underline;
}

/* Form Styles (Shared by Editor and Widget Popups) */
.pin-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 250px;
}

.pin-form strong {
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
}

.pin-form label {
    font-weight: 600;
    font-size: 13px;
    color: #555;
    margin-bottom: -5px;
}

.pin-form input,
.pin-form textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    color: #000;
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
}

.pin-form input:focus,
.pin-form textarea:focus {
    outline: none;
    border-color: #58180D;
}

/* Buttons */
.pin-form button, 
.location-display button {
    background: #58180D;
    color: white;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 4px;
    font-weight: bold;
    font-size: 13px;
    margin-top: 5px;
    transition: opacity 0.2s;
}

.pin-form button:hover, 
.location-display button:hover {
    opacity: 0.85;
}

.pin-form button.delete-btn, 
.location-display button.delete-btn {
    background: #c0392b;
    margin-top: 10px;
}

.button-group, 
.location-display .edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.button-group button {
    flex: 1;
    margin-top: 0;
}

.location-display p {
    margin: 5px 0;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 13px;
}

/* Add to map.css */
.pin-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
    color: #333; /* Ensure text is visible on light popup background */
}

.pin-form input, .pin-form textarea {
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.pin-form button {
    background: #58180D;
    color: white;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
}

.map-component-wrapper .leaflet-container {
    background: var(--color-bg-dark); /* Match your site theme */
    outline: 0;
}

/* This prevents the map from 'shifting' inside the div */
.leaflet-image-layer {
    image-rendering: -webkit-optimize-contrast; /* Keeps map text sharp */
    image-rendering: crisp-edges;
}