/* ============================================
   PerceelInfo Map Page Styles
   ============================================ */

/* Main Map Page Layout */
.map-page {
    display: flex;
    height: calc(100vh - 4rem); /* Subtract header height (4rem = 64px) */
    overflow: hidden;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    width: 420px;
    background: hsl(var(--card));
    border-right: 1px solid hsl(var(--border));
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--card));
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    color: hsl(var(--foreground));
}

.sidebar-close {
    display: none; /* Hidden on desktop, shown on mobile */
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    min-height: 2.75rem;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.sidebar-close:hover {
    color: hsl(var(--foreground));
    background-color: hsl(var(--accent));
}

.sidebar-content {
    flex: 1;
    padding: 1.25rem;
    overflow-y: auto;
}

/* Sidebar Empty State */
.sidebar-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    text-align: center;
    padding: 2rem;
}

.sidebar-empty p {
    color: hsl(var(--muted-foreground));
    font-size: 0.9375rem;
    line-height: 1.6;
    margin: 0;
}

/* Plot Info Panel */
.plot-info {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Plot Section (P1-11) */
.plot-section {
    padding: 16px;
    border-bottom: 1px solid hsl(var(--border));
}

.plot-section:last-child {
    border-bottom: none;
}

.plot-section-title {
    font-size: 14px;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Plot Properties Definition List (P1-11) */
.plot-properties {
    margin: 0;
}

.property-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid hsl(var(--border) / 0.5);
}

.property-row:last-child {
    border-bottom: none;
}

.property-row dt {
    color: hsl(var(--muted-foreground));
    font-size: 14px;
}

.property-row dd {
    font-weight: 500;
    margin: 0;
    font-size: 14px;
    color: hsl(var(--foreground));
}

/* Plot Product Links */
.plot-product-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.plot-product-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    color: hsl(var(--foreground));
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.plot-product-link:hover {
    background: hsl(var(--accent));
    border-color: hsl(var(--primary));
    color: hsl(var(--primary));
}

.plot-product-link svg {
    flex-shrink: 0;
    color: hsl(var(--primary));
}

/* "Toon alle" inline button */
.btn-show-all {
    background: none;
    border: none;
    color: hsl(var(--primary));
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.btn-show-all:hover {
    color: hsl(199 89% 42%);
}

/* Address Popup Overlay */
.address-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.address-popup {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.address-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid hsl(var(--border));
}

.address-popup-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.address-popup-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    padding: 0 0.25rem;
}

.address-popup-close:hover {
    color: hsl(var(--foreground));
}

.address-popup-body {
    overflow-y: auto;
    padding: 0.5rem 0;
}

.address-popup-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.address-popup-table th {
    text-align: left;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    padding: 0.5rem 1.25rem;
    border-bottom: 1px solid hsl(var(--border));
    position: sticky;
    top: 0;
    background: hsl(var(--card));
}

.address-popup-table td {
    padding: 0.375rem 1.25rem;
    color: hsl(var(--foreground));
    border-bottom: 1px solid hsl(var(--border) / 0.5);
}

.address-popup-table tbody tr:hover {
    background: hsl(var(--accent));
}

.address-popup-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid hsl(var(--border));
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
    font-style: italic;
}

/* Plot Actions (P1-11) */
.plot-actions {
    padding: 16px;
}

.plot-actions .btn {
    width: 100%;
    text-align: center;
}

/* Primary Button Style for Plot Actions */
.plot-actions .btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.plot-actions .btn-primary:hover {
    background: hsl(199 89% 42%);
}

/* Close button handler (P1-11) */
#sidebar-close {
    cursor: pointer;
}

/* Legacy Plot Info Styles (kept for backwards compatibility) */
.plot-info-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.plot-info-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin: 0;
}

.plot-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.plot-info-label {
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
}

.plot-info-value {
    font-size: 0.9375rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

/* Cadastral ID Highlight */
.plot-cadastral-id {
    font-size: 1.125rem;
    font-weight: 600;
    color: hsl(var(--primary));
    padding: 0.75rem 1rem;
    background: hsl(var(--primary) / 0.1);
    border-radius: var(--radius);
    text-align: center;
}

/* Products Link in Sidebar (legacy) */
.sidebar-products-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.sidebar-products-link:hover {
    background: hsl(199 89% 42%);
}

.sidebar-products-link svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* ============================================
   Map Container
   ============================================ */

.map-container {
    flex: 1;
    position: relative;
    background: hsl(var(--muted));
    min-width: 0; /* Allow container to shrink */
}

#map {
    width: 100%;
    height: 100%;
}

/* Map placeholder when Leaflet not loaded */
.map-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
    font-size: 0.9375rem;
}

/* ============================================
   Search Overlay
   ============================================ */

.map-search {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 1000;
    width: 100%;
    max-width: 400px;
}

.map-search-inner {
    position: relative;
    display: flex;
    align-items: center;
}

.search-back-btn {
    display: none;
}

.map-search-icon {
    position: absolute;
    left: 0.75rem;
    color: hsl(var(--muted-foreground));
    pointer-events: none;
    flex-shrink: 0;
}

.search-input {
    width: 100%;
    height: 2.75rem;
    padding: 0 1rem 0 2.5rem;
    font-size: 0.9375rem;
    background-color: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    color: hsl(var(--foreground));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input::placeholder {
    color: hsl(var(--muted-foreground));
}

.search-input:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 0 0 2px hsl(var(--ring) / 0.2);
}

/* Search Suggestions Dropdown */
.search-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
}

.search-suggestions.open {
    display: block;
}

.search-suggestion-item {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.search-suggestion-item:hover,
.search-suggestion-item.selected,
.search-suggestion-item.search-suggestion-active {
    background-color: hsl(var(--accent));
}

.search-error-message {
    color: hsl(var(--destructive));
}

.search-suggestion-item:not(:last-child) {
    border-bottom: 1px solid hsl(var(--border));
}

.search-suggestion-main {
    font-size: 0.9375rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

.search-suggestion-secondary {
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.125rem;
}

/* No Results Message */
.search-no-results {
    padding: 1rem;
    text-align: center;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}

/* ============================================
   Map Controls (Leaflet overrides)
   ============================================ */

/* Hide default Leaflet controls (replaced by custom controls) */
.leaflet-control-zoom,
.leaflet-control-layers {
    display: none !important;
}

/* ============================================
   Map Toolbar (Zoom + Panel Toggle)
   ============================================ */

.map-toolbar {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.map-toolbar-group {
    display: flex;
    flex-direction: column;
    background: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.map-toolbar-group .map-toolbar-btn {
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.map-toolbar-group .map-toolbar-btn + .map-toolbar-btn {
    border-top: 1px solid hsl(var(--border));
}

.map-toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    background: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    color: hsl(var(--foreground));
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.map-toolbar-btn:hover {
    background: hsl(var(--accent));
}

.map-toolbar-btn:focus-visible {
    outline: 2px solid hsl(var(--ring));
    outline-offset: 2px;
}

.map-toolbar-btn:active {
    transform: scale(0.95);
}

.map-toolbar-btn.active {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.map-toolbar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.map-toolbar-btn:disabled:hover {
    background: hsl(var(--background));
}

.map-toolbar-btn svg {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

/* ============================================
   Map Panel (Right Side)
   ============================================ */

.map-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    background: hsl(var(--background));
    border-left: 1px solid hsl(var(--border));
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.08);
    z-index: 1001;
    transform: translateX(100%);
    visibility: hidden;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.map-panel.ready {
    transition: transform 0.3s ease, visibility 0.3s ease;
}

.map-panel.open {
    transform: translateX(0);
    visibility: visible;
}

.map-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--background));
    flex-shrink: 0;
}

.map-panel-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.map-panel-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.map-panel-close:hover {
    color: hsl(var(--foreground));
    background: hsl(var(--accent));
}

.map-panel-body {
    flex: 1;
    overflow-y: auto;
}

/* Panel Sections (collapsible) */
.map-panel-section {
    border-bottom: 1px solid hsl(var(--border));
}

.map-panel-section:last-child {
    border-bottom: none;
}

.map-panel-section-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    text-align: left;
    transition: background-color 0.15s ease;
}

.map-panel-section-toggle:hover {
    background: hsl(var(--accent));
}

.map-panel-chevron {
    width: 1rem;
    height: 1rem;
    color: hsl(var(--muted-foreground));
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.map-panel-section-toggle[aria-expanded="false"] .map-panel-chevron {
    transform: rotate(-90deg);
}

.map-panel-section-body {
    padding: 0 0.5rem 0.5rem 0.5rem;
}

.map-panel-section-toggle[aria-expanded="false"] + .map-panel-section-body {
    display: none;
}

/* Panel Options (radio/checkbox labels and measure buttons) */
.map-panel-option {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.8125rem;
    color: hsl(var(--foreground));
    cursor: pointer;
    transition: background-color 0.15s ease;
    background: transparent;
    border: none;
    text-align: left;
}

.map-panel-option:hover {
    background: hsl(var(--accent));
}

.map-panel-option input[type="radio"],
.map-panel-option input[type="checkbox"] {
    accent-color: hsl(var(--primary));
    margin: 0;
    flex-shrink: 0;
}

.map-panel-option svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: hsl(var(--muted-foreground));
}

/* Measure option active state */
.map-measure-option[aria-pressed="true"] {
    background: hsl(var(--primary) / 0.1);
    color: hsl(var(--primary));
    font-weight: 500;
}

.map-measure-option[aria-pressed="true"] svg {
    color: hsl(var(--primary));
}

/* Measure clear button */
.map-measure-clear {
    color: hsl(var(--muted-foreground));
    opacity: 0.5;
    pointer-events: none;
}

/* Enabled when measurements exist */
.map-measure-clear.has-measurements {
    opacity: 1;
    pointer-events: auto;
    color: hsl(var(--destructive));
}

.map-measure-clear.has-measurements svg {
    color: hsl(var(--destructive));
}

.map-measure-clear.has-measurements:hover {
    background: hsl(var(--destructive) / 0.1);
}

/* ============================================
   Zoom Message
   ============================================ */

.zoom-message {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: hsl(var(--card));
    padding: 8px 16px;
    border-radius: var(--radius);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    font-size: 14px;
    color: hsl(var(--foreground));
    border: 1px solid hsl(var(--border));
    white-space: nowrap;
}

/* ============================================
   Mobile Sidebar (Bottom Sheet)
   ============================================ */

@media (max-width: 768px) {
    .map-page {
        flex-direction: column;
        height: calc(100vh - 3rem);
        position: relative;
        overflow: hidden;
    }

    /* Bottom sheet sidebar overlay */
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        max-height: 85vh;
        border-right: none;
        border-top: none;
        border-radius: var(--radius) var(--radius) 0 0;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
        z-index: 1002;
        transform: translateY(calc(100% - 60px));
        transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
        will-change: transform;
        display: flex;
        flex-direction: column;
        overflow: visible;
    }

    /* Extend background below sidebar to cover map during drag */
    .sidebar::after {
        content: '';
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        height: 100vh;
        background: hsl(var(--card));
        pointer-events: none;
    }

    /* Snap positions */
    .sidebar.snap-hidden {
        transform: translateY(100%);
        max-height: 0;
    }

    .sidebar.snap-collapsed {
        transform: translateY(calc(100% - 60px));
        max-height: 60px;
    }

    .sidebar.snap-peek {
        transform: translateY(calc(100% - 280px));
        max-height: 280px;
    }

    .sidebar.snap-expanded {
        transform: translateY(calc(100% - 85vh));
        max-height: 85vh;
    }

    /* Disable transition during active drag */
    .sidebar.dragging {
        transition: none;
    }

    .sidebar-close {
        display: inline-flex;
    }

    .sidebar-header {
        padding: 0.5rem 1rem;
    }

    .sidebar-content {
        padding: 1rem;
        overflow-y: auto;
        flex: 1;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }

    .map-container {
        flex: 1;
        min-height: 0;
    }

    .map-search {
        top: 0.75rem;
        left: 0.75rem;
        right: auto;
        max-width: calc(100% - 5rem);
    }

    /* Full-screen search takeover on mobile */
    .map-search.search-active {
        position: fixed;
        inset: 0;
        z-index: 2000;
        max-width: none;
        background: hsl(var(--background));
        padding: 0.75rem;
        display: flex;
        flex-direction: column;
    }

    .map-search.search-active .map-search-inner {
        display: flex;
        gap: 0.5rem;
        align-items: center;
        flex-shrink: 0;
    }

    .map-search.search-active .search-input {
        height: 2.75rem;
        font-size: 1rem;
        flex: 1;
    }

    .map-search.search-active .map-search-icon {
        left: 3.75rem;
    }

    .map-search.search-active .search-input {
        padding-left: 2.5rem;
    }

    .map-search.search-active .search-suggestions {
        position: static;
        flex: 1;
        max-height: none;
        margin-top: 0.5rem;
        border: none;
        box-shadow: none;
        overflow-y: auto;
    }

    /* Back button - only visible in search takeover */
    .search-back-btn {
        display: none;
    }

    .map-search.search-active .search-back-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.75rem;
        height: 2.75rem;
        flex-shrink: 0;
        background: none;
        border: none;
        color: hsl(var(--foreground));
        cursor: pointer;
        border-radius: var(--radius);
        padding: 0;
    }

    .map-search.search-active .search-back-btn:hover {
        background: hsl(var(--accent));
    }

    .search-input {
        height: 2.5rem;
        font-size: 1rem; /* Prevent iOS zoom on focus */
    }

    .map-toolbar {
        top: 0.75rem;
        right: 0.75rem;
        gap: 0.375rem;
    }

    .map-toolbar-btn {
        width: 2.75rem;
        height: 2.75rem;
    }

    .map-toolbar-btn svg {
        width: 1.25rem;
        height: 1.25rem;
    }

    /* Panel as bottom sheet on mobile */
    .map-panel {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: auto;
        max-height: 70vh;
        border-left: none;
        border-top: 1px solid hsl(var(--border));
        border-radius: var(--radius) var(--radius) 0 0;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
        transform: translateY(100%);
        z-index: 1003; /* Above sidebar bottom sheet */
    }

    .map-panel.open {
        transform: translateY(0);
    }
}

/* Drag handle - mobile only */
.sidebar-drag-handle {
    display: none;
}

@media (max-width: 768px) {
    .sidebar-drag-handle {
        display: flex;
        justify-content: center;
        padding: 10px 0 6px;
        cursor: grab;
        touch-action: none;
        flex-shrink: 0;
    }

    .sidebar-drag-handle:active {
        cursor: grabbing;
    }

    .sidebar-drag-bar {
        width: 36px;
        height: 4px;
        background: hsl(var(--muted-foreground) / 0.3);
        border-radius: 2px;
    }
}

/* Collapsed sidebar state for mobile */
.sidebar.collapsed .sidebar-content {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    border-bottom: none;
}

/* Open sidebar state for mobile */
@media (max-width: 768px) {
    .sidebar.sidebar-open .sidebar-content {
        display: block;
    }

    .sidebar.sidebar-open .sidebar-header {
        border-bottom: 1px solid hsl(var(--border));
    }
}

/* Toggle button for collapsed state */
.sidebar-toggle {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: block;
    }

    .zoom-message {
        bottom: 10px;
        font-size: 13px;
        padding: 6px 12px;
    }
}

/* ============================================
   Loading State
   ============================================ */

.map-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(var(--background) / 0.8);
    z-index: 1001;
}

.map-loading-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid hsl(var(--border));
    border-top-color: hsl(var(--primary));
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Plot Selection Loading State (P1-10)
   ============================================ */

/* Loading cursor when fetching plot data */
body.loading-plot #map {
    cursor: wait;
}

/* Sidebar loading spinner */
.loading-spinner {
    padding: 20px;
    text-align: center;
    color: hsl(var(--muted-foreground));
    font-size: 0.9375rem;
}

/* No plot found message */
.no-plot-message {
    padding: 16px;
    text-align: center;
    color: hsl(var(--muted-foreground));
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* Error message */
.error-message {
    padding: 16px;
    text-align: center;
    color: hsl(var(--destructive));
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* ============================================
   Quick Facts Summary
   ============================================ */

.quick-facts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid hsl(var(--border));
}

.quick-fact {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px 6px;
    background: hsl(var(--muted));
    border-radius: var(--radius);
}

.quick-fact-icon {
    width: 20px;
    height: 20px;
    color: hsl(var(--primary));
    margin-bottom: 4px;
}

.quick-fact-value {
    font-size: 0.8125rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    line-height: 1.3;
    word-break: break-word;
}

.quick-fact-label {
    font-size: 0.6875rem;
    color: hsl(var(--muted-foreground));
    margin-top: 2px;
}

/* Bestemming badge */
.bestemming-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.75rem;
    font-weight: 500;
    background: hsl(var(--primary) / 0.1);
    color: hsl(var(--primary));
}

/* Section title icons */
.plot-section-icon {
    display: inline-block;
    vertical-align: -2px;
    margin-right: 6px;
    color: hsl(var(--muted-foreground));
}

/* ============================================
   Sidebar Product Cards (Direct Bestellen)
   ============================================ */

.sidebar-product-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-product-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    position: relative;
}

.sidebar-product-featured {
    border-color: hsl(var(--primary));
    background: hsl(var(--primary) / 0.03);
}

.sidebar-product-badge {
    position: absolute;
    top: -8px;
    right: 12px;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: calc(var(--radius) - 2px);
    line-height: 1.4;
}

.sidebar-product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-product-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

.sidebar-product-price {
    font-size: 0.8125rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    white-space: nowrap;
}

.sidebar-add-to-cart-btn {
    padding: 6px 12px;
    font-size: 0.8125rem;
    width: 100%;
    cursor: pointer;
}

.sidebar-add-to-cart-btn.btn-success {
    background: hsl(142 71% 45%);
    border-color: hsl(142 71% 45%);
    color: white;
}

/* Compare link */
.plot-compare-link {
    display: block;
    text-align: center;
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    padding: 0.5rem 0;
}

.plot-compare-link:hover {
    color: hsl(var(--primary));
}

/* Progressive disclosure on mobile */
.plot-details-toggle {
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    margin-top: 0.5rem;
}

.plot-details-toggle summary {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.plot-details-toggle summary::after {
    content: '\25BC';
    font-size: 0.625rem;
    transition: transform 0.2s ease;
}

.plot-details-toggle[open] summary::after {
    transform: rotate(180deg);
}

.plot-details-toggle summary::-webkit-details-marker {
    display: none;
}

.plot-details-toggle[open] {
    border-color: hsl(var(--primary) / 0.3);
}

/* Mobile product CTA */
.mobile-product-cta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 0;
}

.mobile-cta-btn {
    width: 100%;
    min-height: 2.75rem;
    font-size: 0.9375rem;
}

.mobile-all-products-link {
    font-size: 0.8125rem;
    text-align: center;
}

/* ============================================
   Coordinate Search Suggestion
   ============================================ */

.search-suggestion-coords {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-suggestion-icon {
    flex-shrink: 0;
    color: hsl(var(--primary));
}

/* ============================================
   Measure Tools
   ============================================ */

.measure-tooltip {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 4px 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.measure-tooltip::before {
    display: none;
}

.measure-tooltip-result {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

/* ============================================
   Plot Highlight Animations
   ============================================ */

.leaflet-overlay-pane path.plot-highlight {
    transition: fill-opacity 0.4s ease, stroke-opacity 0.4s ease;
}

.leaflet-overlay-pane path.plot-highlight.visible {
    fill-opacity: 0.3;
    stroke-opacity: 1;
}

@keyframes plot-pulse {
    0%, 100% { stroke-width: 3; }
    50% { stroke-width: 5; filter: drop-shadow(0 0 6px rgba(14, 165, 233, 0.6)); }
}

.leaflet-overlay-pane path.plot-highlight.pulse {
    animation: plot-pulse 0.8s ease-in-out 1;
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .map-page {
        height: auto;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #000;
    }

    .map-container {
        height: 500px;
    }

    .map-search,
    .map-toolbar,
    .map-panel {
        display: none;
    }
}
