/* Shared listing cards (Phase 1 of the listing card rebuild, 21 Nov 2026).
 * Used by shared/glrcf_listing_card.php. Moved here from gtrado/sales.php so every listing page can share one look.
 * Class names are unchanged on purpose (cart engine, wishlist and the shown-price check rely on them). */
/* ===== Sales Container (full width) ===== */
.sales-container {
    max-width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    background: #ffffff !important;
}
.page {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
}

/* ===== Sales Row (Amazon-style: 4 visible columns, horizontal scroll for more) ===== */
.sales-row-wrapper { 
    position: relative; 
    margin-bottom: 20px; 
    overflow: visible; 
    display: flex;
    justify-content: center;
    width: 100%;
}
.sales-row { 
    display: flex !important; /* Flex for horizontal scrolling */
    gap: 20px !important; /* Increased gap for better spacing */
    overflow-x: auto !important; /* Enable horizontal scrolling */
    overflow-y: hidden !important;
    scroll-behavior: smooth !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100%;
    max-width: 1200px; /* Center and constrain width */
    margin: 0 auto; /* Center the row */
    padding: 0 20px; /* Side padding */
    box-sizing: border-box !important;
    flex-wrap: nowrap !important; /* Prevent wrapping - keep horizontal scroll */
}
/* Hide scrollbar completely - only arrows visible for scrolling */
.sales-row::-webkit-scrollbar { 
    height: 0 !important; 
    width: 0 !important; 
    background: transparent !important; 
    display: none !important;
}
.sales-row { 
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE/Edge */
}
.sales-item {
    /* (21 Nov 2026) fit the column: 4 cards visible on desktop (was a fixed 280px, so only 2.5 fitted beside the ad columns) */
    flex: 0 0 calc((100% - 60px) / 4) !important;
    width: calc((100% - 60px) / 4) !important;
    min-width: 170px !important;
    height: auto; /* Auto height for flexible content */
    min-height: 320px; /* Optimized compact height - modern look */
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
    display:flex;
    flex-direction: column;
    background:#ffffff !important;
    border:1px solid #e0e0e0 !important;
    border-radius:10px;
    box-shadow:0 4px 15px rgba(0,0,0,0.1);
    padding:10px;
    text-align:center;
    cursor:pointer;
    transition:transform 0.3s;
    position: relative; /* For absolute positioning of wish button */
}
.sales-item > a img { width:100%; height:140px; object-fit:contain; border-radius:8px; margin-bottom:6px; flex-shrink: 0; opacity: 1 !important; }
.sales-item a { min-width: 0; max-width: 100%; }
.sales-item h3 { font-size:0.88em; color:#004080; margin:0 0 5px; font-weight:600; line-height:1.25; min-width:0; max-width:100%; overflow:hidden; overflow-wrap:anywhere; word-break:break-word; white-space:normal; text-overflow:ellipsis; display:-webkit-box; -webkit-line-clamp:3; line-clamp:3; -webkit-box-orient:vertical; }

/* ===== Badges (Discount, Condition, Shipping) ===== */
.sales-badges { 
    display:flex; 
    flex-wrap:nowrap; /* Force badges to stay on ONE line */
    gap:3px; /* Reduced gap to fit better */
    margin-bottom:6px; 
    justify-content:center;
    overflow:hidden; /* Hide overflow if too long */
}
.sales-badge { 
    font-size:8px; /* Slightly smaller to fit better */
    padding:2px 5px; /* Slightly smaller padding */
    border-radius:3px; 
    font-weight:600; 
    text-transform:uppercase;
    white-space:nowrap; /* Prevent text wrapping */
    flex-shrink:1; /* Allow badges to shrink if needed */
}
.badge-discount { background:#fff3cd; color:#856404; }
.badge-condition { background:#e8f5f5; color:#00695c; }
.badge-shipping { background:#e3f2fd; color:#1565c0; }
.badge-verified { background:#fff3e0; color:#e65100; }
.badge-quantity { background:#f3e5f5; color:#7b1fa2; }

/* ===== Price Display ===== */
.sales-price { margin:5px 0; }
.current-price { font-size:1.2em; font-weight:700; color:#dc3545; margin-bottom:2px; }
.original-price { font-size:0.82em; color:#999; text-decoration:line-through; margin-left:5px; }
.discount-percent { font-size:0.72em; color:#28a745; font-weight:600; }

/* ===== Modern Small Buttons ===== */
.sales-actions { 
    display:flex; 
    gap:4px; 
    margin:6px 0; 
    justify-content:center; 
}
.sales-item .bid-btn, .sales-item .buy-now-btn, .sales-item .add-to-cart-btn { 
    flex:1;
    background:linear-gradient(135deg, #004080, #003366); 
    color:#fff; 
    border:none; 
    border-radius:6px; 
    padding:5px 7px; /* Slightly smaller padding */
    cursor:pointer; 
    font-weight:600; 
    font-size:0.8em; /* Slightly smaller font */
    transition:all 0.2s ease;
    box-shadow:0 2px 4px rgba(0,64,128,0.2);
    display:flex;
    align-items:center;
    justify-content:center;
    gap:3px; /* Slightly smaller gap */
}
.sales-item .bid-btn:hover, .sales-item .add-to-cart-btn:hover { 
    background:linear-gradient(135deg, #003366, #00264d);
    transform:translateY(-1px);
    box-shadow:0 3px 6px rgba(0,64,128,0.3);
}
.sales-item .buy-now-btn {
    background:linear-gradient(135deg, #28a745, #20893a);
    box-shadow:0 2px 4px rgba(40,167,69,0.2);
}
.sales-item .buy-now-btn:hover {
    background:linear-gradient(135deg, #20893a, #1e7e34);
    transform:translateY(-1px);
    box-shadow:0 3px 6px rgba(40,167,69,0.3);
}
.sales-item .bid-btn i, .sales-item .buy-now-btn i, .sales-item .add-to-cart-btn i {
    font-size:0.9em;
}

/* ===== Shipping & Seller Info ===== */
.sales-item .retail, .sales-item .vendor { font-size:0.68em; color:#777; margin-bottom:2px; }
.sales-item .vendor img.flag { width:12px !important; height:9px !important; min-width:12px !important; min-height:9px !important; max-width:12px !important; max-height:9px !important; border-radius:2px; object-fit:cover; margin-left:3px; margin-bottom:0 !important; }
.shipping-info { font-size:0.68em; color:#28a745; margin-bottom:3px; display:flex; align-items:center; justify-content:center; gap:3px; }
.quantity-left { font-size:0.68em; color:#888; margin-bottom:3px; }
/* Wishlist button - same style as auction */
.sales-item .wishlist-btn {
    position: absolute;
    top: 12px; /* Moved from edge (10px + 2px padding) */
    right: 12px; /* Moved from edge (10px + 2px padding) */
    background: transparent; /* No circle background */
    border: none; /* No circle border */
    border-radius: 0; /* No circle */
    width: auto; /* No fixed width */
    height: auto; /* No fixed height */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 10;
    box-shadow: none; /* No shadow */
    font-size: 20px;
    color: #333; /* Default color */
    padding: 6px; /* Increased for better clickable area and spacing */
}
.sales-item .wishlist-btn:hover {
    background: transparent; /* Keep transparent */
    color: #dc3545; /* Heart turns red on hover */
    transform: none; /* No scale */
}
.sales-item .wishlist-btn.in-wishlist {
    background: transparent; /* No circle */
    color: #dc3545; /* Red when in wishlist */
}
.sales-item .wishlist-btn.in-wishlist i {
    animation: heartBeat 0.3s ease;
}
@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* ===== Row Arrows (Capsule Style - Same as Auction/Fundraising/Gallery) ===== */
.row-arrow {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 6px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(240,240,240,0.9)) !important;
    color: #000 !important;
    font-size: 8px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    z-index: 100 !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease, all 0.3s ease !important;
    border: none !important;
    border-radius: 3px !important; /* Capsule style */
    box-shadow: 0 2px 6px rgba(0,0,0,0.25) !important;
    backdrop-filter: blur(10px) !important;
    line-height: 1 !important;
    text-align: center !important;
    padding: 0 !important;
    margin: 0 !important;
}
.sales-row-wrapper:hover .row-arrow {
    opacity: 1 !important;
}
.row-arrow:hover {
    background: linear-gradient(135deg, rgba(0,123,255,0.9), rgba(0,86,179,0.85)) !important;
    color: #fff !important;
    box-shadow: 0 3px 8px rgba(0,123,255,0.4) !important;
}
/* Position arrows at the END of the row on either side (at row edges where cards are) */
/* Match auction page positioning exactly */
.row-arrow.left { 
    left: calc((100% - 1200px) / 2 + 5px) !important; /* 5px from left edge of row (same as auction) */
}
.row-arrow.right { 
    right: calc((100% - 1200px) / 2 + 5px - 18px) !important; /* 5px from right edge of row - 18px to move away from card edge */
}
/* Fallback for smaller screens - position at viewport edges */
@media (max-width: 1200px) {
    .row-arrow.left {
        left: 5px !important; /* Close to left edge of viewport */
    }
    .row-arrow.right {
        right: calc(5px - 18px) !important; /* Close to right edge, moved 18px away from card */
    }
}

/* ===== Pagination ===== */
/* Pagination (Modern Minimal - Google/Amazon Style) */

/* Responsive (Amazon-style: 4→3→2 visible columns, still scrollable) */
@media(max-width:1024px){ 
    .sales-item {
        flex: 0 0 calc((100% - 40px) / 3) !important; /* 3 visible on tablet */
        width: calc((100% - 40px) / 3) !important;
    }
    .sales-item > a img{height:130px;} 
}
@media(max-width:768px){ 
    .sales-item {
        flex: 0 0 calc((100% - 20px) / 2) !important; /* 2 visible on phones */
        width: calc((100% - 20px) / 2) !important;
        min-width: 150px !important;
    }
    .sales-item > a img{height:110px;} 
    .row-arrow {
        width: 6px !important;
        height: 40px !important;
        font-size: 8px !important;
        border-radius: 3px !important;
    }
    .row-arrow.left {
        left: calc(15px + 200px + 5px) !important; /* Adjacent to first card on mobile */
    }
    .row-arrow.right {
        right: calc(15px + 200px + 5px) !important; /* Adjacent to last card on mobile */
    }
}

/* ===== added for the shared card ===== */
.glrcf-card .glrcf-card-link { display:block; width:100%; min-width:0; max-width:100%; text-decoration:none; color:inherit; cursor:pointer; }
.glrcf-card .glrcf-card-media img { width:100%; height:140px; object-fit:contain; border-radius:8px; margin-bottom:6px; display:block; }
.glrcf-card .glrcf-card-was { font-size:0.75em; color:#999; margin-top:2px; }
.glrcf-card .glrcf-card-meta { margin:6px 0; display:flex; align-items:center; justify-content:space-between; gap:6px; min-height:18px; }
.glrcf-card .glrcf-card-spacer { flex:1; min-height:8px; }
.glrcf-card .sales-badges:empty { display:none; }
.glrcf-card .add-to-wishlist:focus-visible, .glrcf-card button:focus-visible, .glrcf-card a:focus-visible { outline:2px solid #2563eb; outline-offset:2px; }
@media(max-width:1024px){ .glrcf-card .glrcf-card-media img{height:130px;} }
@media(max-width:768px){ .glrcf-card .glrcf-card-media img{height:110px;} }

/* ===== auction card (Phase 2, 21 Nov 2026) - these were inline style="" attributes on every card ===== */
.glrcf-auction .glrcf-card-media img { width:100%; height:135px; object-fit:cover; display:block; }
.glrcf-auction .glrcf-buynow { font-size:0.8em; color:#777; margin-bottom:2px; min-height:1.2em; }
.glrcf-auction .auction-price { display:flex; justify-content:center; align-items:baseline; gap:5px; margin-bottom:8px; }
.glrcf-auction .bid-label { font-size:0.9em; color:#333; font-weight:bold; }
.glrcf-auction .current-bid { font-size:1.5em; font-weight:900; color:#dc3545; }
.glrcf-auction .timer { margin-bottom:10px; font-weight:bold; font-size:14px; color:#555; text-align:center; }
.glrcf-auction .timer.auction-timer-ended { margin-bottom:8px; color:#64748b; }
.glrcf-auction .auction-actions { display:flex; gap:5px; margin:0 0 10px; align-items:stretch; width:100%; }
.glrcf-auction .bid-input-container { position:relative; flex:1; min-width:0; }
.glrcf-auction .glrcf-bid-currency { position:absolute; left:8px; top:50%; transform:translateY(-50%); font-weight:bold; color:#666; font-size:0.9em; }
.glrcf-auction .custom-bid-input { width:100%; border:1px solid #cbd5e1; border-radius:4px; padding:6px 6px 6px 20px; font-size:0.9em; font-weight:bold; text-align:left; }
.glrcf-auction .bid-btn { flex:0 0 auto; padding:6px 14px; font-size:0.9em; margin:0; background:linear-gradient(135deg,#dc2626,#b91c1c); color:#fff; border:none; border-radius:8px; font-weight:800; cursor:pointer; }
.glrcf-auction .glrcf-bid-hint { font-size:11px; color:#64748b; margin:-4px 0 8px; }
.glrcf-auction .glrcf-leading { background:linear-gradient(135deg,#f8fafc,#f1f5f9); border:1px solid #e2e8f0; padding:6px 8px; border-radius:6px; display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.glrcf-auction .glrcf-bidder-row { display:flex; align-items:center; gap:6px; }
.glrcf-auction .bidder-status-label { font-weight:800; font-size:11px; color:#0ea5e9; }
.glrcf-auction .glrcf-winner { color:#b45309; }
.glrcf-auction .glrcf-result { color:#64748b; }
.glrcf-auction .card-meta-avatar { width:14px; height:14px; flex:0 0 14px; display:inline-flex; overflow:hidden; border-radius:50%; border:1px solid #cbd5e1; }
.glrcf-auction .card-meta-avatar img { width:14px !important; height:14px !important; border-radius:50%; object-fit:cover; display:block; }
.glrcf-auction .leading-bidder-name { font-size:11px; font-weight:700; color:#334155; display:flex; align-items:center; }
.glrcf-auction .leading-bidder-flag, .glrcf-auction .vendor-country-flag { width:12px !important; height:9px !important; object-fit:cover; border-radius:2px; box-shadow:0 0 1px rgba(0,0,0,.5); margin-left:4px; }
.glrcf-auction .glrcf-trophy { color:#f59e0b; font-size:14px; }
.glrcf-auction .glrcf-seller { font-size:11px; color:#64748b; display:flex; justify-content:center; align-items:center; gap:4px; margin-bottom:8px; }
.glrcf-auction .glrcf-seller a { color:inherit; text-decoration:none; }
.glrcf-auction .glrcf-shop-no { opacity:.7; }
.glrcf-auction .glrcf-shop-no a { text-decoration:underline; }
