/* MapTrax v2.4.1.3 - Split Screen & Attribute Table Styles */
/* v2.4.0.1.0 - Attribute Table Feature */

/* Main container for split-screen layout */
#main-container {
    position: fixed;
    top: 60px; /* Below toolbar */
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Map container (resizable) */
#map-container {
    flex: 1;
    position: relative;
    min-height: 300px; /* Minimum map height */
    overflow: hidden;
}

#map {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Draggable divider */
.divider {
    height: 8px;
    background: linear-gradient(to bottom, #b96c28, #7a4d27);
    cursor: ns-resize;
    position: relative;
    flex-shrink: 0;
    z-index: 999;
    display: none; /* Hidden by default, shown when drawer is open */
}

.divider:hover {
    background: linear-gradient(to bottom, #d17b2f, #8a5a2f);
}

.divider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 4px;
    background: #f5efe8;
    border-radius: 2px;
    pointer-events: none;
}

/* Attribute drawer container */
.attribute-drawer {
    height: 0;
    background: white;
    border-top: 2px solid #b96c28;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: height 0.3s ease;
    min-height: 0;
}

.attribute-drawer.open {
    height: 350px; /* Default open height */
    min-height: 200px;
}

/* Drawer header - COMPACT VERSION */
.drawer-header {
    background: linear-gradient(to bottom, #f5efe8, #ede5dc);
    border-bottom: 2px solid #b96c28;
    padding: 6px 16px; /* Reduced from 12px 20px */
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.drawer-header h3 {
    margin: 0;
    font-size: 13px; /* Reduced from 16px */
    color: #7a4d27;
    font-weight: 700;
}

.drawer-actions {
    display: flex;
    gap: 10px;
}

.drawer-btn {
    padding: 6px 14px;
    background: #b96c28;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.2s;
}

.drawer-btn:hover {
    background: #a35c20;
}

/* Drawer content area */
.drawer-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.table-container {
    flex: 1;
    overflow: auto;
    position: relative;
}

/* Attribute table styling */
.attribute-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: white;
}

.attribute-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #7a4d27;
}

.attribute-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: white;
    border-right: 1px solid #6a421f;
    white-space: nowrap;
    background: #7a4d27;
    position: relative;
    user-select: none;
}

.attribute-table th:last-child {
    border-right: none;
}

/* Sorted column indicator */
.attribute-table th.sorted {
    background: #8a5a2f;
}

/* Column resizer */
.column-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
}

.column-resizer:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* v2.13.2.15: column-reorder drag-and-drop. The whole <th> is
 * draggable; .col-dragging dims the source while dragging,
 * .col-drop-target highlights the column the cursor is currently
 * hovering over so the user knows where the dropped column will
 * land (it inserts BEFORE the highlighted column). */
.attribute-table th.col-dragging {
    opacity: 0.5;
    cursor: grabbing;
}
.attribute-table th.col-drop-target {
    box-shadow: inset 4px 0 0 #d47e2f;
    background: #fbe8d8;
}

/* Filter dropdown icon next to column headers */
.filter-icon {
    display: inline-block;
    margin-left: 6px;
    cursor: pointer;
    opacity: 0.6;
    font-size: 10px;
    transition: opacity 0.2s;
}

.filter-icon:hover {
    opacity: 1;
}

.filter-icon.active {
    opacity: 1;
    color: #ffd699;
}

/* Filter dropdown menu */
.filter-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 2px solid #b96c28;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 200px;
    display: none;
}

.filter-dropdown.open {
    display: block;
}

.filter-dropdown-header {
    padding: 8px 12px;
    background: #f5efe8;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
    font-size: 12px;
    color: #7a4d27;
}

.filter-dropdown-content {
    padding: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.filter-search-box {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
    margin-bottom: 8px;
}

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

.filter-sort-options {
    padding: 4px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 8px;
}

.filter-sort-btn {
    display: block;
    width: 100%;
    padding: 6px 10px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    transition: background 0.15s;
}

.filter-sort-btn:hover {
    background: #f5efe8;
}

.filter-dropdown-footer {
    padding: 8px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.filter-btn-small {
    padding: 4px 12px;
    font-size: 11px;
    background: #b96c28;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s;
}

.filter-btn-small:hover {
    background: #a35c20;
}

.filter-btn-small.secondary {
    background: #999;
}

.filter-btn-small.secondary:hover {
    background: #777;
}

/* Filter checkbox list */
.filter-checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 3px;
    padding: 6px;
    margin-bottom: 8px;
}

.filter-checkbox-item {
    display: block;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    border-radius: 2px;
    transition: background 0.15s;
    user-select: none;
}

.filter-checkbox-item:hover {
    background: #f5efe8;
}

.filter-checkbox-item input[type="checkbox"] {
    margin-right: 6px;
    cursor: pointer;
}

.attribute-table tbody tr {
    border-bottom: 1px solid #e5e5e5;
    cursor: pointer;
    transition: background 0.15s;
}

.attribute-table tbody tr:hover {
    background: #f5efe8;
}

.attribute-table tbody tr.selected {
    background: #ffd699 !important;
    font-weight: 500;
}

.attribute-table tbody tr.highlighted {
    background: #fff4e6;
}

.attribute-table td {
    padding: 8px 12px;
    border-right: 1px solid #f0f0f0;
    white-space: normal; /* Allow text wrapping */
    word-wrap: break-word;
    word-break: break-word;
    vertical-align: top; /* Align content to top when wrapped */
    line-height: 1.4; /* Better readability for wrapped text */
}

.attribute-table td:last-child {
    border-right: none;
}

/* Empty table message */
.empty-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    padding: 40px 20px;
}

.empty-message p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.empty-submessage {
    font-size: 13px !important;
    font-weight: 400 !important;
    margin-top: 8px !important;
    color: #bbb !important;
}

/* Drawer open button (shown at bottom when drawer is closed) */
.drawer-open-btn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    background: linear-gradient(to bottom, #b96c28, #7a4d27);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(121, 77, 39, 0.4);
    z-index: 998;
    transition: all 0.2s;
}

.drawer-open-btn:hover {
    background: linear-gradient(to bottom, #d17b2f, #8a5a2f);
    box-shadow: 0 6px 16px rgba(121, 77, 39, 0.5);
    transform: translateX(-50%) translateY(-2px);
}

.drawer-open-btn.hidden {
    display: none;
}

/* ---------------------------------------------------------------- */
/* "Show in table" filter-locator banner                            */
/* ---------------------------------------------------------------- */

.table-locator-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    background: #fff7e0;
    border-bottom: 1px solid #f0d878;
    color: #6b4d10;
    font-size: 13px;
}

.table-locator-notice.hidden {
    display: none;
}

.table-locator-text {
    flex: 1;
}

.table-locator-btn {
    padding: 6px 12px;
    background: #f6c344;
    border: 1px solid #d9a92b;
    border-radius: 4px;
    color: #3d2c08;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
}

.table-locator-btn:hover {
    background: #f2b730;
}

.table-locator-close {
    background: none;
    border: none;
    color: #8a6918;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
}

.table-locator-close:hover {
    color: #4a3a08;
}

/* ============================================================================
 * v2.11.0.0 — Inline edit
 * ============================================================================ */

/* Edit Mode banner — slides in at the top of the drawer when active.
   MapTrax accent palette so it reads as "you're in editing state." */
.inline-edit-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, #b96c28 0%, #a05a1f 100%);
    color: #fff;
    padding: 6px 12px;
    border-bottom: 2px solid #7a4d27;
    font-size: 12px;
    font-weight: 500;
}

.inline-edit-banner-text {
    flex: 1;
    letter-spacing: 0.2px;
}

.inline-edit-banner-btn {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: background 0.12s, border-color 0.12s;
}

.inline-edit-banner-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.7);
}

.inline-edit-banner-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.inline-edit-banner-btn-primary {
    background: #fff;
    color: #b96c28;
    border-color: #fff;
}

.inline-edit-banner-btn-primary:hover {
    background: #fff8e8;
    color: #7a4d27;
    border-color: #fff8e8;
}

/* Edit Mode toggle button in the drawer header — accent treatment when
   Edit Mode is active so it's visually obvious. */
.drawer-btn.inline-edit-toggle-active {
    background: #b96c28;
    color: #fff;
    border-color: #9a5820;
}

.drawer-btn.inline-edit-toggle-active:hover {
    background: #9a5820;
}

/* When Edit Mode is on, the table itself gets an accent border so the
   user can see at a glance "this table is editable right now." */
#table-body[data-edit-mode="1"] {
    /* Padding/borders on tbody don't always render in browsers, so we use
       an outline. The outer .table-container has no border, so this stands
       alone visually. */
}

#attribute-table-container:has(#table-body[data-edit-mode="1"]) {
    box-shadow: inset 0 0 0 2px #b96c28;
}

/* Cells in edit mode get a hover affordance so the user knows they can
   double-click. Cursor + faint tint. */
#table-body[data-edit-mode="1"] td {
    cursor: cell;
}

#table-body[data-edit-mode="1"] td:hover {
    background: rgba(185, 108, 40, 0.05);
}

/* Edited cell — italic, faint accent tint, corner dot indicator. The
   indicator stays visible whether Edit Mode is on or off (so the user
   can see at a glance which cells were modified). */
#table-body td.edited-cell {
    font-style: italic;
    background: rgba(185, 108, 40, 0.08);
    position: relative;
}

#table-body td.edited-cell::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 6px;
    height: 6px;
    background: #b96c28;
    border-radius: 50%;
    pointer-events: none;
}

/* Cell currently being edited — highlight to make it obvious which one
   has focus while Tab-cycling. */
#table-body td.inline-edit-active {
    background: #fff8e8;
    box-shadow: inset 0 0 0 2px #b96c28;
    padding: 0;            /* let the input fill the cell */
}

/* Inline-edit input — fills the cell, MapTrax form palette. */
.inline-edit-input {
    width: 100%;
    height: 100%;
    min-height: 26px;
    box-sizing: border-box;
    padding: 4px 6px;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: inherit;
    color: #2a1f0c;
    background: transparent;
}

.inline-edit-input-number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.inline-edit-input:focus {
    background: #fff;
}
