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

:root {
    /* Blue Color Scheme - Modern Professional */
    --primary-blue: #0066cc;
    --primary-blue-dark: #0052a3;
    --primary-blue-light: #3385d6;
    --accent-blue: #00a8ff;

    /* Supporting Colors */
    --success: #00ba88;
    --warning: #ffb020;
    --danger: #ff4444;
    --info: #4dabf7;

    /* Neutral Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);

    /* Sizing */
    --header-height: 64px;
    --sidebar-width: 280px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --bg-tertiary: #3d3d3d;
        --text-primary: #ffffff;
        --text-secondary: #d1d5db;
        --text-muted: #9ca3af;
        --border-color: #4b5563;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    min-height: 100vh;
    color: var(--text-primary);
}

/* Header */
.header {
    background: var(--primary-blue);
    color: white;
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.header-logo {
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-nav {
    display: flex;
    gap: 1.5rem;
}

.header-nav a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.header-nav a:hover {
    color: white;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    max-width: 1600px;
    margin: 0 auto;
    min-height: calc(100vh - var(--header-height));
}

/* Sidebar */
.sidebar {
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    overflow-y: auto;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

/* Search */
.search-box {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Filters */
.filter-group {
    margin-bottom: 1.5rem;
}

.filter-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.filter-checkbox {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
}

.filter-checkbox input {
    margin-right: 0.5rem;
}

.filter-checkbox label {
    cursor: pointer;
    color: var(--text-secondary);
}

.filter-range {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.filter-range input {
    width: 4rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
}

.filter-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* Active Filters */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--primary-blue);
    color: white;
    border-radius: 16px;
    font-size: 0.875rem;
}

.filter-pill button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-weight: bold;
}

/* Content Area */
.content-area {
    padding: 1.5rem;
    overflow-y: auto;
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-primary);
}

.stat-change {
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* Controls Bar */
.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.controls-left {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.controls-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-blue-dark);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #cc0000;
}

.btn-icon {
    padding: 0.5rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* View Toggle */
.view-toggle {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 0.25rem;
}

.view-toggle button {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
    color: var(--text-primary);
    font-weight: 500;
}

.view-toggle button.active {
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    color: var(--primary-blue);
}

/* Dark Mode: Enhanced view toggle contrast */
@media (prefers-color-scheme: dark) {
    .view-toggle {
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
    }

    .view-toggle button {
        color: var(--text-secondary);
    }

    .view-toggle button.active {
        background: var(--primary-blue);
        color: white;
    }
}

/* Sort Select */
.sort-select {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9375rem;
    cursor: pointer;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card-item {
    background: var(--bg-primary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.card-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-item.selected {
    outline: 3px solid var(--primary-blue);
}

.card-checkbox {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 10;
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.card-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 200px;
    background: var(--bg-tertiary);
}

.card-image-container {
    position: relative;
    overflow: hidden;
    border-right: 1px solid var(--bg-primary);
}

.card-image-container:last-child {
    border-right: none;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.card-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 3rem;
}

.card-details {
    padding: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.card-pricing {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.price-value {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--success);
}

.price-date {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-left: auto;
}

.price-change {
    font-size: 0.875rem;
}

.price-change.up {
    color: var(--success);
}

.price-change.down {
    color: var(--danger);
}

.card-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.card-badge {
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-primary);
    font-weight: 500;
}

.card-badge.rookie {
    background: rgba(255, 180, 32, 0.15);
    color: var(--warning);
}

.card-badge.auto {
    background: rgba(0, 186, 136, 0.15);
    color: var(--success);
}

.card-badge.value-high {
    background: rgba(0, 186, 136, 0.15);
    color: var(--success);
}

.confidence-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.confidence-high {
    background: rgba(0, 186, 136, 0.15);
    color: var(--success);
}

.confidence-medium {
    background: rgba(255, 180, 32, 0.15);
    color: var(--warning);
}

.confidence-low {
    background: rgba(255, 68, 68, 0.15);
    color: var(--danger);
}

.card-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.card-actions-full {
    grid-column: span 2;
}

.action-btn {
    padding: 0.5rem;
    font-size: 0.875rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.action-btn:hover {
    background: var(--bg-tertiary);
}

.action-btn-primary {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

.action-btn-primary:hover {
    background: var(--primary-blue-dark);
}

.action-btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}

.action-btn-danger:hover {
    background: var(--danger);
    color: white;
}

/* eBay Links Dropdown */
.ebay-dropdown {
    position: relative;
    display: inline-block;
}

.ebay-menu {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 100;
    margin-bottom: 0.25rem;
}

.ebay-menu.show {
    display: block;
}

.ebay-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s;
    font-size: 0.875rem;
}

.ebay-menu a:hover {
    background: var(--bg-secondary);
}

.ebay-menu a:first-child {
    border-radius: 8px 8px 0 0;
}

.ebay-menu a:last-child {
    border-radius: 0 0 8px 8px;
}

/* Loading & Empty States */
.loading-state {
    text-align: center;
    padding: 4rem 2rem;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Bulk Actions Bar */
.bulk-actions-bar {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-blue);
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: none;
    align-items: center;
    gap: 1rem;
    z-index: 1000;
}

.bulk-actions-bar.show {
    display: flex;
}

.bulk-actions-bar .count {
    font-weight: 600;
}

.bulk-actions-bar button {
    padding: 0.5rem 1rem;
    border: 1px solid white;
    background: transparent;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.bulk-actions-bar button:hover {
    background: rgba(255,255,255,0.1);
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .sidebar.mobile-open {
        display: block;
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 999;
        height: calc(100vh - var(--header-height));
    }

    .header-nav {
        display: none;
    }

    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 640px) {
    .controls-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .controls-left,
    .controls-right {
        width: 100%;
        justify-content: space-between;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .bulk-actions-bar {
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        transform: none;
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    animation: fadeIn 0.2s ease-out;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

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

.modal-content {
    background: var(--bg-primary);
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 10;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.modal-image-section {
    background: var(--bg-tertiary);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.modal-image-section h3 {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modal-image-container {
    aspect-ratio: 2.5 / 3.5;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-in;
    overflow: hidden;
}

.modal-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s;
}

.modal-image:hover {
    transform: scale(1.05);
}

.modal-details {
    display: grid;
    gap: 1.5rem;
}

.detail-section {
    background: var(--bg-secondary);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.detail-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.detail-value {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.detail-value.empty {
    color: var(--text-muted);
    font-style: italic;
}

.modal-pricing {
    background: linear-gradient(135deg, rgba(0, 186, 136, 0.1), rgba(0, 168, 255, 0.1));
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--success);
}

.pricing-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--success);
    margin-bottom: 0.5rem;
}

.pricing-source {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.confidence-breakdown {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.confidence-item {
    flex: 1;
    min-width: 120px;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    text-align: center;
}

.confidence-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.confidence-value {
    font-size: 1.5rem;
    font-weight: bold;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    position: sticky;
    bottom: 0;
    background: var(--bg-primary);
}

.modal-footer .btn {
    flex: 1;
    min-width: 150px;
    justify-content: center;
}

/* Mobile Modal Adjustments */
@media (max-width: 768px) {
    .modal-images {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}
