/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8fafc;
}

/* Enhanced Product Cards */
.product-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.product-card.out_of_stock {
    opacity: 0.7;
    border: 1px solid #e5e7eb;
}

.card-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stock-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.stock-badge.in-stock {
    background-color: #10b981;
    color: white;
}

.stock-badge.out-of-stock {
    background-color: #ef4444;
    color: white;
}

.deal-badges {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-end;
}

.deal-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    min-width: max-content;
}

.deal-badge.all-time-low {
    background-color: #dc2626;
    color: white;
}

.deal-badge.excellent {
    background-color: #f59e0b;
    color: white;
}

.deal-badge.good {
    background-color: #3b82f6;
    color: white;
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background-color: #f9fafb;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.product-image:hover {
    transform: scale(1.02);
}

.product-content {
    padding: 1rem;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.product-category {
    background-color: #e5e7eb;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
}

.product-manufacturer {
    font-weight: 600;
    color: #374151;
}

.product-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    cursor: pointer;
    color: #111827;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-title:hover {
    color: #2563eb;
}

.product-prices {
    margin-bottom: 1rem;
}

.price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.current-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #059669;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.price-trend {
    font-size: 1rem;
}

.price-details {
    font-size: 0.875rem;
    color: #374151;
    margin-bottom: 0.25rem;
}

.price-stats {
    font-size: 0.75rem;
    color: #6b7280;
}

.deal-score-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.deal-score-bar {
    flex: 1;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 0.75rem;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444 0%, #f59e0b 50%, #10b981 100%);
    transition: width 0.3s ease;
}

.score-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2563eb;
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: #2563eb;
}

/* Main content */
.main {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

/* Footer */
.footer {
    background: #1e293b;
    color: #94a3b8;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 3rem;
}

/* Dashboard specific styles */
.dashboard-header {
    text-align: center;
    margin-bottom: 3rem;
}

.dashboard-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.dashboard-subtitle {
    font-size: 1.1rem;
    color: #64748b;
}

/* Filters */
.filters {
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

.filter-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.filter-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn {
    padding: 0.5rem 1rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #6b7280;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Product grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

/* Product cards */
.product-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.product-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    max-width: 200px;
    max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
    background: #f1f5f9;
    cursor: pointer;
    transition: opacity 0.2s;
}

.product-image:hover {
    opacity: 0.8;
}

.product-content {
    padding: 1.5rem;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    cursor: pointer;
    transition: color 0.2s;
}

.product-title:hover {
    color: #2563eb;
}

.product-category {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 1rem;
}

.product-prices {
    margin-bottom: 1rem;
}

.current-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #059669;
}

.price-comparison {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.lowest-price {
    color: #dc2626;
    font-weight: 600;
}

/* Deal badges */
.deal-badges {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.deal-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.deal-badge.all-time-low {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.deal-badge.near-low {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fed7aa;
}

.deal-badge.good-deal {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

/* Deal score */
.deal-score {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.score-bar {
    flex: 1;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, #dc2626, #f59e0b, #059669);
    transition: width 0.3s;
}

.score-text {
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

/* Loading states */
.loading {
    text-align: center;
    padding: 3rem;
    color: #64748b;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    border-top-color: #2563eb;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #64748b;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: #374151;
}

/* Responsive design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .nav {
        gap: 1rem;
    }

    .dashboard-title {
        font-size: 2rem;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }
}

/* Product detail modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal {
    background: #fff;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    padding: 0.25rem;
}

.modal-close:hover {
    color: #374151;
}

.modal-body {
    padding: 1.5rem;
}

/* External link styling */
.external-link {
    color: #2563eb;
    text-decoration: none;
}

.external-link:hover {
    text-decoration: underline;
}

.pcpartpicker-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f97316;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.pcpartpicker-link:hover {
    background: #ea580c;
    color: white;
    text-decoration: none;
}

/* Pagination Styles */
.pagination-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.page-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    background: white;
    color: #374151;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 2.5rem;
    text-align: center;
}

.page-btn:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.page-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-ellipsis {
    padding: 0.5rem;
    color: #6b7280;
}

.pagination-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: 1rem;
    padding: 0 1rem;
}

.items-per-page {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.items-per-page label {
    font-weight: 500;
}

.items-per-page select {
    padding: 0.25rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background: white;
    font-size: 0.875rem;
    cursor: pointer;
}

.items-per-page select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Product Specifications */
.product-specifications {
    margin: 0.75rem 0;
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    font-size: 0.75rem;
}

.spec-item:not(:last-child) {
    border-bottom: 1px solid #e2e8f0;
}

.spec-label {
    font-weight: 500;
    color: #4b5563;
    flex-shrink: 0;
}

.spec-value {
    font-weight: 600;
    color: #1f2937;
    text-align: right;
    flex-shrink: 1;
    margin-left: 0.5rem;
}

/* Table View Styles */
.products-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.products-table thead {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.products-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

.image-header {
    width: 80px;
}

.product-header {
    width: 40%;
}

.price-header {
    width: 25%;
}

.deal-header {
    width: 20%;
}

.product-row {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s;
}

.product-row:hover {
    background: #f9fafb;
}

.product-row.out_of_stock {
    opacity: 0.7;
}

.product-image-cell {
    padding: 0.75rem;
    text-align: center;
}

.product-image-small {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 6px;
    background: #f3f4f6;
}

.product-info-cell {
    padding: 0.75rem;
}

.product-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.product-meta-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    flex-wrap: wrap;
}

.category-tag {
    background: #dbeafe;
    color: #1e40af;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.manufacturer-tag {
    background: #e5e7eb;
    color: #374151;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.specs-inline {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.price-cell {
    padding: 0.75rem;
    text-align: right;
}

.current-price-large {
    font-size: 1.125rem;
    font-weight: 700;
    color: #059669;
    margin-bottom: 0.25rem;
}

.price-comparison {
    font-size: 0.75rem;
    color: #6b7280;
}

.deal-cell {
    padding: 0.75rem;
    text-align: center;
}

.deal-score-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.score-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: #059669;
}

.score-bar-mini {
    width: 60px;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.score-fill-mini {
    height: 100%;
    background: linear-gradient(90deg, #ef4444 0%, #f59e0b 50%, #10b981 100%);
    transition: width 0.3s ease;
}

.stock-status-mini {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
}

.stock-status-mini.in_stock {
    background: #dcfce7;
    color: #166534;
}

.stock-status-mini.out_of_stock {
    background: #fee2e2;
    color: #dc2626;
}

/* Utility classes */
.text-center {
    text-align: center;
}
