/* MapTrax v2.8.0.0 — Metes & Bounds Editor styles
   Lives inside the existing #quarter-editor panel, alongside the
   Quarter-Call pane. */

/* ---- Tab strip at the top of the panel ---- */

.qe-tab-strip {
    display: flex;
    gap: 4px;
    padding: 4px 4px 0;
    margin: -8px -8px 6px -8px;
    border-bottom: 1px solid #d4c5b0;
    background: rgba(0, 0, 0, 0.03);
}

.qe-tab {
    padding: 6px 12px;
    background: transparent;
    color: #666;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.qe-tab:hover {
    background: #f5efe8;
    color: #333;
}

.qe-tab.active {
    background: white;
    border-color: #d4c5b0;
    color: #b96c28;
    margin-bottom: -1px;
    padding-bottom: 7px;
}

.qe-tab-pane {
    /* default — visible. Inactive panes get inline display:none from the JS */
}

/* ---- M&B editor body ---- */

.mb-editor-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 12px;
}

.mb-pane {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid #d4c5b0;
    border-radius: 5px;
    padding: 8px;
}

.mb-pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.mb-pane-title {
    font-weight: 600;
    color: #333;
    font-size: 12px;
}

/* Section info header strip — shows which section is being used */
.mb-section-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: #f0f4f8;
    border: 1px solid #c9d6e0;
    border-radius: 4px;
    font-size: 11px;
    color: #2b4a6c;
}

.mb-section-info.mb-section-warn {
    background: #fff7e0;
    border-color: #f0d878;
    color: #6b4d10;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.mb-section-label {
    font-weight: 500;
    flex-shrink: 0;
}

.mb-section-info select {
    flex: 1;
    padding: 3px 5px;
    font-size: 11px;
    border: 1px solid #c9d6e0;
    border-radius: 3px;
}

/* Pick Top Edge status strip */
.mb-top-edge-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
    padding: 5px 8px;
    background: #eef4ff;
    border: 1px solid #b6c8e2;
    border-radius: 3px;
    font-size: 11px;
    color: #1e3a8a;
    flex-wrap: wrap;
}

.mb-top-edge-status.mb-top-edge-set {
    background: #e7f5ff;
    border-color: #93c5fd;
}

.mb-top-edge-status.mb-top-edge-picking {
    background: #fff7ed;
    border-color: #f59e0b;
    color: #78350f;
    animation: mb-pulse 1.4s ease-in-out infinite;
}

@keyframes mb-pulse {
    0%, 100% { background: #fff7ed; }
    50% { background: #fed7aa; }
}

.mb-editor-close {
    flex-shrink: 0;
    background: rgba(255,255,255,0.5);
    border: 1px solid #b0c0d0;
    color: #555;
    font-size: 20px;
    line-height: 1;
    padding: 2px 10px;
    cursor: pointer;
    border-radius: 4px;
    align-self: flex-start;
    font-weight: bold;
}

.mb-editor-close:hover {
    background: #f0f0f0;
    color: #c00;
    border-color: #c00;
}

.mb-close-editor-btn {
    /* Make the explicit "Close Editor" button visually balanced with Save */
    padding: 5px 14px;
}

/* Save pane extras */
.mb-save-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed #e0d8c8;
    font-size: 11px;
    color: #555;
    line-height: 1.4;
    cursor: pointer;
    user-select: none;
}

.mb-save-checkbox input[type="checkbox"] {
    margin: 1px 0 0 0;
    cursor: pointer;
}

.mb-save-checkbox strong {
    color: #333;
}

.mb-save-edit-note {
    background: #fff5e0;
    border: 1px solid #f0d878;
    border-radius: 4px;
    padding: 6px 8px;
    margin-bottom: 8px;
    font-size: 11px;
    color: #6b4d10;
}

.mb-btn-link {
    background: none;
    border: none;
    color: #b96c28;
    cursor: pointer;
    font-size: 11px;
    text-decoration: underline;
    padding: 0;
}

.mb-btn-link:hover {
    color: #8c4f1d;
}

/* ---- Call list ---- */

.mb-call-list {
    max-height: 220px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px;
}

.mb-empty-list {
    padding: 12px;
    color: #888;
    font-style: italic;
    font-size: 11px;
    text-align: center;
}

.mb-call-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 11px;
    cursor: pointer;
}

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

.mb-call-row:hover {
    background: #fff8e8;
}

.mb-call-row.mb-editing {
    background: #fff5e0;
    border-left: 3px solid #b96c28;
    padding-left: 3px;
}

.mb-call-num {
    flex-shrink: 0;
    width: 32px;
    text-align: right;
    color: #999;
    font-family: monospace;
    font-size: 10px;
}

.mb-call-text {
    flex: 1;
    color: #333;
}

.mb-call-del {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #c00;
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.55;
}

.mb-call-row:hover .mb-call-del {
    opacity: 1;
}

.mb-call-del:hover {
    color: #800;
}

/* Highlight the entry pane when it's in edit-call mode */
.mb-pane-entry.mb-editing-mode {
    border-color: #b96c28;
    box-shadow: 0 0 0 1px #b96c28;
}

/* ---- List sections (Main / Exception 1 / Exception 2 / ...) ---- */

.mb-list-section {
    margin-bottom: 8px;
    border: 1px solid #e0d8c8;
    border-radius: 4px;
    overflow: hidden;
}

.mb-list-section.mb-list-active {
    border-color: #b96c28;
    background: #fffbf5;
}

.mb-list-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    background: #ede4d4;
    font-size: 11px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    user-select: none;
}

.mb-list-section.mb-list-active .mb-list-header {
    background: #f0d9bd;
    color: #6b3a10;
}

.mb-list-header:hover {
    background: #e3d6bc;
}

.mb-list-title {
    flex: 1;
}

.mb-list-badge {
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 8px;
    background: #fff;
    color: #888;
    border: 1px solid #d0c4ad;
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mb-list-badge-closed {
    background: #f0f8f0;
    color: #1a8c44;
    border-color: #a8d8b8;
}

.mb-list-remove {
    /* Reuses .mb-call-del styling but slightly more visible by default */
    opacity: 0.7;
}

.mb-list-rows {
    background: white;
}

/* ---- Save Tract pane ---- */

.mb-pane-save {
    background: #f5f1e8;
    padding: 8px 10px;
}

.mb-save-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.mb-save-ok {
    color: #1a8c44;
    font-weight: 600;
    font-size: 12px;
}

/* v2.13.2.28: explicit gross/exception/net acreage breakdown in the Save
   pane — only renders when there's at least one exception, so the user
   can verify each exception is being subtracted from the gross. */
.mb-acres-breakdown {
    margin-top: 8px;
    padding: 6px 10px;
    background: #fffdf7;
    border: 1px solid #e0d8c8;
    border-radius: 4px;
    font-size: 11px;
    color: #5a4a2a;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

.mb-acres-line {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
}

.mb-acres-line.mb-acres-less {
    color: #a04a18;
}

.mb-acres-line.mb-acres-net {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #d0c8b8;
    font-weight: 700;
    color: #1a6a34;
}

/* v2.13.2.25: editable acres override row in the Save pane. */
.mb-save-acres-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12px;
    color: #5a4a2a;
}

.mb-save-acres-row label {
    font-weight: 600;
    min-width: 50px;
}

.mb-save-acres-row input[type="number"] {
    width: 90px;
    padding: 3px 6px;
    border: 1px solid #c8b88e;
    border-radius: 3px;
    font-size: 12px;
    background: #fff;
}

.mb-save-acres-row .mb-acres-reset {
    margin-left: auto;
    font-size: 11px;
    background: none;
    border: none;
    color: #b96c28;
    cursor: pointer;
    padding: 2px 4px;
}

.mb-save-acres-row .mb-acres-reset:hover {
    text-decoration: underline;
}

/* v2.13.2.25: checkbox row in the cardinal call form ("Follow section line"). */
.mb-form-row-checkbox {
    grid-template-columns: 1fr !important;
}

.mb-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 11px;
    color: #5a4a2a;
}

.mb-checkbox-label input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.mb-save-blocked {
    color: #888;
    font-size: 11px;
    font-style: italic;
}

.mb-save-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ---- Misclose readout ---- */

.mb-misclose {
    margin-top: 6px;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 11px;
    text-align: center;
    font-weight: 500;
}

.mb-misclose-empty {
    color: #888;
    font-style: italic;
}

.mb-misclose-open {
    color: #c00;
    background: #fff0f0;
    padding: 4px 8px;
    border-radius: 3px;
    display: inline-block;
}

.mb-misclose-near {
    color: #b96c28;
    background: #fff5e0;
    padding: 4px 8px;
    border-radius: 3px;
    display: inline-block;
}

.mb-misclose-closed {
    color: #1a8c44;
    background: #f0f8f0;
    padding: 4px 8px;
    border-radius: 3px;
    display: inline-block;
    font-weight: 600;
}

/* ---- Entry form ---- */

.mb-form-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
    font-size: 11px;
}

.mb-form-row > label {
    flex-shrink: 0;
    width: 80px;
    margin: 0;
    color: #555;
    font-weight: 500;
    font-size: 11px;
}

.mb-form-row > input,
.mb-form-row > select {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
    min-width: 0;
}

.mb-form-row > input[type="number"] {
    max-width: 100px;
}

.mb-bearing-row {
    display: flex;
    gap: 4px;
    align-items: center;
    flex: 1;
    flex-wrap: wrap;
}

.mb-bearing-row select {
    width: 50px;
    padding: 4px;
    font-size: 12px;
}

.mb-bearing-row input {
    width: 50px;
    padding: 4px;
    font-size: 12px;
    text-align: right;
}

.mb-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #eee;
}

.mb-btn-primary {
    padding: 5px 14px;
    background: #b96c28;
    border: none;
    border-radius: 4px;
    color: white;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
}

.mb-btn-primary:hover {
    background: #8c4f1d;
}

.mb-btn-secondary {
    padding: 5px 14px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #333;
    font-size: 12px;
    cursor: pointer;
}

.mb-btn-secondary:hover {
    background: #f5f5f5;
}

/* v2.13.2.29: danger / delete button for "Delete Tract" in the M&B editor. */
.mb-btn-danger {
    padding: 5px 12px;
    background: white;
    border: 1px solid #c44;
    border-radius: 4px;
    color: #a33;
    font-size: 12px;
    cursor: pointer;
    margin-right: 4px;
}

.mb-btn-danger:hover {
    background: #fbeaea;
    color: #800;
    border-color: #800;
}

.mb-hint {
    font-size: 10px;
    color: #777;
    background: #fffbe8;
    border-left: 3px solid #f0d878;
    padding: 5px 8px;
    margin: 6px 0;
    border-radius: 0 3px 3px 0;
    line-height: 1.4;
}

/* ---- Advanced expander ---- */

.mb-advanced {
    border-top: 1px solid #ddd;
    padding-top: 6px;
    margin-top: 4px;
    font-size: 11px;
}

.mb-advanced summary {
    cursor: pointer;
    color: #666;
    font-weight: 500;
    padding: 4px 0;
    user-select: none;
}

.mb-advanced summary:hover {
    color: #333;
}

.mb-advanced[open] summary {
    margin-bottom: 4px;
}
