/* =====================================================================
   Immovables Map Editor — Styles
   ===================================================================== */

/* ---- Sidebar ---- */
#sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    transition: transform 0.3s ease;
}
#sidebar.collapsed {
    transform: translateX(380px);
}

#sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #1a237e;
    color: #fff;
}
#sidebar-header h2 {
    margin: 0;
    font-size: 18px;
}
#btn-close-sidebar {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

/* ---- Toolbar ---- */
#toolbar {
    display: flex;
    gap: 6px;
    padding: 10px 16px;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
}
#toolbar button {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}
#toolbar button:hover {
    background: #e3e3e3;
}
#toolbar button.btn-primary {
    background: #1a237e;
    color: #fff;
    border-color: #1a237e;
}

/* ---- Filters ---- */
#filters {
    padding: 8px 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 13px;
}
#filters select {
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* ---- Property list ---- */
#property-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.property-item {
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.15s;
}
.property-item:hover {
    background: #f5f5f5;
}
.property-item.selected {
    background: #e8eaf6;
    border-left: 3px solid #1a237e;
}
.property-item.inactive {
    opacity: 0.5;
}
.property-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}
.property-cat {
    background: #e0e0e0;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #555;
}
.property-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.property-item-details {
    font-size: 12px;
    color: #777;
    margin-top: 2px;
}
.property-item-actions {
    margin-top: 6px;
    display: flex;
    gap: 4px;
}
.property-item-actions .btn-sm {
    font-size: 12px;
    padding: 2px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fafafa;
    cursor: pointer;
}
.property-item-actions .btn-sm:hover {
    background: #eee;
}

/* ---- Map popup metadata ---- */
.property-popup {
    min-width: 220px;
    max-width: 280px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #202124;
}
.property-popup .popup-title {
    display: block;
    font-weight: 700;
    font-size: 14px;
    color: #1a237e;
    text-decoration: none;
    line-height: 1.25;
    margin-bottom: 2px;
}
.property-popup .popup-title:hover {
    text-decoration: underline;
}
.property-popup .popup-category {
    color: #666;
    font-size: 12px;
    margin-bottom: 8px;
}
.property-popup .popup-meta {
    display: grid;
    gap: 4px;
    padding-top: 8px;
    border-top: 1px solid #ddd;
}
.property-popup .popup-row {
    display: grid;
    grid-template-columns: minmax(72px, auto) 1fr;
    gap: 10px;
    align-items: baseline;
    font-size: 12px;
}
.property-popup .popup-row span {
    color: #777;
}
.property-popup .popup-row strong {
    min-width: 0;
    font-weight: 600;
    text-align: right;
    overflow-wrap: anywhere;
}
.property-popup .popup-description {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    color: #444;
    font-size: 12px;
    line-height: 1.35;
}

/* ---- Edit form ---- */
#edit-form {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}
#edit-form label {
    display: block;
    margin-top: 10px;
    font-weight: 600;
    font-size: 12px;
    color: #555;
}
#edit-form input[type="text"],
#edit-form input[type="number"],
#edit-form textarea,
#edit-form select {
    width: 100%;
    padding: 6px 8px;
    margin-top: 2px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
}
#edit-form textarea {
    resize: vertical;
}
#edit-form input[type="checkbox"] {
    margin-top: 4px;
}
#edit-form-actions {
    margin-top: 14px;
    display: flex;
    gap: 8px;
}
#edit-form-actions button {
    padding: 8px 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
}
#btn-save {
    background: #1a237e;
    color: #fff;
    border-color: #1a237e;
}

/* ---- Audit log ---- */
#audit-log {
    margin-top: 16px;
    font-size: 12px;
}
.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.audit-table th, .audit-table td {
    padding: 3px 6px;
    border-bottom: 1px solid #eee;
    text-align: left;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.audit-old { color: #c62828; }
.audit-new { color: #2e7d32; }

/* ---- Conflict alert ---- */
#conflict-alert {
    margin: 8px 16px;
}
.alert {
    padding: 10px 14px;
    border-radius: 4px;
    background: #fff3e0;
    border: 1px solid #ff9800;
    font-size: 13px;
}
.alert button {
    margin-top: 6px;
    padding: 4px 10px;
    border: 1px solid #ff9800;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
}

/* ---- Toast ---- */
.toast-message {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 99999;
    opacity: 1;
    transition: opacity 0.4s;
    pointer-events: none;
}
.toast-message.fade-out {
    opacity: 0;
}

/* ---- Geoman toolbar positioning ---- */
.leaflet-pm-toolbar {
    /* Geoman toolbar stays on the left */
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    #sidebar {
        width: 100%;
    }
    #sidebar.collapsed {
        transform: translateX(100%);
    }
}
