:root {
    --ebay-bg: #0a0e17;
    --ebay-surface: #111827;
    --ebay-surface-hover: #1a2332;
    --ebay-blue: #3665f3;
    --ebay-red: #e53238;
    --ebay-yellow: #f5af02;
    --ebay-green: #86b817;
    --ebay-text: #e8eaed;
    --ebay-text-muted: #8b95a5;
    --ebay-border: rgba(255, 255, 255, 0.08);
    --ebay-card-bg: rgba(17, 24, 39, 0.85);
    --ebay-accent: #3665f3;
    --ebay-glow: rgba(54, 101, 243, 0.15);
}

html:has(body.ebay-sniper) {
    background: var(--ebay-bg);
}

body.ebay-sniper {
    background: var(--ebay-bg) !important;
    color: var(--ebay-text);
    font-family: 'Market Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.ebay-sniper .driver-page {
    background: var(--ebay-bg) !important;
    color: var(--ebay-text) !important;
    text-align: left !important;
    flex: 1;
}

body.ebay-sniper .driver-page.driver-page--bot > section:not(.driver-home-hero):not(.hero-section):not(.dt-hero) {
    background: transparent !important;
    color: var(--ebay-text) !important;
}

body.ebay-sniper .driver-shell-footer {
    background: var(--ebay-surface);
}

/* Navbar */
.ebay-nav {
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--ebay-border);
    padding: 0.5rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.ebay-nav .brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--ebay-text);
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
}

.ebay-nav .brand-colors span {
    font-weight: 800;
}
.ebay-nav .brand-colors .c-e { color: var(--ebay-red); }
.ebay-nav .brand-colors .c-b { color: var(--ebay-blue); }
.ebay-nav .brand-colors .c-a { color: var(--ebay-yellow); }
.ebay-nav .brand-colors .c-y { color: var(--ebay-green); }

.ebay-search-wrap {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    max-width: 600px;
}

.ebay-search-wrap input {
    background: var(--ebay-surface);
    border: 1px solid var(--ebay-border);
    color: var(--ebay-text);
    border-radius: 24px;
    padding: 0.4rem 1rem;
    flex: 1;
    min-width: 0;
}
.ebay-search-wrap input:focus {
    border-color: var(--ebay-blue);
    box-shadow: 0 0 0 2px var(--ebay-glow);
    outline: none;
}

.ebay-search-wrap .btn-search {
    background: var(--ebay-blue);
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 0.4rem 1rem;
    white-space: nowrap;
}

.ebay-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.ebay-controls select {
    background: var(--ebay-surface);
    border: 1px solid var(--ebay-border);
    color: var(--ebay-text);
    border-radius: 8px;
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
}

.ebay-controls .btn-auth {
    background: transparent;
    border: 1px solid var(--ebay-border);
    color: var(--ebay-text-muted);
    border-radius: 8px;
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}
.ebay-controls .btn-auth:hover {
    border-color: var(--ebay-blue);
    color: var(--ebay-text);
}
.ebay-controls .btn-auth.connected {
    border-color: var(--ebay-green);
    color: var(--ebay-green);
}

/* Snipes Panel */
.ebay-snipes-panel {
    background: var(--ebay-surface) !important;
    border: 1px solid var(--ebay-border);
    border-radius: 12px;
    margin: 1rem;
    overflow: hidden;
    transition: max-height 0.3s;
}

.ebay-snipes-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--ebay-text);
    font-weight: 600;
    font-size: 0.95rem;
    width: 100%;
    cursor: pointer;
    text-align: left;
}
.ebay-snipes-toggle .count {
    background: var(--ebay-blue);
    color: #fff;
    border-radius: 10px;
    padding: 0 0.5rem;
    font-size: 0.8rem;
    min-width: 1.5rem;
    text-align: center;
}
.ebay-snipes-toggle .arrow {
    margin-left: auto;
    transition: transform 0.2s;
}
.ebay-snipes-panel.open .ebay-snipes-toggle .arrow {
    transform: rotate(180deg);
}

.ebay-snipes-body {
    display: none;
    padding: 0 1rem 1rem;
}
.ebay-snipes-panel.open .ebay-snipes-body {
    display: block;
}

.ebay-snipes-scroll {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    scroll-snap-type: x mandatory;
}
.ebay-snipes-scroll::-webkit-scrollbar {
    height: 4px;
}
.ebay-snipes-scroll::-webkit-scrollbar-thumb {
    background: var(--ebay-border);
    border-radius: 2px;
}

.ebay-snipe-card {
    flex: 0 0 170px;
    scroll-snap-align: start;
    background: var(--ebay-card-bg);
    border: 1px solid var(--ebay-border);
    border-radius: 10px;
    padding: 0.5rem;
    position: relative;
}
.ebay-snipe-card img {
    width: 100%;
    height: 90px;
    object-fit: contain;
    border-radius: 6px;
    background: #1a1f2e;
}
.ebay-snipe-card .title {
    font-size: 0.75rem;
    color: var(--ebay-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 0.25rem;
}
.ebay-snipe-card .bid-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}
.ebay-snipe-card .your-bid {
    color: var(--ebay-green);
    font-weight: 600;
}
.ebay-snipe-card .countdown {
    font-size: 0.7rem;
    color: var(--ebay-yellow);
    text-align: center;
    margin-top: 0.25rem;
}
.ebay-snipe-card .countdown.urgent {
    color: var(--ebay-red);
    animation: snipePulse 1s ease-in-out infinite;
}
.ebay-snipe-card .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.6);
    border: none;
    color: var(--ebay-text-muted);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.65rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.ebay-snipe-card .remove-btn:hover {
    color: var(--ebay-red);
}

.ebay-snipes-empty {
    text-align: center;
    color: var(--ebay-text-muted);
    padding: 1rem;
    font-size: 0.9rem;
}

@keyframes snipePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Auction Grid */
.ebay-grid {
    padding: 0 1rem 2rem;
}

.ebay-item-card {
    background: var(--ebay-card-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--ebay-border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.ebay-item-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border-color: rgba(54, 101, 243, 0.3);
}

.ebay-item-card .card-img-wrap {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: #1a1f2e;
}
.ebay-item-card .card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.ebay-item-card .bid-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.75);
    color: var(--ebay-text);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.ebay-item-card .card-body {
    padding: 0.5rem 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.ebay-item-card .card-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ebay-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.ebay-item-card .price-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: auto;
}
.ebay-item-card .price {
    color: var(--ebay-green);
    font-weight: 700;
    font-size: 0.95rem;
}
.ebay-item-card .bids {
    color: var(--ebay-text-muted);
    font-size: 0.75rem;
}
.ebay-item-card .time-left {
    font-size: 0.75rem;
    color: var(--ebay-yellow);
    margin-top: 0.25rem;
}
.ebay-item-card .time-left.ending-soon {
    color: var(--ebay-red);
    font-weight: 600;
}

.ebay-item-card .snipe-btn {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.3rem;
    background: var(--ebay-blue);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.ebay-item-card .snipe-btn:hover {
    background: #2850d8;
}

/* Pagination */
.ebay-pagination {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    padding: 1rem;
}
.ebay-pagination .page-btn {
    background: var(--ebay-surface);
    border: 1px solid var(--ebay-border);
    color: var(--ebay-text);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
}
.ebay-pagination .page-btn.active {
    background: var(--ebay-blue);
    border-color: var(--ebay-blue);
}

/* Loading / empty states */
.ebay-loading, .ebay-empty {
    text-align: center;
    color: var(--ebay-text-muted);
    padding: 3rem 1rem;
}
.ebay-loading .spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--ebay-border);
    border-top-color: var(--ebay-blue);
    border-radius: 50%;
    animation: ebSpin 0.8s linear infinite;
    margin: 0 auto 1rem;
}
@keyframes ebSpin { to { transform: rotate(360deg); } }

/* Modals */
.ebay-modal .modal-content {
    background: var(--ebay-surface);
    border: 1px solid var(--ebay-border);
    color: var(--ebay-text);
}
.ebay-modal .modal-header {
    border-bottom-color: var(--ebay-border);
}
.ebay-modal .modal-footer {
    border-top-color: var(--ebay-border);
}
.ebay-modal .btn-close {
    filter: invert(1);
}
.ebay-modal .form-control {
    background: var(--ebay-bg);
    border-color: var(--ebay-border);
    color: var(--ebay-text);
}
.ebay-modal .form-control:focus {
    border-color: var(--ebay-blue);
    box-shadow: 0 0 0 2px var(--ebay-glow);
}
.ebay-modal .btn-primary {
    background: var(--ebay-blue);
    border-color: var(--ebay-blue);
}
.ebay-modal .form-label {
    font-size: 0.85rem;
    color: var(--ebay-text-muted);
}
.ebay-modal .alert {
    font-size: 0.85rem;
}

/* Item Detail Modal */
#ebayItemModal .item-gallery img {
    max-height: 300px;
    object-fit: contain;
    width: 100%;
    border-radius: 8px;
    background: #1a1f2e;
}
#ebayItemModal .item-info {
    font-size: 0.9rem;
}
#ebayItemModal .item-price-big {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ebay-green);
}
#ebayItemModal .item-bids {
    color: var(--ebay-text-muted);
    font-size: 0.85rem;
}
#ebayItemModal .item-countdown {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ebay-yellow);
}
#ebayItemModal .snipe-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 1rem;
}
#ebayItemModal .snipe-input-row input {
    max-width: 120px;
}

/* Status badge */
.ebay-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.ebay-status.pending { background: rgba(245, 175, 2, 0.15); color: var(--ebay-yellow); }
.ebay-status.won { background: rgba(134, 184, 23, 0.15); color: var(--ebay-green); }
.ebay-status.lost { background: rgba(229, 50, 56, 0.15); color: var(--ebay-red); }
.ebay-status.failed { background: rgba(229, 50, 56, 0.15); color: var(--ebay-red); }
.ebay-status.firing { background: rgba(54, 101, 243, 0.15); color: var(--ebay-blue); }

/* Responsive */
@media (max-width: 767px) {
    .ebay-nav {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .ebay-search-wrap {
        order: 3;
        max-width: 100%;
        width: 100%;
    }
    .ebay-controls {
        order: 2;
    }
    .ebay-snipes-panel {
        margin: 0.5rem;
    }
    .ebay-grid {
        padding: 0 0.5rem 1rem;
    }
    .ebay-snipe-card {
        flex: 0 0 150px;
    }
}

@media (max-width: 575px) {
    .ebay-controls select {
        font-size: 0.8rem;
        padding: 0.25rem 0.4rem;
    }
    .ebay-controls .btn-auth {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
}

