* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e40af 0%, #7c3aed 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
}

h1 {
    color: #1e40af;
    font-size: 2.8em;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #1e40af, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: #6b7280;
    font-size: 1.2em;
    margin-bottom: 20px;
}

.upload-section {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 15px;
}

.file-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-label {
    display: inline-block;
    padding: 15px 30px;
    background: linear-gradient(45deg, #1e40af, #7c3aed);
    color: white;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 16px;
    transition: all 0.3s ease;
}

.file-label:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(30, 64, 175, 0.4);
}

.enrichment-config {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.enrichment-settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.setting-group {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.setting-group h4 {
    color: #1e40af;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 700;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.enrichment-progress {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    display: none;
}

.progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.progress-item {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #10b981, #059669);
    width: 0%;
    transition: width 0.3s ease;
}

.prospect-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #1e40af, #7c3aed);
    color: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(30, 64, 175, 0.3);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1), transparent);
    pointer-events: none;
}

.stat-number {
    font-size: 2.5em;
    font-weight: 800;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 1em;
    opacity: 0.95;
    font-weight: 500;
}

.controls {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.scoring-info {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.scoring-info h3 {
    margin-bottom: 10px;
    font-size: 1.3em;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(45deg, #1e40af, #7c3aed);
    color: white;
}

.btn-success {
    background: linear-gradient(45deg, #10b981, #059669);
    color: white;
}

.btn-warning {
    background: linear-gradient(45deg, #f59e0b, #fbbf24);
    color: white;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.data-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

/* Table enhancements */
.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    background: white;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 12px;
    min-width: 800px; /* Ensure minimum width for proper display */
}

th {
    background: linear-gradient(45deg, #1e40af, #7c3aed);
    color: white;
    padding: 12px 8px;
    text-align: left;
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 11px;
    white-space: nowrap;
}

td {
    padding: 10px 8px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
    font-size: 11px;
}

tr:hover {
    background: #f8fafc;
}

/* Fix for table loading message */
.table-loading {
    text-align: center;
    padding: 40px;
    color: #6b7280;
    font-style: italic;
    font-size: 14px;
}

.lead-score {
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    text-align: center;
    color: white;
    font-size: 12px;
}

.score-hot {
    background: linear-gradient(45deg, #dc2626, #ef4444);
}

.score-warm {
    background: linear-gradient(45deg, #f59e0b, #fbbf24);
}

.score-cold {
    background: linear-gradient(45deg, #6b7280, #9ca3af);
}

.brand-name {
    font-weight: 700;
    color: #1e40af;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.revenue-highlight {
    font-weight: 700;
    color: #059669;
}

.enriched-data {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.enriched-link {
    color: #1e40af;
    text-decoration: none;
    font-weight: 600;
}

.enriched-link:hover {
    text-decoration: underline;
}

.enrichment-status {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.status-enriched {
    background: #d1fae5;
    color: #059669;
}

.status-partial {
    background: #fef3c7;
    color: #f59e0b;
}

.status-pending {
    background: #e5e7eb;
    color: #6b7280;
}

.contact-info {
    font-size: 10px;
    line-height: 1.3;
}

.loading {
    display: none;
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

.spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #1e40af;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination button {
    padding: 10px 15px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.pagination button:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
}

.pagination button.active {
    background: linear-gradient(45deg, #1e40af, #7c3aed);
    color: white;
    border-color: #1e40af;
}

/* New features styling */
.filter-section {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.filter-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-controls select,
.filter-controls input {
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    min-width: 150px;
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
}

.table-info {
    font-weight: 600;
    color: #374151;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

/* Sortable table headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.2s ease;
}

th.sortable:hover {
    background: linear-gradient(45deg, #1e3a8a, #6b21a8);
}

th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 8px;
    opacity: 0.5;
    font-size: 12px;
}

th.sortable.sort-asc::after {
    content: '↑';
    opacity: 1;
    color: #fbbf24;
}

th.sortable.sort-desc::after {
    content: '↓';
    opacity: 1;
    color: #fbbf24;
}

/* Product images */
.product-image {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.product-image:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.product-link {
    color: #1e40af;
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
}

.product-link:hover {
    text-decoration: underline;
    color: #7c3aed;
}

/* Image Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    max-width: 80%;
    max-height: 80%;
    background: white;
    border-radius: 15px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content img {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 10px;
}

.close {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    color: #6b7280;
    z-index: 1001;
}

.close:hover {
    color: #dc2626;
}

#modalCaption {
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    color: #374151;
    font-weight: 600;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Brand grouping styles */
.brand-group {
    border-left: 4px solid #1e40af;
    padding-left: 8px;
    margin: 2px 0;
}

.brand-group.generic {
    border-left-color: #9ca3af;
    opacity: 0.7;
}

.brand-group.hot {
    border-left-color: #dc2626;
}

.brand-group.warm {
    border-left-color: #f59e0b;
}

.brand-group.cold {
    border-left-color: #6b7280;
}

/* Generic brand styling */
.status-generic {
    background: #f3f4f6;
    color: #6b7280;
    font-style: italic;
}

.generic-indicator {
    background: #e5e7eb;
    color: #6b7280;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

/* Phone number styling */
.phone-number {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #059669;
    font-weight: 600;
}

/* Contact info enhanced */
.contact-info {
    font-size: 10px;
    line-height: 1.4;
}

.contact-info .phone {
    color: #059669;
    font-weight: 600;
}

.contact-info .email {
    color: #1e40af;
}

/* Enhanced enrichment status */
.status-skipped {
    background: #fef3c7;
    color: #f59e0b;
}

.status-grouped {
    background: #dbeafe;
    color: #1e40af;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-controls select,
    .filter-controls input {
        min-width: 100%;
        margin-bottom: 10px;
    }
    
    .table-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .product-image {
        width: 30px;
        height: 30px;
    }
    
    .modal-content {
        max-width: 95%;
        max-height: 95%;
        padding: 15px;
    }
}

/* Table enhancements */
.revenue-cell {
    text-align: right;
    font-weight: 700;
}

.bsr-cell {
    text-align: right;
    font-family: 'Courier New', monospace;
    font-size: 11px;
}

.rating-cell {
    text-align: center;
}

.country-flag {
    font-size: 14px;
    margin-right: 4px;
}

/* Enhanced action buttons */
.action-cell {
    white-space: nowrap;
}

.action-cell .btn {
    padding: 4px 8px;
    font-size: 10px;
    margin: 1px;
}

/* Loading improvements */
.table-loading {
    text-align: center;
    padding: 40px;
    color: #6b7280;
    font-style: italic;
}

/* Sort indicators for different data types */
.sort-indicator {
    font-size: 10px;
    opacity: 0.7;
    margin-left: 4px;
}