/* Map — Terrain.be Map Interface Styles v2.0 */
/* 4 modules: Valuation, Mission, Ad, Transaction */
/* Sidebar 450px with cards layout */

:root {
    /* terrain.be brand colors */
    --bg-dark: #242425;
    --bg-panel: #2d2d2e;
    --bg-card: #3C3C3B;
    --bg-card-hover: #484847;
    --accent: #F9BA33;        /* Yellow - Missions */
    --accent-hover: #ffc94d;
    --accent-red: #D40F44;    /* Red - Ads */
    --accent-blue: #3498db;   /* Blue - Valuations */
    --accent-green: #27ae60;  /* Green - Transactions */
    --text: #FFFFFF;
    --text-muted: #a0a0a0;
    --text-dimmed: #707070;
    --border: #4a4a4a;
    --border-light: #5a5a5a;
    --danger: #e74c3c;
    --warning: #f39c12;
    --success: #27ae60;
    
    /* Layer colors */
    --color-ad: #D40F44;
    --color-mission: #F9BA33;
    --color-valuation: #3498db;
    --color-transaction: #27ae60;
    
    /* Sidebar width */
    --sidebar-width: 700px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    overflow: hidden;
}

/* ===== APP LAYOUT ===== */

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ===== HEADER ===== */

#header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    height: 48px;
    flex-shrink: 0;
}

.header-left h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.5px;
}

.header-left h1 .accent {
    color: var(--accent);
}

.header-center {
    flex: 1;
    max-width: 500px;
    margin: 0 2rem;
}

#search {
    width: 100%;
    padding: 0.5rem 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(249, 186, 51, 0.2);
}

#search::placeholder {
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-ok { color: var(--success); }
.status-error { color: var(--danger); }

/* ===== MAIN CONTAINER ===== */

#main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ===== SIDEBAR (450px) ===== */

#sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Module Tabs - 4 onglets */
#modules {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg-dark);
}

.module-btn {
    flex: 1;
    padding: 0.75rem 0.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    position: relative;
}

.module-btn:hover {
    background: var(--bg-card);
    color: var(--text);
}

.module-btn .module-icon {
    font-size: 1.1rem;
}

.module-btn .module-label {
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.module-btn.active {
    color: var(--accent);
    background: var(--bg-panel);
}

.module-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

/* Module-specific accent colors */
.module-btn[data-module="valuations"].active { 
    color: var(--accent-blue); 
}
.module-btn[data-module="valuations"].active::after { 
    background: var(--accent-blue); 
}
.module-btn[data-module="missions"].active { 
    color: var(--accent); 
}
.module-btn[data-module="missions"].active::after { 
    background: var(--accent); 
}
.module-btn[data-module="ads"].active { 
    color: var(--accent-red); 
}
.module-btn[data-module="ads"].active::after { 
    background: var(--accent-red); 
}
.module-btn[data-module="transactions"].active { 
    color: var(--accent-green); 
}
.module-btn[data-module="transactions"].active::after { 
    background: var(--accent-green); 
}

/* Actions Bar */
#actions-bar {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel);
}

.action-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.action-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.action-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
    font-weight: 600;
}

.action-btn.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* Entity List */
#entity-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#entity-list.hidden {
    display: none;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

#list-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.list-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
}

/* Filter Panel */
#filter-panel {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
}

#filter-panel.hidden {
    display: none;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.filter-row label {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 60px;
}

.filter-row select {
    flex: 1;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
    color: var(--text);
}

.filter-row select:focus {
    outline: none;
    border-color: var(--accent);
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.action-btn.small {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
}

#entities {
    flex: 1;
    overflow-y: auto;
    list-style: none;
    padding: 0.5rem;
}

/* Entity Cards */
.entity-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
}

.entity-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    transform: translateX(2px);
}

.entity-card.selected {
    border-color: var(--accent);
    border-left-width: 3px;
    background: rgba(249, 186, 51, 0.08);
}

/* Ad cards have red accent */
.entity-card[data-type="ad"].selected {
    border-color: var(--accent-red);
    background: rgba(212, 15, 68, 0.08);
}

/* Mission cards have yellow accent */
.entity-card[data-type="mission"].selected {
    border-color: var(--accent);
}

.entity-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.entity-card .card-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.3;
    flex: 1;
    margin-right: 0.5rem;
}

.entity-card .card-id {
    font-size: 0.7rem;
    color: var(--text-dimmed);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.entity-card .card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.entity-card .card-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.entity-card .card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.draft { background: var(--text-muted); color: var(--bg-dark); }
.status-badge.active { background: var(--accent); color: var(--bg-dark); }
.status-badge.paused { background: var(--warning); color: var(--bg-dark); }
.status-badge.closed { background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border); }
.status-badge.available { background: var(--success); color: white; }
.status-badge.reserved { background: var(--warning); color: var(--bg-dark); }
.status-badge.sold { background: var(--danger); color: white; }

/* Legacy status classes (compatibility) */
.status-draft { background: var(--text-muted); color: var(--bg-dark); }
.status-active { background: var(--accent); color: var(--bg-dark); }
.status-paused { background: var(--warning); color: var(--bg-dark); }
.status-closed { background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border); }
.status-available { background: var(--success); color: white; }
.status-sold { background: var(--danger); color: white; }

/* Entity Details Panel */
#entity-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#entity-details.hidden {
    display: none;
}

.details-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-dark);
}

#btn-back {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.15s;
}

#btn-back:hover {
    background: var(--bg-card);
}

#details-title {
    flex: 1;
    font-weight: 600;
    font-size: 1rem;
}

.details-actions {
    display: flex;
    gap: 0.25rem;
}

.icon-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.icon-btn:hover {
    background: var(--bg-card);
    border-color: var(--border-light);
}

.icon-btn.danger:hover {
    background: rgba(231, 76, 60, 0.15);
    border-color: var(--danger);
}

#details-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Collapsible Sections */
.detail-section {
    margin-bottom: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
}

.section-header:hover {
    background: var(--bg-card-hover);
}

.section-header h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-header .section-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-dark);
    padding: 0.15rem 0.4rem;
    border-radius: 8px;
}

.section-header .section-toggle {
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.section-header.collapsed .section-toggle {
    transform: rotate(-90deg);
}

.section-content {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
}

.section-content.collapsed {
    display: none;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(74, 74, 74, 0.5);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row .label {
    color: var(--text-muted);
}

.detail-row .value {
    font-weight: 500;
    text-align: right;
}

/* ===== MAP CONTAINER ===== */

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

#map {
    width: 100%;
    height: 100%;
}

/* Edit Toolbar (inspiré OldModuleEdition/ToolManager) */
#edit-toolbar {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#edit-toolbar.hidden {
    display: none;
}

.tool-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.tool-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
}

.tool-btn.confirm {
    color: var(--success);
}

.tool-btn.confirm:hover {
    background: rgba(39, 174, 96, 0.2);
    border-color: var(--success);
}

.tool-btn.cancel {
    color: var(--danger);
}

.tool-btn.cancel:hover {
    background: rgba(231, 76, 60, 0.2);
    border-color: var(--danger);
}

.tool-btn:disabled,
.tool-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Export Controls */
#export-controls {
    position: absolute;
    bottom: 80px;
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.export-btn {
    background: rgba(45, 45, 46, 0.95);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.15s ease;
}

.export-btn:hover {
    background: var(--bg-card);
    border-color: var(--accent);
}

.tool-separator {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* Map Controls */
#map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: rgba(45, 45, 46, 0.95);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    backdrop-filter: blur(4px);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.15s ease;
}

.control-group label:hover {
    color: var(--accent);
}

.control-group input[type="checkbox"] {
    accent-color: var(--accent);
}

.layer-icon {
    font-size: 0.7rem;
    width: 12px;
    text-align: center;
}

.layer-icon.ads { color: var(--color-ad); }
.layer-icon.missions { color: var(--color-mission); }

/* Coords Display */
#coords-display {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 1000;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--text-muted);
    display: flex;
    gap: 1rem;
}

#coords-display .secondary {
    color: var(--text-dimmed);
    font-size: 0.7rem;
}

/* Measure Display (pendant édition) */
#measure-display {
    position: absolute;
    bottom: 50px;
    left: 10px;
    z-index: 1000;
    background: var(--bg-panel);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    min-width: 180px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#measure-display.hidden {
    display: none;
}

.measure-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: 0.8rem;
}

.measure-label {
    color: var(--text-muted);
}

.measure-row span:last-child {
    font-weight: 600;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--accent);
}

/* ===== SCROLLBAR STYLING ===== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

/* ===== LOADING STATE ===== */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-muted);
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 0.75rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    text-align: center;
}

.empty-state .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state .empty-text {
    font-size: 0.9rem;
}

.empty-state .empty-subtext {
    font-size: 0.75rem;
    color: var(--text-dimmed);
    margin-top: 0.5rem;
}

.empty-state.coming-soon {
    background: linear-gradient(135deg, rgba(249, 186, 51, 0.05), transparent);
    border-radius: 8px;
    margin: 1rem;
}

.empty-state.coming-soon .empty-icon {
    opacity: 0.7;
}

/* ===== LEAFLET OVERRIDES ===== */

.leaflet-container {
    background: var(--bg-dark);
}

.leaflet-popup-content-wrapper {
    background: var(--bg-panel);
    color: var(--text);
    border-radius: 6px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.leaflet-popup-tip {
    background: var(--bg-panel);
    border: 1px solid var(--border);
}

.leaflet-popup-content {
    margin: 0.75rem 1rem;
    font-size: 0.85rem;
}

.popup-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.popup-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.popup-meta .status {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 2px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Leaflet controls theming */
.leaflet-control-zoom a {
    background: var(--bg-panel) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-card) !important;
    color: var(--accent) !important;
}

.leaflet-control-scale-line {
    background: rgba(45, 45, 46, 0.9) !important;
    border-color: var(--border) !important;
    color: var(--text-muted) !important;
}

.leaflet-control-attribution {
    background: rgba(36, 36, 37, 0.8) !important;
    color: var(--text-muted) !important;
    font-size: 0.65rem;
}

.leaflet-control-attribution a {
    color: var(--accent) !important;
}

/* Drawing styles (from OldModuleEdition) */
.length-tooltip {
    background: var(--bg-panel) !important;
    border: 1px solid var(--accent) !important;
    color: var(--text) !important;
    padding: 0.5rem !important;
    font-size: 0.8rem !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.invisible-icon {
    display: none !important;
}

/* Photo Gallery in details */
.photo-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.photo-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.photo-thumb {
    aspect-ratio: 1;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}

.photo-thumb:hover {
    border-color: var(--accent);
    transform: scale(1.02);
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-thumb .placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-dimmed);
    font-size: 1.5rem;
}

.photo-nav {
    text-align: center;
}

.photo-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Photo Lightbox */
.photo-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lightbox-image-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 80vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-close {
    position: absolute;
    top: -2rem;
    right: 0;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-prev,
.lightbox-next {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    padding: 1rem 0.75rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-counter {
    position: absolute;
    bottom: -2rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Plots list in Ad details */
.plots-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.plot-item {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}

.plot-item:hover {
    background: var(--bg-card-hover);
}

.plot-item.selected {
    background: var(--bg-card);
    border-left-color: var(--accent);
}

.plot-item:last-child {
    border-bottom: none;
}

.plot-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.plot-label {
    font-weight: 500;
    font-size: 0.9rem;
}

.plot-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.plot-type {
    color: var(--text-dimmed);
}

.plot-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
}

.plot-area {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.plot-price {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--accent);
}

/* Document items */
.document-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.document-item:last-child {
    border-bottom: none;
}

.doc-icon {
    font-size: 1rem;
}

.doc-label {
    flex: 1;
    font-size: 0.85rem;
}

.doc-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Principal items (Mission) */
.principal-item {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.principal-item:last-child {
    border-bottom: none;
}

.principal-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.principal-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.principal-id {
    font-size: 0.7rem;
    color: var(--text-dimmed);
}

.principal-domicile {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Parcel ownerships */
.parcel-ownerships {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.ownership-badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    font-size: 0.65rem;
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-muted);
}

/* Helper classes */
.empty-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

.description-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    white-space: pre-wrap;
}

.monospace {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.75rem;
}

.link {
    color: var(--accent);
    cursor: pointer;
}

.link:hover {
    text-decoration: underline;
}

.clickable {
    cursor: pointer;
}

.clickable:hover {
    background: var(--bg-card-hover);
}

/* ===== NOTIFICATIONS ===== */

.notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 0.75rem 1.5rem;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 10000;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.notification-success {
    border-color: var(--success);
    background: rgba(39, 174, 96, 0.15);
}

.notification-error {
    border-color: var(--danger);
    background: rgba(231, 76, 60, 0.15);
}

.notification-info {
    border-color: var(--accent);
    background: rgba(249, 186, 51, 0.15);
}

/* ===== MEASURE TOOLTIP (Drawing) ===== */

.measure-tooltip {
    background: var(--bg-panel) !important;
    border: 1px solid var(--accent) !important;
    color: var(--text) !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.8rem !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    white-space: nowrap !important;
}

.measure-tooltip b {
    color: var(--accent);
}

/* Draggable vertex cursor */
.draggable-vertex {
    cursor: grab;
}

.draggable-vertex:active {
    cursor: grabbing;
}

/* Midpoint vertex for adding new vertices */
.midpoint-vertex {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.midpoint-vertex:hover {
    opacity: 1;
}
