/* ============================================ */
/* EDITOR MODE STYLES */
/* ============================================ */

/* Editor Panel */
.editor-panel {
    position: fixed;
    top: 60px;
    left: -400px;
    width: 380px;
    height: calc(100% - 60px);
    background-color: rgba(15, 15, 15, 0.98);
    border-right: 2px solid var(--theme-primary, #4a9eff);
    z-index: 950;
    overflow-y: auto;
    transition: left 0.3s ease-in-out;
    backdrop-filter: blur(10px);
}

.editor-panel.open {
    left: 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
}

.editor-header {
    padding: 15px;
    border-bottom: 1px solid var(--theme-primary, #4a9eff);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--theme-primary, #4a9eff);
}

.editor-content {
    padding: 15px;
}

/* Editor Sections */
.editor-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.editor-section:last-child {
    border-bottom: none;
}

.editor-section h4 {
    font-size: 14px;
    color: var(--theme-secondary, #7ab8ff);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Editor Buttons */
.editor-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.editor-btn {
    text-align: left;
    justify-content: flex-start;
}

.editor-btn:hover {
    transform: translateX(5px);
}

.btn-small {
    padding: 4px 12px;
    font-size: 18px;
    line-height: 1;
}

/* Editor Forms */
.editor-form {
    margin-top: 15px;
}

.editor-form label {
    display: block;
    margin-bottom: 12px;
    font-size: 12px;
    color: #ccc;
}

.editor-form input[type="text"],
.editor-form input[type="number"],
.editor-form textarea {
    width: 100%;
    padding: 8px;
    margin-top: 4px;
    background-color: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
    font-family: inherit;
    font-size: 12px;
    border-radius: 3px;
}

.editor-form input[type="text"]:focus,
.editor-form input[type="number"]:focus,
.editor-form textarea:focus {
    outline: none;
    border-color: var(--theme-primary, #4a9eff);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.editor-form textarea {
    min-height: 60px;
    resize: vertical;
}

.editor-form input[readonly] {
    background-color: rgba(50, 50, 50, 0.8);
    color: #999;
}

/* Section Divider within forms */
.editor-section-divider {
    margin: 15px 0 10px 0;
    padding: 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 11px;
    color: var(--theme-text-dim, #8899aa);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.editor-section-divider span {
    color: var(--theme-secondary, #7ab8ff);
}

/* Current Mode Display */
#editor-current-mode {
    padding: 10px;
    background-color: rgba(74, 158, 255, 0.1);
    border-left: 3px solid var(--theme-primary, #4a9eff);
    font-size: 13px;
    color: #e0e0e0;
}

#editor-current-mode strong {
    color: var(--theme-primary, #4a9eff);
}

/* Instructions */
.editor-instructions {
    font-size: 12px;
    color: #999;
    line-height: 1.6;
}

.editor-instructions p {
    margin: 5px 0;
}

/* Polygon Points List */
#polygon-points-list {
    padding: 10px;
    background-color: rgba(30, 30, 30, 0.6);
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 13px;
}

#polygon-point-count {
    color: var(--theme-primary, #4a9eff);
    font-weight: bold;
}

/* Editor Toggle Button (Floating) */
.editor-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--theme-primary, #4a9eff);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.editor-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(74, 158, 255, 0.6);
}

.editor-toggle-btn:active {
    transform: scale(0.95);
}

/* Hide editor toggle if not enabled */
body:not(.editor-enabled) .editor-toggle-btn,
body:not(.editor-enabled) .editor-panel {
    display: none;
}

/* Editor enabled indicator */
body.editor-enabled::before {
    content: '🛠️ EDITOR MODE';
    position: fixed;
    bottom: 80px;
    right: 10px;
    padding: 8px 12px;
    background-color: rgba(255, 140, 26, 0.9);
    color: #000;
    font-size: 11px;
    font-weight: bold;
    border-radius: 4px;
    z-index: 999;
    pointer-events: none;
}

/* Create mode - disable clicks on existing markers and polygons */
/* This allows clicks to pass through to the map for placing new elements */
body.editor-create-mode .leaflet-marker-pane,
body.editor-create-mode .leaflet-overlay-pane path,
body.editor-create-mode .custom-marker-overlay {
    pointer-events: none !important;
}

/* Move debug console when editor panel is open */
body:has(.editor-panel.open) #debug-info {
    left: 400px;
    transition: left 0.3s ease-in-out;
}

/* ============================================ */
/* ICON PICKER */
/* ============================================ */
.icon-picker-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
}

.icon-picker-row input {
    flex: 1;
    min-width: 0;
}

.icon-picker-thumb {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.4);
}

.icon-picker-dropdown {
    margin-top: 6px;
    max-height: 210px;
    overflow-y: auto;
    background: rgba(10, 10, 10, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 8px;
}

.icon-picker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-content: flex-start;
}

.icon-picker-group-label {
    width: 100%;
    font-size: 10px;
    color: var(--theme-primary, #4a9eff);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 4px 0 3px;
}

.icon-picker-group-label:first-child {
    margin-top: 0;
}

.icon-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    cursor: pointer;
    width: 58px;
    transition: border-color 0.15s ease;
}

.icon-picker-item:hover {
    border-color: var(--theme-primary, #4a9eff);
    background: rgba(74, 158, 255, 0.1);
}

.icon-picker-item img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.icon-picker-item span {
    font-size: 9px;
    color: #888;
    text-align: center;
    word-break: break-all;
    line-height: 1.2;
}

/* Mobile Adjustments */
@media screen and (max-width: 768px) {
    .editor-panel {
        width: 100%;
        left: -100%;
    }

    .editor-toggle-btn {
        bottom: 10px;
        right: 10px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    body.editor-enabled::before {
        bottom: 65px;
        right: 10px;
    }
}
