/* MapTrax CSV Import Wizard Styles */

/* Backdrop overlay */
.wizard-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}

.wizard-backdrop.visible {
    display: flex;
}

/* Main wizard container */
.csv-wizard {
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    overflow-y: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Header with step indicators */
.wizard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 2px solid #b96c28;
    background: #f5efe8;
    position: sticky;
    top: 0;
    z-index: 10;
}

.wizard-header h3 {
    margin: 0;
    font-size: 16px;
    color: #794500;
}

.wizard-steps {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wizard-steps .step {
    padding: 4px 12px;
    background: #ddd;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
}

.wizard-steps .step.active {
    background: #b96c28;
    color: white;
}

.wizard-steps .step.completed {
    background: #28a745;
    color: white;
}

.wizard-steps .step-arrow {
    color: #999;
    font-size: 14px;
}

.wizard-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0 8px;
    line-height: 1;
}

.wizard-close:hover {
    color: #dc3545;
}

/* Step content containers */
.wizard-step {
    display: none;
    padding: 16px;
}

.wizard-step.active {
    display: block;
}

.wizard-section {
    margin-bottom: 12px;
}

.wizard-section label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

/* CSV Preview Table */
.csv-preview-container {
    max-height: 200px;
    overflow: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 12px 0;
}

.csv-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.csv-preview-table th,
.csv-preview-table td {
    padding: 6px 10px;
    border: 1px solid #ddd;
    text-align: left;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.csv-preview-table th {
    background: #f5f5f5;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.csv-preview-table tbody tr:nth-child(even) {
    background: #fafafa;
}

/* Clickable headers in mapping mode */
.csv-preview-table.mapping-mode th {
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.csv-preview-table.mapping-mode th:hover {
    background: #e7f3ff;
    border-color: #0066cc;
}

.csv-preview-table th.mapped {
    background: #d4edda;
    color: #155724;
}

.csv-preview-table th.highlight-select {
    background: #fff3cd;
    box-shadow: inset 0 0 0 2px #ffc107;
    animation: pulse-border 1s infinite;
}

@keyframes pulse-border {
    0%, 100% { box-shadow: inset 0 0 0 2px #ffc107; }
    50% { box-shadow: inset 0 0 0 3px #ff9800; }
}

.csv-preview-table th .mapping-badge {
    display: block;
    font-size: 9px;
    color: #28a745;
    font-weight: normal;
    margin-top: 2px;
}

/* Preview info bar */
.preview-info {
    font-size: 11px;
    color: #666;
    background: #f5f5f5;
    padding: 6px 10px;
    border-radius: 4px;
    display: inline-block;
}

/* Format Detection */
.format-detection {
    background: #f0f0f0;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detection-label {
    font-size: 11px;
    color: #666;
}

.detected-format {
    font-size: 12px;
    font-weight: 600;
}

.detected-format.success {
    color: #28a745;
}

.detected-format.warning {
    color: #ffc107;
}

/* Format Selection Radio Buttons */
.format-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.format-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.format-option:hover {
    border-color: #b96c28;
    background: #f5efe8;
}

.format-option input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

.format-option .format-label {
    font-size: 12px;
    color: #333;
}

.format-option:has(input:checked) {
    border-color: #b96c28;
    background: #f5efe8;
}

.format-option:has(input:checked) .format-label {
    font-weight: 600;
    color: #794500;
}

/* Mapping Instructions */
.mapping-instructions {
    background: #e7f3ff;
    border: 1px solid #b3d7ff;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
}

.mapping-instructions p {
    margin: 0;
    font-size: 12px;
    color: #0056b3;
}

.mapping-instructions .mapping-hint {
    margin-top: 8px;
    font-size: 11px;
}

.mapping-instructions .mapping-hint strong {
    color: #ff9800;
}

/* Field Mapping Groups */
.field-mapping-group {
    margin: 12px 0;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
}

.field-mapping-group h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #555;
    border-bottom: 1px solid #ddd;
    padding-bottom: 6px;
}

.field-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Field Buttons */
.field-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    min-width: 110px;
    transition: all 0.2s;
}

.field-btn:hover {
    border-color: #b96c28;
    background: #f5efe8;
}

.field-btn.active {
    border-color: #ffc107;
    background: #fff3cd;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.3);
}

.field-btn.mapped {
    border-color: #28a745;
    background: #d4edda;
}

.field-btn .field-name {
    font-weight: 600;
    font-size: 12px;
    color: #333;
}

.field-btn .field-mapping {
    font-size: 10px;
    color: #666;
    margin-top: 2px;
}

.field-btn.mapped .field-mapping {
    color: #155724;
}

.field-btn .required-badge {
    font-size: 9px;
    color: #dc3545;
    margin-top: 2px;
}

.field-btn.mapped .required-badge {
    color: #28a745;
}

/* Validation Status */
.mapping-validation {
    padding: 10px 12px;
    border-radius: 6px;
    margin: 12px 0;
    font-size: 12px;
}

.mapping-validation.valid {
    background: #d4edda;
    border: 1px solid #28a745;
    color: #155724;
}

.mapping-validation.invalid {
    background: #f8d7da;
    border: 1px solid #dc3545;
    color: #721c24;
}

.mapping-validation.neutral {
    background: #e7f3ff;
    border: 1px solid #b3d7ff;
    color: #0056b3;
}

/* Wizard Action Buttons */
.wizard-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid #ddd;
    margin-top: 16px;
}

.wizard-actions button {
    padding: 10px 20px;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.wizard-actions button:not(.secondary) {
    background: #b96c28;
    color: white;
    border: none;
}

.wizard-actions button:not(.secondary):hover {
    background: #a96932;
}

.wizard-actions button:not(.secondary):disabled {
    background: #ccc;
    cursor: not-allowed;
}

.wizard-actions button.secondary {
    background: #7a4d27;
    color: white;
    border: none;
}

.wizard-actions button.secondary:hover {
    background: #5a3517;
}

/* Clear mapping button */
.clear-mapping-btn {
    font-size: 9px;
    padding: 2px 6px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    margin-left: 4px;
}

.clear-mapping-btn:hover {
    background: #c82333;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .csv-wizard {
        width: 95%;
        max-height: 90vh;
    }

    .wizard-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .wizard-steps {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 8px;
    }

    .field-buttons {
        justify-content: center;
    }

    .field-btn {
        min-width: 90px;
    }
}

/* ============================================================================
   Export Filter Dialog
   ============================================================================ */

.export-dialog {
    width: 550px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.export-dialog-content {
    padding: 16px;
}

.export-summary {
    background: #f5efe8;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #794500;
}

.export-section {
    margin-bottom: 14px;
}

.export-section > label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.export-optional {
    font-weight: normal;
    color: #999;
}

.export-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background: white;
}

.export-filter-values {
    margin-bottom: 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    background: #fafafa;
}

.export-value-controls {
    margin-bottom: 8px;
}

.export-value-search {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 6px;
    box-sizing: border-box;
}

.export-value-buttons {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.export-value-buttons button {
    padding: 4px 10px;
    font-size: 11px;
    border: 1px solid #b96c28;
    border-radius: 3px;
    background: #f5efe8;
    color: #794500;
    cursor: pointer;
}

.export-value-buttons button:hover {
    border-color: #794500;
    background: #b96c28;
    color: white;
}

.export-value-count {
    font-size: 11px;
    color: #666;
    padding: 4px 0;
}

.export-value-list {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: white;
}

.export-value-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.export-value-item:last-child {
    border-bottom: none;
}

.export-value-item:hover {
    background: #f5efe8;
}

.export-value-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.export-value-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.export-value-badge {
    background: #e0e0e0;
    color: #555;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.export-mode-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.export-mode-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.export-mode-option:hover {
    border-color: #b96c28;
    background: #f5efe8;
}

.export-mode-option:has(input:checked) {
    border-color: #b96c28;
    background: #f5efe8;
}

.export-mode-option input[type="radio"] {
    margin-top: 2px;
    cursor: pointer;
}

.export-mode-label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.export-mode-desc {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}

.export-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid #ddd;
    margin-top: 14px;
}

.export-actions button {
    padding: 10px 20px;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.export-actions button:not(.secondary) {
    background: #b96c28;
    color: white;
}

.export-actions button:not(.secondary):hover {
    background: #a96932;
}

.export-actions button:not(.secondary):disabled {
    background: #ccc;
    cursor: not-allowed;
}

.export-actions button.secondary {
    background: #7a4d27;
    color: white;
}

.export-actions button.secondary:hover {
    background: #5a3517;
}

/* Visibility filter status badge in sidebar.
 * v2.13.2.20: matched the visual pattern of .color-rule-status and
 * .label-rule-status — left-accent border (3px) instead of a full
 * 1px box, same radius/padding/gap so all three Display rule badges
 * read as a uniform group inside the Layers panel. */
.filter-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 6px 8px;
    background: #f5efe8;
    border-left: 3px solid #b96c28;
    border-radius: 3px;
    font-size: 11px;
    color: #794500;
    font-weight: 500;
}

/* v2.10.2.3: filter status text — clicking opens the filter dialog. */
.filter-status-text {
    flex: 1;
    cursor: pointer;
    text-align: left;
}

.filter-status-text:hover {
    text-decoration: underline;
}

/* v2.10.2.3: filter status ✕ — one-click turns off all visibility filters. */
.filter-status-clear {
    background: transparent;
    border: 1px solid transparent;
    color: #794500;
    width: 20px;
    height: 20px;
    padding: 0;
    line-height: 16px;
    text-align: center;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.filter-status-clear:hover {
    background: #fdf2e6;
    color: #b96c28;
    border-color: #b96c28;
}

/* v2.11.2.1: shared icon-button styles for the eyeball + ✕ controls on
   the sidebar rule-status badges (Filter, Color, Label). Same visual
   weight as .filter-status-clear so the row reads as a single chip. */
.rule-status-toggle,
.rule-status-clear {
    background: transparent;
    border: 1px solid transparent;
    color: #794500;
    width: 22px;
    height: 22px;
    padding: 0;
    line-height: 18px;
    text-align: center;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.rule-status-toggle:hover,
.rule-status-clear:hover {
    background: #fdf2e6;
    color: #b96c28;
    border-color: #b96c28;
}

.rule-status-clear {
    font-size: 14px;
    font-weight: 700;
}

/* v2.11.2.2: matching icon for the Filter status badge — same visual
   weight as .color-rule-status-icon (🎨) and .label-rule-status-icon (🏷️). */
.filter-status-icon {
    font-size: 13px;
    line-height: 1;
    flex-shrink: 0;
}

/* v2.11.2.2: make the Color and Label status text clickable like the
   Filter status text (which already had .filter-status-text). Click
   opens Display Options on the matching tab. */
.color-rule-status-text,
.label-rule-status-text {
    cursor: pointer;
}

.color-rule-status-text:hover,
.label-rule-status-text:hover {
    text-decoration: underline;
}
