@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');

body {
    font-family: 'Inter', sans-serif;
    background-color: #0c0a0c;
    color: #d1d5db;
    margin: 0;
    padding: 0;
}

#app-container {
    display: flex;
    height: 100dvh;
    overflow: hidden;
}

.editor-grid {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    column-gap: 30px;
    margin-top: 20px;
    align-items: start;
}

#map {
    flex-grow: 1;
    position: relative;
}

.location-list {
    background: #2a2a2a;
    padding: 20px;
    border-radius: 8px;
    height: 70vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.location-list {
    max-height: 240px;
    overflow-y: auto;
    padding-right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.list-item {
    background: #333;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    overflow: hidden;
    text-overflow: ellipsis;
}
.list-item .delete-btn {
    color: #ff4444;
    cursor: pointer;
    padding: 0 5px;
}
.list-item:hover {
    background: #444;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.list-item.selected {
    background: #555;
    border: 1px solid #888;
    box-shadow: 0 0 0 1px #aaa;
}
.mode-list, .location-list {
    background: #2a2a2a;
    padding: 15px;
    border-radius: 8px;
    overflow-y: auto;
}
.mode-list {
    max-height: 300px;
}

.image-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}
.image-preview {
    margin-top: 10px;
    text-align: center;
    width: 100%;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
#imageFileName {
    color: #888;
    font-size: 0.9em;
    display: block;
    margin: 10px 0;
    word-break: break-all;
}
.location-item:hover {
    background: #444;
}
.location-item.selected {
    background: #555;
    border: 1px solid #888;
}
.editor-form {
    background: #2a2a2a;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}
.form-group {
    margin-bottom: 15px;
    width: 100%;
}
label {
    display: block;
    margin-bottom: 8px;
    color: #ddd;
    font-weight: 500;
    font-size: 14px;
}
input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid #444;
    background: #333;
    color: #fff;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}
button {
    background: #4a4a4a;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    min-width: 100px;
}
button:hover {
    background: #555;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.button-group {
    margin-top: 25px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}
.json-preview {
    width: calc(100% - 20px);
    height: 200px;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 10px;
    background: #333;
    color: #fff;
    overflow: auto;
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 12px;
    resize: none;
    line-height: 1.5;
}
.hidden {
    display: none !important;
}

.empty-message {
    padding: 20px;
    color: #aaa;
    text-align: center;
    font-style: italic;
    border: 1px dashed #555;
    border-radius: 4px;
    margin: 20px 0;
}

.status-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 20px 30px;
    border-radius: 8px;
    z-index: 1000;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    text-align: center;
    min-width: 250px;
}

/* Animation for selected row */
.list-item.selected {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.2);
    }
    70% {
        box-shadow: 0 0 0 5px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

/* Improved form element focus states */
input:focus, select:focus, button:focus {
    outline: none;
    box-shadow: 0 0 0 2px #4a90e2;
    border-color: #4a90e2;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }
    
    .location-list {
        height: 50vh;
        margin-bottom: 20px;
    }
    
    .coordinates-container {
        grid-template-columns: 1fr !important;
    }
    
    .image-section {
        grid-template-columns: 1fr !important;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .button-group button {
        width: 100%;
    }
    
    .image-preview img {
        max-width: 100%;
    }
}

#sidebar {
    min-width: 316px;
    width: 450px;
    /* Adjusted initial width */
    max-height: 100dvh;
    overflow-y: auto;
    background-color: #121013;
    box-shadow: -6px 0 15px rgba(0, 0, 0, 0.5);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    /* Needed for the resizer */
}

#resizer {
    position: absolute;
    top: 0;
    left: 0;
    width: 8px;
    /* A slightly larger, easier-to-grab area */
    height: 100%;
    cursor: col-resize;
    z-index: 10;
}

/* Custom scrollbar styling for a cleaner look */
#sidebar::-webkit-scrollbar {
    width: 8px;
}

#sidebar::-webkit-scrollbar-track {
    background: #1f1d21;
}

#sidebar::-webkit-scrollbar-thumb {
    background: #4a4a5a;
    border-radius: 4px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: #5d5d6d;
}

.main-heading {
    font-size: 2.25rem;
    font-weight: 700;
    text-align: center;
    color: #60a5fa;
    text-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    padding: 0;
    margin: 0;
}

.sub-heading {
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    color: #7d7d7d;
    text-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    padding: 0;
    margin: 0;
}

.sidebar-section {
    background-color: #0d0a0d;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.section-heading {
    font-size: 1.5rem;
    font-weight: 600;
    color: #e5e7eb;
    border-bottom: 1px solid #374151;
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
}

.input-group {
    margin-bottom: 1rem;
}

.input-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.text-input {
    width: calc(100% - 1.5rem);
    background-color: #1f2937;
    color: #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid #4b5563;
    transition: all 0.2s ease-in-out;
}

.text-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.slider-input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background-color: #4b5563;
    border-radius: 4px;
    cursor: pointer;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background-color: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-input::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background-color: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn {
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease-in-out;
    border: none;
    cursor: pointer;
    align-items: center;
    align-content: center;
    justify-content: center;
    text-align: center;
    display: flex;
    gap: 0.5rem;
}

.btn-primary {
    background-color: #2563eb;
    color: #fff;
    background-image: linear-gradient(to right, #3b82f6, #2563eb);
}

.btn-primary:hover {
    background-color: #1d4ed8;
    background-image: none;
}

.btn-danger {
    background-color: #dc2626;
    color: #fff;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-secondary {
    background-color: #4b5563;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #374151;
}

.btn-full-width {
    width: 100%;
}

.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.empty-list-message {
    color: #9ca3af;
    padding: 2rem 1rem;
    border: 2px dashed #374151;
    border-radius: 0.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.empty-list-message p {
    margin: 0.25rem 0;
}

.location-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #1f2937;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s;
    cursor: pointer;
    border: 1px solid #4b5563;
}

.location-item:hover {
    background-color: #374151;
}

.location-item.selected {
    background-color: #2563eb;
    border-color: #3b82f6;
    color: #fff;
    font-weight: 700;
}

.location-item.selected .location-subtext {
    color: #bfdbfe;
}

.location-subtext {
    font-size: 0.875rem;
    color: #9ca3af;
}

.preview-img {
    width: 100%;
    height: 10rem;
    object-fit: scale-down;
    border-radius: 0.5rem;
    margin-top: 1rem;
    border: 1px solid #4b5563;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.file-label {
    display: block;
    text-align: center;
    background-color: #1f2937;
    padding: 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
    border: 1px solid #4b5563;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.file-label:hover {
    background-color: #374151;
}

.leaflet-container {
    background-color: #000000 !important;
}

.leaflet-marker-icon.pin-icon {
    background-image: url('../images/shadePin.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 32px !important;
    height: 32px !important;
    will-change: transform;
}

.leaflet-marker-icon.pin-icon.active {
    background-color: #1d4ed8;
}

.flex-row {
    display: flex;
    gap: 0.75rem;
}

.flex-grow-1 {
    flex: 1 1 0%;
}

.svg-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.dropdown {
    width: 100%;
    background-color: #1f2937;
    color: #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid #4b5563;
    transition: all 0.2s ease-in-out;
}