:root {
    --mud-appbar-height: 114px;
    --hb-bg: #ffffff;
    --hb-surface: #ffffff;
    --hb-border: #e7dfd8;
    --hb-focus: #1458d6;
    --hb-brand-green: #385a10;
    --hb-brand-green-alt: #4a6715;
    --hb-brand-brown: #622209;
    --hb-brand-orange: #e36308;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--hb-bg);
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}

.mud-button-root:focus-visible,
.mud-input-control:focus-within,
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--hb-focus);
    outline-offset: 2px;
}

.search-page,
.submit-page,
.admin-page {
    padding-bottom: 2rem;
}

.search-page {
    display: flex;
    flex-direction: column;
    min-height: 0;
    gap: 1rem;
}

.search-hero {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.search-panel {
    border-color: var(--hb-border);
    background: var(--hb-surface);
}

.search-content {
    margin-top: 0.25rem;
}

.search-content-intro {
    margin-bottom: 0.75rem;
}

.search-content {
    flex: 1 1 auto;
    min-height: 0;
}

.search-content-grid,
.search-map-column,
.search-results-column {
    height: 100%;
    min-height: 0;
}

.search-map-pane {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 100%;
    min-height: 0;
    padding-right: 1rem;
}

.search-map-pane .leaflet-host {
    flex: 0 0 auto;
    height: clamp(360px, 62vh, 700px);
    min-height: 360px;
    border: 0;
    border-radius: 0;
}

.search-results-pane {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    min-height: 0;
    border-radius: 8px;
}

.search-loading-state {
    min-height: 180px;
}

.search-listings {
    padding-bottom: 0.5rem;
}

.listing-card {
    border-radius: 10px;
    border: 1px solid #eee8e1;
    background: #fffdfb;
    transition: border-color 0.18s ease, background-color 0.18s ease;
}

.listing-card:hover {
    border-color: #d8cec3;
    background: #fffaf6;
}

.listing-details-grid {
    margin: 0;
}

.listing-label {
    color: #6f6a64;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 700;
}

.listing-value {
    margin-top: 0.2rem;
}

.listing-chip-row {
    margin-top: 0.35rem;
}

.listing-actions-row {
    width: 100%;
}

.listing-action-button {
    flex: 1 1 0;
    min-height: 2.5rem;
    text-transform: none;
    font-weight: 600;
}

.search-results-table {
    flex: 1 1 auto;
}

.search-results-table .mud-table-container {
    max-height: none;
}

.search-actions-cell {
    padding-top: 0.15rem;
    padding-bottom: 0.85rem;
}

.search-actions-row {
    width: 100%;
}

.search-hero .mud-paper,
.map-panel,
.admin-pending-card,
.submit-page .mud-paper,
.admin-page .mud-paper {
    border-color: var(--hb-border);
    background: var(--hb-surface);
}

.map-panel {
    width: 100%;
}

.leaflet-host {
    width: 100%;
    height: clamp(360px, 62vh, 700px);
    border: 1px solid var(--hb-border);
    border-radius: 10px;
}

.details-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1350;
}

.details-modal {
    position: fixed;
    top: 0;
    right: 0;
    width: min(100vw, 430px);
    height: 100vh;
    overflow-y: auto;
    background: var(--hb-surface);
    border-left: 1px solid var(--hb-border);
    z-index: 1351;
}

.mud-overlay-dialog {
    z-index: 1400 !important;
}

.mud-dialog-container,
.mud-dialog {
    z-index: 1401 !important;
}

#blazor-error-ui {
    color-scheme: light only;
    background: #ffe9d6;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.loading-progress {
    display: block;
    width: 5.5rem;
    height: 5.5rem;
    margin: 0.5rem auto 0;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--hb-brand-green);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    text-align: center;
    font-weight: 700;
    font-family: "Montserrat", "Segoe UI", Arial, sans-serif;
    color: #385a10;
    margin-top: 0.35rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

.loading-shell {
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    padding: 1rem;
    background: #ffffff;
}

.loading-logo {
    width: min(86vw, 460px);
    height: auto;
    object-fit: contain;
}

@media (min-width: 960px) {
    .search-page {
        height: auto;
        overflow: visible;
    }

    .search-content {
        overflow: visible;
        margin-top: 0.5rem;
    }

    .search-results-pane {
        overflow: visible;
        padding: 0 1rem 1rem 1rem;
    }

    .search-map-column {
        min-height: clamp(360px, 62vh, 700px);
    }

    .search-map-pane {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
    }

    .search-map-pane.map-fixed {
        position: fixed;
        top: var(--search-map-fixed-top, var(--mud-appbar-height));
        left: 0;
        width: 50vw;
    }
}

@media (max-width: 959.95px) {
    .search-page {
        height: auto;
        overflow: visible;
        gap: 0.75rem;
    }

    .search-content,
    .search-content-grid,
    .search-map-pane,
    .search-results-pane {
        height: auto;
        overflow: visible;
    }

    .search-map-pane {
        padding-right: 0;
    }

    .search-results-pane {
        padding-top: 20px;
    }

    .search-map-pane .leaflet-host {
        height: clamp(360px, 62vh, 700px);
        min-height: 360px;
    }
}

@media (max-width: 599.95px) {
    .leaflet-host {
        height: 48vh;
    }

    .search-map-pane .leaflet-host {
        height: 48vh;
        min-height: 280px;
    }
}

.mud-button-root.search-cta {
    margin-top: 8px;
    margin-bottom: 4px;
    padding: 15px;
}
