/* MapTrax v2.9.0.0 — Asset Detail modal styles
   Mirrors the .color-rules-* pattern but is wider (asset detail has a tract
   table that needs horizontal room) and uses MapTrax's burnt-orange accents. */

.asset-detail-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9100;
    align-items: center;
    justify-content: center;
}

.asset-detail-backdrop.visible {
    display: flex;
}

.asset-detail-dialog {
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 95vw;
    max-width: 1500px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.asset-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(to bottom, #b96c28, #7a4d27);
    color: white;
    border-bottom: 1px solid #5a3a1f;
}

.asset-detail-title {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.asset-detail-title h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asset-detail-id-badge {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.asset-detail-mms-link {
    color: #ffe6cc;
    text-decoration: none;
    font-size: 11px;
    border-bottom: 1px dotted #ffe6cc;
    flex-shrink: 0;
}

.asset-detail-mms-link:hover {
    color: white;
    border-bottom-color: white;
}

.asset-detail-chip {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.18);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.asset-detail-close {
    flex-shrink: 0;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    font-size: 22px;
    line-height: 1;
    padding: 2px 12px;
    cursor: pointer;
    border-radius: 4px;
    margin-left: 12px;
}

.asset-detail-close:hover {
    background: rgba(255,255,255,0.3);
}

.asset-detail-content {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
    background: #faf6f0;
}

.asset-detail-section {
    background: white;
    border: 1px solid #d4c5b0;
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 12px;
}

.asset-detail-section h3 {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: #7a4d27;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #ede4d4;
    padding-bottom: 4px;
}

.asset-detail-fields {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 6px 12px;
    align-items: center;
    font-size: 13px;
}

.asset-detail-fields label {
    color: #555;
    font-weight: 500;
}

.asset-detail-fields .value {
    color: #222;
}

.asset-detail-fields .value.muted {
    color: #888;
    font-style: italic;
}

.asset-detail-fields input,
.asset-detail-fields textarea {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #c4b89e;
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
}

.asset-detail-fields input:focus,
.asset-detail-fields textarea:focus {
    outline: none;
    border-color: #b96c28;
    box-shadow: 0 0 0 2px rgba(185, 108, 40, 0.2);
}

.asset-detail-rollup {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 6px;
}

.asset-detail-stat {
    background: #f5efe8;
    border: 1px solid #e0d8c8;
    border-radius: 4px;
    padding: 8px 10px;
    text-align: center;
}

.asset-detail-stat-value {
    font-size: 16px;
    font-weight: 600;
    color: #7a4d27;
    line-height: 1.1;
}

.asset-detail-stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    margin-top: 2px;
}

.asset-detail-tract-list {
    border-collapse: collapse;
    width: 100%;
    font-size: 12px;
    background: white;
}

.asset-detail-tract-list th {
    text-align: left;
    padding: 6px 8px;
    background: #ede4d4;
    color: #555;
    font-weight: 600;
    border-bottom: 1px solid #c4b89e;
    position: sticky;
    top: 0;
}

.asset-detail-tract-list td {
    padding: 5px 8px;
    border-bottom: 1px solid #f0e8d8;
}

.asset-detail-tract-list tbody tr {
    cursor: pointer;
}

.asset-detail-tract-list tbody tr:hover {
    background: #fff8e8;
}

.asset-detail-tract-list tbody tr:last-child td {
    border-bottom: none;
}

.asset-detail-tract-list-wrapper {
    /* Vertical scroll only — modal is wide enough that all columns fit
       without horizontal scrolling. */
    max-height: 50vh;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #d4c5b0;
    border-radius: 4px;
}

.asset-detail-tract-list {
    width: 100%;
    table-layout: auto;
}

.asset-detail-tract-list th,
.asset-detail-tract-list td {
    white-space: nowrap;  /* keep numbers and short labels on one line */
}

.asset-detail-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 8px 0;
    border-bottom: 1px solid #ede4d4;
    padding-bottom: 4px;
}

.asset-detail-section-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #7a4d27;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.asset-detail-hint {
    font-size: 11px;
    color: #888;
    font-style: italic;
}

/* Breakdown section: side-by-side mini tables for Interest Type and County */
.asset-detail-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 720px) {
    .asset-detail-breakdown { grid-template-columns: 1fr; }
}

.asset-detail-breakdown-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.asset-detail-breakdown-label {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.asset-detail-mini-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 12px;
    background: white;
    border: 1px solid #e0d8c8;
    border-radius: 3px;
    overflow: hidden;
}

.asset-detail-mini-table th {
    text-align: left;
    padding: 4px 6px;
    background: #f5efe8;
    color: #555;
    font-weight: 600;
    font-size: 11px;
    border-bottom: 1px solid #e0d8c8;
}

.asset-detail-mini-table td {
    padding: 4px 6px;
    border-bottom: 1px solid #f3eddf;
}

.asset-detail-mini-table tbody tr:last-child td {
    border-bottom: none;
}

/* Interest type tag — small color-coded chip on the breakdown + tract rows */
.asset-int-tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    border: 1px solid currentColor;
    background: rgba(0, 0, 0, 0.02);
}

.asset-int-min      { color: #1a8c44; }   /* mineral interest — green */
.asset-int-nri      { color: #1a8c44; }
.asset-int-mineral  { color: #1a8c44; }
.asset-int-npri     { color: #b96c28; }   /* non-participating royalty — burnt orange */
.asset-int-orri     { color: #6b5b95; }   /* override — purple */
.asset-int-rsa      { color: #555; }      /* surface area / fallback */

/* AOI pills — for the "Areas of Interest" list under Breakdown */
.asset-detail-aoi-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.asset-detail-aoi-pills {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.asset-aoi-pill {
    background: #f5efe8;
    border: 1px solid #d4c5b0;
    color: #7a4d27;
    padding: 2px 8px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 500;
}

.asset-detail-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    background: #ede4d4;
    border-top: 1px solid #d4c5b0;
}

.asset-detail-btn-primary {
    padding: 6px 18px;
    background: linear-gradient(to bottom, #d17b2f, #b96c28);
    border: 1px solid #8a5a2f;
    color: white;
    font-size: 13px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
}

.asset-detail-btn-primary:hover {
    background: linear-gradient(to bottom, #d8853a, #c47731);
}

.asset-detail-btn-secondary {
    padding: 6px 16px;
    background: white;
    border: 1px solid #c4b89e;
    color: #555;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
}

.asset-detail-btn-secondary:hover {
    background: #f5efe8;
}

/* Floating Asset Panel — left side, dedicated to the asset list */
.assets-panel {
    position: absolute;
    top: 92px;       /* clear of the toolbar */
    left: 14px;
    width: 280px;
    max-height: calc(100vh - 140px);
    background: white;
    border: 1px solid #d4c5b0;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 850;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* v2.10.2.1: hold the user's chosen width across resize + reload. The
       inline `style="width: Npx"` set by JS on init / drag overrides this. */
}

/* v2.10.2.1: drag-to-resize handle on the right edge. 6px wide so it's
   easy to grab without taking visible space from the panel content. */
.assets-panel-resize {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
    z-index: 851;
}

.assets-panel-resize:hover {
    background: #b96c28;
    opacity: 0.4;
}

/* While the handle is grabbed, body cursor is set programmatically; CSS
   here just keeps the visual indicator on hover when not dragging. */

/* v2.10.2.1: wrap-names mode — long asset names break to multiple lines
   so the full name is visible. Off by default (toggleable in header). */
.assets-panel.wrap-names .asset-row-name {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

/* v2.10.2.1: wrap toggle button in panel header. Sits next to collapse. */
.assets-panel-wrap {
    background: transparent;
    border: 1px solid transparent;
    color: #6b5536;
    width: 22px;
    height: 22px;
    padding: 0;
    margin-right: 4px;
    line-height: 18px;
    text-align: center;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.assets-panel-wrap:hover {
    background: #f5efe8;
    border-color: #d4c5b0;
}

.assets-panel-wrap.active {
    background: #b96c28;
    color: #fff;
    border-color: #9a5820;
}

.assets-panel.collapsed .assets-panel-wrap,
.assets-panel.collapsed .assets-panel-resize {
    display: none;
}

.assets-panel.collapsed {
    width: 44px;
}

.assets-panel.collapsed .assets-panel-body,
.assets-panel.collapsed .assets-panel-title {
    display: none;
}

.assets-panel.collapsed .assets-panel-collapse {
    transform: rotate(180deg);
}

.assets-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 8px 10px;
    background: linear-gradient(to bottom, #b96c28, #7a4d27);
    color: white;
    border-bottom: 1px solid #5a3a1f;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.assets-panel-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.assets-panel-count {
    color: #ffe6cc;
    font-weight: 500;
    font-size: 11px;
}

.assets-panel-collapse {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 11px;
    line-height: 1;
    padding: 3px 7px;
    border-radius: 3px;
    cursor: pointer;
    flex-shrink: 0;
}

.assets-panel-collapse:hover {
    background: rgba(255, 255, 255, 0.3);
}

.assets-panel-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 8px;
    background: #faf6f0;
    flex: 1;
}

.assets-panel-filter {
    width: 100%;
    padding: 5px 8px;
    font-size: 12px;
    border: 1px solid #c4b89e;
    border-radius: 3px;
    box-sizing: border-box;
    background: white;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.assets-panel-filter:focus {
    outline: none;
    border-color: #b96c28;
    box-shadow: 0 0 0 2px rgba(185, 108, 40, 0.2);
}

/* Sidebar Assets list (now lives inside the floating Asset panel) */
.assets-sidebar-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #d4c5b0;
    border-radius: 3px;
    background: white;
    min-height: 100px;
}

/* v2.10.1.0: row body is no longer clickable (explicit Zoom/Details
   buttons handle the actions). Hover-highlight stays as a visual cue
   for which asset's tracts are currently glowing on the map. */
.asset-row {
    display: flex;
    flex-direction: column;
    padding: 4px 8px;
    font-size: 12px;
    border-bottom: 1px solid #f0e8d8;
    cursor: default;
    user-select: none;
}

.asset-row-main {
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.asset-row:hover {
    background: #fff8e8;
}

.asset-row-id {
    flex-shrink: 0;
    color: #888;
    font-family: monospace;
    font-size: 11px;
    min-width: 40px;
}

.asset-row-name {
    flex: 1;
    color: #222;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asset-row-count {
    flex-shrink: 0;
    background: #ede4d4;
    color: #555;
    padding: 1px 6px;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 600;
}

/* v2.10.1.0: per-row action buttons (Zoom + Details). */
.asset-row-action {
    flex-shrink: 0;
    width: 24px;
    height: 22px;
    padding: 0;
    background: transparent;
    color: #6b5536;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.asset-row-action:hover {
    background: #b96c28;
    color: #fff;
    border-color: #9a5820;
}

/* v2.10.1.0: source-file sub-label, shown only when multiple files
   contribute assets (computed in renderAssetSidebar). */
.asset-row-source {
    margin-top: 1px;
    margin-left: 46px;       /* aligns under the name (past the ID column) */
    font-size: 10px;
    color: #8a7752;
    letter-spacing: 0.3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* v2.10.1.0: inline sort header rendered above the asset list. Mirrors the
   color legend's sort UI for consistency — up/down triangles above each
   sortable column (ID, name, count). One-click access to every sort. */
.asset-sort-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 6px;
    margin-bottom: 2px;
    border-bottom: 1px solid #ecdfce;
}

.asset-sort-col {
    display: inline-flex;
    gap: 1px;
    line-height: 1;
}

.asset-sort-col-name {
    /* Center the name-column arrows over the (variable-width) name area */
    justify-content: center;
}

.asset-sort-arrow {
    background: transparent;
    border: none;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    color: #c8b79d;
    padding: 1px 2px;
    margin: 0;
    cursor: pointer;
    line-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
}

.asset-sort-arrow svg {
    display: block;
}

.asset-sort-arrow:hover {
    color: #7a4d27;
    background: #f5efe8;
}

/* Trailing background override defends against any global
   `button.active { background: #b96c28 }` rule. */
.asset-sort-arrow.active {
    color: #b96c28;
    background: transparent;
}

.asset-sort-arrow.active:hover {
    background: #f5efe8;
}

.asset-row.asset-row-empty {
    color: #888;
    font-style: italic;
    text-align: center;
    cursor: default;
    padding: 12px 8px;
}

.asset-row.asset-row-empty:hover {
    background: white;
}
