/* ============================================
   Slip Compare - Excel Comparison Styles
   Visual styling for cell-by-cell spreadsheet comparison
   ============================================ */

/* Excel Comparison Container */
#excelComparisonContainer {
    display: none;
    margin-top: var(--space-lg, 24px);
}

.excel-comparison-wrapper {
    background: white;
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#excelComparisonView {
    display: none;
    margin-top: var(--space-lg, 24px);
}

/* Header with file names */
.excel-comparison-header {
    margin-bottom: var(--space-lg);
}

.excel-file-names {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.excel-file-name {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: white;
    border-radius: var(--radius-md);
    font-weight: 500;
    color: var(--text-primary);
}

.excel-file-name .file-icon {
    font-size: 1.2rem;
}

.excel-file-name.original {
    border-left: 3px solid var(--removed);
}

.excel-file-name.modified {
    border-left: 3px solid var(--added);
}

.excel-vs {
    color: var(--text-muted);
    font-size: 1.5rem;
}

/* Summary Stats */
.excel-summary {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    justify-content: center;
}

.excel-summary-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-md) var(--space-xl);
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    min-width: 100px;
}

.excel-summary-stat .stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}

.excel-summary-stat .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

.excel-summary-stat.total .stat-number {
    color: var(--accent-primary);
}

.excel-summary-stat.modified .stat-number {
    color: #f59e0b;
}

.excel-summary-stat.added .stat-number {
    color: var(--added);
}

.excel-summary-stat.deleted .stat-number {
    color: var(--removed);
}

/* Toolbar with Navigation and Export */
.excel-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xl, 32px);
    margin-bottom: var(--space-lg, 24px);
    padding: var(--space-md, 16px);
    background: var(--bg-secondary, #f9fafb);
    border-radius: var(--radius-md, 8px);
}

.excel-navigation {
    display: flex;
    align-items: center;
    gap: var(--space-md, 16px);
}

.excel-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
    background: white;
    color: var(--text-secondary, #6b7280);
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    transition: all 0.2s ease;
}

.excel-nav-btn:hover {
    border-color: var(--accent-primary, #ea580c);
    color: var(--accent-primary, #ea580c);
    background: rgba(234, 88, 12, 0.05);
}

.excel-nav-display {
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    min-width: 100px;
    text-align: center;
}

/* Export Button */
.excel-export-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #ea580c 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md, 8px);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(234, 88, 12, 0.3);
}

.excel-export-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.4);
}

.excel-export-btn svg {
    width: 18px;
    height: 18px;
}

/* Sheet Tabs */
.excel-sheet-tabs {
    display: flex;
    gap: var(--space-xs, 4px);
    padding: var(--space-sm, 8px);
    background: var(--bg-secondary, #f9fafb);
    border-radius: var(--radius-lg, 12px) var(--radius-lg, 12px) 0 0;
    overflow-x: auto;
}

.excel-tab {
    padding: var(--space-sm) var(--space-lg);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.excel-tab:hover {
    background: rgba(255,255,255,0.5);
    color: var(--text-primary);
}

.excel-tab.active {
    background: white;
    color: var(--accent-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.excel-tab.tab-added {
    border-left: 3px solid var(--added);
}

.excel-tab.tab-deleted {
    border-left: 3px solid var(--removed);
}

.excel-tab.tab-modified {
    border-left: 3px solid #f59e0b;
}

.tab-badge {
    background: var(--accent-primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* Main container with change list and grids */
.excel-sheets-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--space-md);
    background: white;
    border: 1px solid var(--border-subtle);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden;
}

/* Change List Sidebar */
.excel-change-list {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    max-height: 600px;
    overflow-y: auto;
}

.excel-change-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background: white;
    border-bottom: 1px solid var(--border-subtle);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.change-count {
    background: var(--accent-primary);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
}

.excel-change-list-items {
    padding: var(--space-sm);
}

.excel-change-item {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
    background: white;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.excel-change-item:hover {
    border-color: var(--accent-primary);
    transform: translateX(4px);
}

.excel-change-item.active {
    border-color: var(--accent-primary);
    background: var(--accent-glow);
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.15);
}

.excel-change-item .change-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.excel-change-item.added .change-icon {
    background: var(--added-bg);
    color: var(--added);
}

.excel-change-item.deleted .change-icon {
    background: var(--removed-bg);
    color: var(--removed);
}

.excel-change-item.modified .change-icon {
    background: #fef3c7;
    color: #f59e0b;
}

.excel-change-item .change-info {
    flex: 1;
    min-width: 0;
}

.excel-change-item .change-address {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.excel-change-item .change-detail {
    font-size: 0.75rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.excel-change-list-empty {
    padding: var(--space-2xl);
    text-align: center;
    color: var(--text-muted);
}

.excel-change-list-empty .empty-icon {
    font-size: 2rem;
    color: var(--added);
}

/* Grid Wrapper */
.excel-grids-wrapper {
    padding: var(--space-md);
    overflow: hidden;
}

.excel-sheet-content {
    display: block;
}

.excel-sheet-message {
    padding: var(--space-xl);
    text-align: center;
    border-radius: var(--radius-md);
    font-weight: 500;
}

.excel-sheet-message.added {
    background: var(--added-bg);
    color: var(--added);
}

.excel-sheet-message.deleted {
    background: var(--removed-bg);
    color: var(--removed);
}

/* Side-by-side tables */
.excel-side-by-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.excel-table-container {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.excel-table-header {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-subtle);
}

.excel-table-wrapper {
    overflow: auto;
    max-height: 500px;
}

/* Excel Grid Table */
.excel-grid {
    border-collapse: collapse;
    font-size: 0.85rem;
    width: 100%;
}

.excel-grid th,
.excel-grid td {
    border: 1px solid #e2e8f0;
    padding: 6px 10px;
    text-align: left;
    white-space: nowrap;
    min-width: 60px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.excel-corner {
    background: #f1f5f9;
    width: 40px;
    min-width: 40px;
}

.excel-col-header {
    background: #f1f5f9;
    font-weight: 600;
    text-align: center !important;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 2;
}

.excel-row-header {
    background: #f1f5f9;
    font-weight: 600;
    text-align: center !important;
    color: var(--text-secondary);
    width: 40px;
    min-width: 40px;
    position: sticky;
    left: 0;
    z-index: 1;
}

.excel-cell {
    background: white;
    transition: background-color var(--transition-fast);
}

/* Cell highlighting */
.cell-added {
    background-color: var(--added-bg) !important;
    color: var(--added);
    font-weight: 500;
}

.cell-deleted {
    background-color: var(--removed-bg) !important;
    color: var(--removed);
    text-decoration: line-through;
}

.cell-modified-old {
    background-color: #fef3c7 !important;
    color: #92400e;
}

.cell-modified-new {
    background-color: #fef3c7 !important;
    color: #92400e;
    font-weight: 500;
}

.cell-empty-placeholder {
    background-color: #f8fafc !important;
    color: transparent;
}

/* Numeric change indicators */
.numeric-increase {
    position: relative;
}

.numeric-increase::after {
    content: '↑';
    color: var(--added);
    font-size: 0.7rem;
    margin-left: 4px;
}

.numeric-decrease {
    position: relative;
}

.numeric-decrease::after {
    content: '↓';
    color: var(--removed);
    font-size: 0.7rem;
    margin-left: 4px;
}

/* Active highlight animation */
.excel-cell-highlight {
    animation: excelCellPulse 0.5s ease-out;
    box-shadow: inset 0 0 0 2px var(--accent-primary) !important;
}

@keyframes excelCellPulse {
    0% {
        box-shadow: inset 0 0 0 0 rgba(234, 88, 12, 0.8);
    }
    100% {
        box-shadow: inset 0 0 0 2px var(--accent-primary);
    }
}

/* Responsive */
@media (max-width: 1200px) {
    .excel-sheets-container {
        grid-template-columns: 220px 1fr;
    }
}

@media (max-width: 1024px) {
    .excel-sheets-container {
        grid-template-columns: 1fr;
    }
    
    .excel-change-list {
        max-height: 250px;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }
    
    .excel-side-by-side {
        grid-template-columns: 1fr;
    }
    
    .excel-table-wrapper {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .excel-summary {
        padding: var(--space-md);
    }
    
    .excel-summary-stat {
        padding: var(--space-sm) var(--space-md);
        min-width: 70px;
    }
    
    .excel-summary-stat .stat-number {
        font-size: 1.4rem;
    }
    
    .excel-file-names {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .excel-vs {
        transform: rotate(90deg);
    }
}
