* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f5; padding: 20px; }
.container { max-width: 100%; margin: 0 auto; }

/* Header row with title and info button */
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
h1 { color: #333; font-size: 24px; margin: 0; }

/* Info Mode button */
.info-mode-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #1976d2;
    background: white;
    color: #1976d2;
    font-weight: bold;
    font-size: 16px;
    font-style: italic;
    font-family: Georgia, serif;
    cursor: pointer;
    transition: all 0.2s ease;
}
.info-mode-btn:hover {
    background: #1976d2;
    color: white;
}
.info-mode-btn.active {
    background: #1976d2;
    color: white;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.3);
}

/* Info Mode overlay */
.info-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 900;
}
body.info-mode-active .info-overlay {
    display: block;
}

/* Info Mode - make interactive elements appear above overlay */
body.info-mode-active .controls,
body.info-mode-active .header-row,
body.info-mode-active #table-head,
body.info-mode-active .refresh-section,
body.info-mode-active .stats {
    position: relative;
    z-index: 950;
}

/* Info Mode - highlight hoverable elements */
body.info-mode-active [data-help] {
    cursor: help;
    transition: all 0.15s ease;
}
body.info-mode-active [data-help]:hover {
    box-shadow: inset 0 0 0 3px #ff9800;
    position: relative;
    z-index: 1000;
}
/* Only add background highlight to non-button, non-header elements */
body.info-mode-active [data-help]:not(button):not(th):not(.info-legend-header):hover {
    background: rgba(25, 118, 210, 0.1) !important;
}

/* Related element highlight (e.g., Edit Mode -> PAN Benefits) */
.info-related-highlight,
th.info-related-highlight,
th.section-header.info-related-highlight,
#table-head th.info-related-highlight,
#table-head th.section-header.info-related-highlight {
    background: #e65100 !important;
    color: white !important;
    position: relative;
    z-index: 100;
    animation: info-pulse 0.6s ease-in-out infinite !important;
}
@keyframes info-pulse {
    0%, 100% {
        box-shadow: 0 0 0 4px #e65100, 0 0 15px #e65100;
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 8px #ff9800, 0 0 25px #ff9800;
        transform: scale(1.02);
    }
}

/* Info Mode tooltip */
.info-tooltip {
    position: fixed;
    background: #333;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    max-width: 300px;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.info-tooltip.visible {
    opacity: 1;
}
.info-tooltip-title {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 6px;
    color: #64b5f6;
}
.info-tooltip-desc {
    font-size: 13px;
    line-height: 1.4;
}

/* Info Mode - disable interactions except hover */
body.info-mode-active button:not(.info-mode-btn):not([data-help]),
body.info-mode-active input:not([data-help]),
body.info-mode-active select,
body.info-mode-active .copyable,
body.info-mode-active .filterable {
    pointer-events: none;
}
body.info-mode-active [data-help] {
    pointer-events: auto !important;
}

/* Info Mode legend panel */
#info-legend {
    position: relative;
    z-index: 950;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    margin-bottom: 15px;
    border: 2px solid #1976d2;
}
.info-legend-title {
    background: #1976d2;
    color: white;
    font-weight: bold;
    padding: 10px 15px;
    font-size: 14px;
}
.info-legend-sections {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px;
}
.info-legend-group {
    flex: 1;
    min-width: 200px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}
.info-legend-header {
    font-weight: 600;
    font-size: 11px;
    color: white;
    padding: 6px 10px;
    background: #607d8b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
/* Visual connection to Listing Status column */
.info-legend-listing-status .info-legend-header {
    background: #37474f;
}
/* Visual connection to PAN Status column */
.info-legend-pan-status .info-legend-header {
    background: #37474f;
}
.info-legend-items {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px;
}
.info-legend-items [data-help] {
    cursor: help;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    transition: transform 0.15s ease;
}
.info-legend-items [data-help]:hover {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
    transform: scale(1.05);
}
.info-legend-items small {
    opacity: 0.7;
    font-size: 10px;
}

/* File inputs */
.file-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 20px; }
.file-box { background: white; padding: 15px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.file-box label { display: block; font-weight: 600; margin-bottom: 8px; color: #555; font-size: 13px; }
.file-box input[type="file"] { width: 100%; font-size: 12px; }
.file-box .status { font-size: 11px; margin-top: 5px; color: #888; }
.file-box .status.loaded { color: #2e7d32; }
.file-box .path { font-size: 10px; color: #999; word-break: break-all; margin-top: 3px; }

/* Controls */
.controls { background: white; padding: 15px; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); display: flex; gap: 15px; align-items: center; flex-wrap: wrap; }
.controls button { background: #1976d2; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-size: 14px; }
.controls button:hover { background: #1565c0; }
.controls button:disabled { background: #ccc; cursor: not-allowed; }
.controls button.clear-btn { background: #757575; padding: 8px 15px; font-size: 12px; }
.controls button.clear-btn:hover { background: #616161; }
/* Connection Status button */
.controls button.connect-data-btn { background: #1976d2; padding: 10px 20px; font-size: 14px; pointer-events: none; }
.controls button.connect-data-btn.connected { background: #43a047; cursor: default; }
.controls button.connect-data-btn.needs-reconnect { background: #c62828; cursor: pointer; pointer-events: auto; }
.controls button.connect-data-btn.needs-reconnect:hover { background: #b71c1c; }
.controls button.connect-data-btn.saving { background: #ffc107; color: #333; cursor: wait; }
.controls button.connect-data-btn.saving:hover { background: #ffc107; }
.controls button.sync-btn { background: #607d8b; padding: 10px 15px; font-size: 14px; }
.controls button.sync-btn:hover { background: #546e7a; }
.controls button.sync-btn:disabled { background: #ccc; cursor: not-allowed; }
.controls button.sync-btn.has-changes { background: #ff5722; animation: pulse 1s infinite; }
.controls button.sync-btn.has-changes:hover { background: #e64a19; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
.controls input[type="text"] { padding: 8px 12px; border: 1px solid #ddd; border-radius: 5px; width: 250px; }
.stats { font-size: 13px; color: #666; margin-left: auto; }
.active-filters { font-size: 11px; color: #1976d2; }
.global-filter { display: flex; align-items: center; gap: 5px; font-size: 13px; color: #555; cursor: pointer; padding: 6px 10px; background: #f5f5f5; border-radius: 4px; }
.global-filter:hover { background: #e8e8e8; }
.global-filter input { cursor: pointer; }

/* Table */
.table-container { background: white; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); overflow: hidden; }
.table-scroll { overflow-x: auto; max-height: calc(100vh - 280px); overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }

th { background: #1976d2; color: white; padding: 8px 6px; text-align: left; position: sticky; top: 0; white-space: nowrap; z-index: 10; }
th.filterable { cursor: pointer; user-select: none; }
th.filterable:hover { background: #1565c0; }
th.filtered { background: #0d47a1; }
th .col-header { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
th .filter-icon { font-size: 10px; opacity: 0.7; }
th.filtered .filter-icon { opacity: 1; color: #ffeb3b; }

td { padding: 8px 6px; border-bottom: 1px solid #eee; vertical-align: top; }
tr:hover { background: #f5f5f5; }

/* Header highlight when hovering over column */
th.header-highlight { background: #0d47a1 !important; box-shadow: 0 2px 4px rgba(0,0,0,0.3); }

.col-sku { min-width: 150px; font-family: monospace; font-size: 11px; }
.col-asin { min-width: 110px; font-family: monospace; }

/* Copyable column headers */
.col-header-copyable { cursor: pointer; }
.col-header-copyable:hover { background: #1565c0; }
.col-header-copyable.copied { background: #2e7d32 !important; }

/* Copyable cells */
.copyable { cursor: pointer; position: relative; }
.copyable:hover { background: #e3f2fd !important; }
.copyable.copied { background: #c8e6c9 !important; }
.copyable.copied::after {
    content: 'Copied!';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    color: #2e7d32;
    font-weight: bold;
}
.col-status { text-align: center; min-width: 50px; }
.col-inv { text-align: right; min-width: 40px; }
.col-benefit { text-align: center; min-width: 30px; }
.col-date { min-width: 85px; font-size: 11px; }
.col-offer { text-align: center; min-width: 50px; font-size: 10px; }
.offer-active { background: #e8f5e9 !important; color: #2e7d32; font-weight: 500; }
.offer-none { background: #ffebee !important; color: #c62828; }
.offer-not-required { background: #fff3e0 !important; color: #e65100; }
.offer-restricted { background: #fce4ec !important; color: #880e4f; }
.offer-other { background: #f5f5f5 !important; color: #757575; }

/* Status colors */
.status-active { background: #e8f5e9; color: #2e7d32; }
.status-oos { background: #e3f2fd; color: #1565c0; }
.status-archived { background: #fce4ec; color: #c62828; }
.status-deactivated { background: #e1bee7; color: #7b1fa2; }
.status-none { background: transparent; color: #ccc; }

/* Benefits colors */
.benefit-y { background: #e8f5e9; color: #2e7d32; font-weight: bold; }
.benefit-n { background: #ffebee; color: #c62828; }

/* Inventory colors */
.inv-zero { color: #999; }
.inv-positive { background: #c8e6c9; color: #1b5e20; font-weight: 600; }

/* Row hover - darken colored cells */
tr:hover .status-active { background: #c8e6c9; }
tr:hover .status-oos { background: #bbdefb; }
tr:hover .status-archived { background: #f8bbd9; }
tr:hover .status-deactivated { background: #ce93d8; }
tr:hover .benefit-y { background: #c8e6c9; }
tr:hover .benefit-n { background: #ffcdd2; }
tr:hover .inv-positive { background: #a5d6a7; }
tr:hover .missing-pan { background: #e0e0e0; }

/* PAN status badges */
.missing-pan { background: #f5f5f5; }
.pan-status { font-size: 11px; padding: 2px 6px; border-radius: 3px; display: inline-block; white-space: nowrap; }
.pan-enrolled { background: #e8f5e9; color: #2e7d32; }
.pan-eligible { background: #e3f2fd; color: #1565c0; }
.pan-ending-soon { background: #fff3e0; color: #e65100; }
.pan-ineligible { background: #ffebee; color: #c62828; }
.pan-ended { background: #fce4ec; color: #ad1457; }
.pan-failed { background: #fafafa; color: #9e9e9e; font-style: italic; }
.pan-missing { background: #eeeeee; color: #616161; font-weight: bold; }

/* Investigated rows - right-click to toggle */
tr.investigated {
    background: #e3f2fd !important;
    position: relative;
}
tr.investigated td {
    opacity: 0.7;
}
tr.investigated td:first-child::before {
    content: '✓';
    position: absolute;
    left: 4px;
    color: #1976d2;
    font-weight: bold;
}

.section-header { background: #37474f !important; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }

/* Collapsible section headers */
.section-header.collapsible { cursor: pointer; user-select: none; transition: background 0.2s; }
.section-header.collapsible:hover { background: #455a64 !important; }
.section-header.collapsed {
    background: #546e7a !important;
    min-width: 20px !important;
    max-width: 20px !important;
    padding: 4px 6px !important;
    font-size: 10px;
}
.collapse-icon { display: inline-block; font-size: 8px; }
.section-header:not(.collapsed) .collapse-icon { width: 12px; margin-right: 4px; }
.section-collapsed-cell {
    background: #f5f5f5;
    color: #999;
    text-align: center;
    font-size: 10px;
    min-width: 20px !important;
    max-width: 20px !important;
    padding: 4px 2px !important;
}

/* Drag and drop for section reordering */
.section-header.dragging {
    opacity: 0.5;
    background: #263238 !important;
}
.section-header.drag-over {
    background: #1976d2 !important;
    box-shadow: inset 0 0 0 2px #fff;
}

.loading { text-align: center; padding: 40px; color: #666; }

/* Comments column */
.col-comment-header { min-width: 360px; }
.col-comment { min-width: 360px; padding: 4px !important; }
.comment-input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 11px;
    font-family: inherit;
}
.comment-input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}
.comment-input.saving { background: #fff8e1; }
.comment-input.saved { background: #e8f5e9; }
.comment-input:disabled { background: #f5f5f5; color: #999; cursor: not-allowed; }

/* Check column */
.col-check-header { min-width: 60px; }
.col-check { min-width: 60px; text-align: center; padding: 4px !important; }
.check-input { width: 16px; height: 16px; cursor: pointer; }
.check-input:disabled { cursor: not-allowed; opacity: 0.5; }
.check-input.saving { opacity: 0.5; }

/* Updated column */
.col-updated-header { min-width: 85px; }
.col-updated { min-width: 85px; font-size: 11px; color: #666; text-align: center; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-top: 1px solid #eee;
    background: #fafafa;
}
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}
.pagination-controls button {
    background: #1976d2;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pagination-controls button:hover:not(:disabled) { background: #1565c0; }
.pagination-controls button:disabled { background: #ccc; cursor: not-allowed; }
.page-display {
    margin: 0 10px;
    font-size: 13px;
    color: #555;
}
.page-display input {
    width: 50px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 13px;
}
.pagination-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    color: #666;
}
.pagination-info select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

/* Filter dropdown */
.filter-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 180px;
    max-width: 280px;
    max-height: 350px;
    display: none;
    color: #333;
    font-weight: normal;
    text-align: left;
}
.filter-dropdown.show { display: block; }
.filter-dropdown-header {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    gap: 8px;
}
.filter-dropdown-header button {
    flex: 1;
    padding: 5px 8px;
    font-size: 11px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    border-radius: 4px;
    cursor: pointer;
}
.filter-dropdown-header button:hover { background: #e0e0e0; }
.filter-dropdown-search {
    padding: 8px;
    border-bottom: 1px solid #eee;
}
.filter-dropdown-search input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}
.filter-dropdown-list {
    max-height: 220px;
    overflow-y: auto;
    padding: 5px 0;
}
.filter-dropdown-item {
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
}
.filter-dropdown-item:hover { background: #f5f5f5; }
.filter-dropdown-item input { margin: 0; cursor: pointer; }
.filter-dropdown-item label { cursor: pointer; flex: 1; }
.filter-dropdown-item .filter-count { color: #888; font-size: 11px; margin-left: auto; }
.filter-dropdown-item.zero-count { opacity: 0.5; }
.filter-dropdown-item.zero-count .filter-count { color: #c62828; }
.filter-dropdown-footer {
    padding: 8px;
    border-top: 1px solid #eee;
    text-align: right;
}
.filter-dropdown-footer button {
    padding: 6px 15px;
    background: #1976d2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.filter-dropdown-footer button:hover { background: #1565c0; }

/* Edit Mode button */
.controls button.edit-mode-btn { background: #757575; padding: 8px 15px; font-size: 12px; }
.controls button.edit-mode-btn:hover { background: #616161; }
.controls button.edit-mode-btn.active { background: #e65100; }
.controls button.edit-mode-btn.active:hover { background: #d84315; }

/* Generate EFN Files button */
.controls button.generate-btn { background: #6a1b9a; padding: 10px 20px; font-size: 14px; }
.controls button.generate-btn:hover { background: #4a148c; }
.controls button.generate-btn:disabled { background: #ccc; cursor: not-allowed; }

/* Benefit editable cells */
.benefit-editable { padding: 2px !important; }
.benefit-select {
    width: 100%;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    background: white;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    text-align: center;
}
.benefit-select:focus {
    outline: none;
    border-color: #e65100;
    box-shadow: 0 0 0 2px rgba(230, 81, 0, 0.2);
}
.benefit-select.saving { background: #fff8e1; }
.benefit-select.saved { background: #e8f5e9; }

/* Refresh section (collapsible at bottom) */
.refresh-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 20px;
    overflow: hidden;
}
.toggle-refresh-btn {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #455a64;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}
.toggle-refresh-btn:hover { background: #37474f; }
.toggle-refresh-btn .toggle-icon {
    transition: transform 0.2s ease;
}
.refresh-section.collapsed .toggle-icon {
    transform: rotate(-90deg);
}
.refresh-content {
    padding: 20px;
    border-top: 1px solid #eee;
}
.refresh-section.collapsed .refresh-content {
    display: none;
}
.refresh-hint {
    font-size: 12px;
    color: #666;
    margin-bottom: 15px;
}
.refresh-section .file-inputs {
    margin-bottom: 15px;
}
.file-input-group {
    background: #f9f9f9;
    padding: 12px 15px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}
.file-input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
    font-size: 13px;
}
.file-input-group input[type="file"] {
    width: 100%;
    font-size: 12px;
}
.file-input-group .status {
    display: block;
    font-size: 11px;
    margin-top: 5px;
    color: #888;
}
.file-input-group .status.loaded { color: #2e7d32; }
.refresh-btn {
    background: #455a64;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}
.refresh-btn:hover:not(:disabled) { background: #37474f; }
.refresh-btn:disabled { background: #ccc; cursor: not-allowed; }
