* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f8fafc;
    color: #334155;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
    text-align: center;
}

/* Stats */
.stats {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 10px;
    text-align: center;
    min-width: 160px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.stat-card.total-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-card.amazon-card {
    background: linear-gradient(135deg, #ff9500 0%, #ff7b00 100%);
}

.stat-card.ebay-card {
    background: linear-gradient(135deg, #0064d2 0%, #004ba0 100%);
}

.stat-card.condition-card {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.stat-card.stock-card {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-number {
    display: block;
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 1.1rem;
    opacity: 1;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    color: white;
}

.stat-value {
    display: block;
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 4px;
    font-weight: 500;
}

.stat-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.stat-details .stat-value {
    margin-top: 0;
    text-align: center;
}

.condition-breakdown {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    justify-content: space-around;
    flex-wrap: wrap;
    max-width: 100%;
}

.condition-item {
    text-align: center;
    min-width: 0;
    flex: 1;
    max-width: 25%;
}

.condition-percent {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.condition-name {
    font-size: 0.65rem;
    opacity: 0.9;
    letter-spacing: 0.3px;
    line-height: 1.2;
    word-break: break-word;
    hyphens: auto;
}

/* New conditions styling */
.new-conditions {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
    gap: 10px;
}

.new-condition-item {
    text-align: center;
    flex: 1;
}

.new-condition-percent {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: white;
}

.new-condition-label {
    font-size: 0.8rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
}

/* Controls */
.controls {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.filters, .sort-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.filters label, .sort-controls label {
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.filters select, .sort-controls select {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    min-width: 120px;
    transition: border-color 0.2s;
}

.filters select:focus, .sort-controls select:focus {
    outline: none;
    border-color: #667eea;
}

.sort-btn {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

.sort-btn:hover {
    background: #5a67d8;
}

/* Table */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f8fafc;
}

th {
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

th:hover {
    background: #f1f5f9;
}

th[data-sort]::after {
    content: ' ⇅';
    opacity: 0.5;
    margin-left: 5px;
}

tbody tr {
    transition: background-color 0.2s;
    border-bottom: 1px solid #f1f5f9;
}

tbody tr:hover {
    background: #f8fafc;
}

td {
    padding: 12px;
    vertical-align: top;
}

.platform-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.platform-amazon {
    background: #fef3c7;
    color: #92400e;
}

.platform-ebay {
    background: #dbeafe;
    color: #1e40af;
}

.price {
    font-weight: 600;
    color: #059669;
}

.quantity {
    font-weight: 600;
}

.quantity.low-stock {
    color: #dc2626;
}

.title {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.condition, .status {
    font-size: 13px;
    padding: 2px 8px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #475569;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pagination button {
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #475569;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#page-info {
    font-weight: 600;
    color: #475569;
}

#items-per-page {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: white;
}

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .stats {
        gap: 10px;
    }
    
    .stat-card {
        min-width: 120px;
        padding: 15px 20px;
    }
    
    .filters, .sort-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    table {
        min-width: 800px;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    .controls {
        padding: 15px;
    }
}