/**
 * Auction Lots Page Styles
 */

/* Bid Amount Highlight Animation */
@keyframes bidHighlight {
    0% {
        background-color: rgba(255, 255, 0, 0.7);
    }
    100% {
        background-color: transparent;
    }
}

.bid-highlight {
    animation: bidHighlight 1.5s ease-out;
    border-radius: 3px;
    padding: 2px 4px;
    margin: -2px -4px;
}

/* Table Styles */
.lots-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.lots-table th {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 8px;
    text-align: left;
    font-weight: 600;
}

.lots-table td {
    border: 1px solid #dee2e6;
    padding: 8px;
    vertical-align: middle;
}

/* Remove box around description */
.lots-table td .lot-description {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
}

.lots-table tr:hover {
    background-color: #f5f5f5;
}

/* Alternating row colors (zebra striping) */
.lots-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.lots-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

/* Ensure hover effect works over alternating colors */
.lots-table tbody tr:nth-child(even):hover,
.lots-table tbody tr:nth-child(odd):hover {
    background-color: #e9ecef !important;
}

/* Center align the new columns */
.lots-table th:nth-child(5),
.lots-table td:nth-child(5),
.lots-table th:nth-child(6),
.lots-table td:nth-child(6) {
    text-align: center;
}

/* Hover effects for bid count and user max bid */
.bid-count:hover {
    background-color: #e9ecef;
    transform: scale(1.05);
    transition: all 0.2s ease;
}

.user-max-bid:hover {
    background-color: #bbdefb;
    transform: scale(1.02);
    transition: all 0.2s ease;
}

.lot-thumbnail {
    width: 25px;
    height: 25px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 5px;
}

.lot-thumbnail-larger {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.lot-title {
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 0.95rem;
}

.lot-auction-title {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 2px;
}

.lot-description {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    border: none;
    line-height: 1.4;
    max-height: 4.2em; /* 3 lines * 1.4 line-height */
}

/* Description column styling */
.description-column {
    max-width: 300px;
    word-wrap: break-word;
    vertical-align: top;
}

.lot-meta {
    font-size: 0.8rem;
    color: #777;
}

.lot-price {
    font-weight: 600;
    font-size: 0.9rem;
}

.lot-price.winning {
    color: #28a745;
}

.lot-price.outbid {
    color: #dc3545;
}

/* Bid count styling */
.bid-count {
    font-weight: 600;
    color: #6c757d;
    font-size: 0.95rem;
    background-color: #f8f9fa;
    padding: 2px 6px;
    border-radius: 12px;
    min-width: 24px;
    display: inline-block;
}

/* User max bid styling */
.user-max-bid {
    font-weight: 600;
    color: #007bff;
    font-size: 0.9rem;
    background-color: #e3f2fd;
    padding: 2px 6px;
    border-radius: 4px;
}

.no-bid {
    color: #adb5bd;
    font-style: italic;
    font-size: 0.9rem;
}

.quick-bid-btn {
    padding: 4px 8px;
    font-size: 0.8rem;
}

/* Modal Styles */
.bid-modal .modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.bid-modal .modal-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* Countdown Timer Styles */
.mini-countdown {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    display: inline-block;
    width: 100%;
    text-align: center;
}

/* Filter Section */
.filter-section {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

/* Vertical Search Bar */
.vertical-search-bar {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 150px;
    background-color: #000;
    color: white;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 0 8px 8px 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
}

.vertical-search-bar:hover {
    width: 45px;
    background-color: #333;
    box-shadow: 3px 0 15px rgba(0,0,0,0.4);
}

.vertical-search-bar .search-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-weight: bold;
    font-size: 14px;
    letter-spacing: 2px;
    user-select: none;
}

.vertical-search-bar .filter-active-indicator {
    position: absolute;
    top: 10px;
    right: 8px;
    color: white;
    font-size: 12px;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
    animation: iconPulse 2s infinite;
}

@keyframes iconPulse {
    0% {
        transform: scale(1);
        opacity: 1;
        text-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
        text-shadow: 0 0 8px rgba(255, 255, 255, 1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        text-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Filter Sidebar Styles */
.offcanvas {
    width: 350px !important;
    max-width: 90vw;
    border-radius: 0 15px 15px 0;
    box-shadow: 5px 0 20px rgba(0,0,0,0.2);
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

.offcanvas.show {
    transform: translateX(0) !important;
}

.offcanvas.hiding {
    transform: translateX(-100%) !important;
    opacity: 0.8;
}

.offcanvas-header {
    background: linear-gradient(135deg, #000 0%, #333 100%);
    color: white;
    border-bottom: none;
    padding: 1rem 1.5rem;
    border-radius: 0 15px 0 0;
}

.offcanvas-title {
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

.offcanvas-header .btn-close {
    filter: invert(1);
    opacity: 0.8;
}

.offcanvas-header .btn-close:hover {
    opacity: 1;
}

.offcanvas-body {
    padding: 1.5rem;
    background-color: #fafafa;
}

.offcanvas-body .form-label.fw-bold {
    color: #495057;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.offcanvas-body .form-control,
.offcanvas-body .form-select {
    border-radius: 6px;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.offcanvas-body .form-control:focus,
.offcanvas-body .form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Category Tree in Sidebar */
.offcanvas-body .category-tree {
    max-height: 250px;
    overflow-y: auto;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.offcanvas-body .category-item {
    margin-bottom: 0.25rem;
    padding: 0.25rem 0;
}

.offcanvas-body .category-checkbox {
    font-size: 0.9rem;
}

.offcanvas-body .category-toggle {
    color: #6c757d;
    transition: color 0.2s ease;
}

.offcanvas-body .category-toggle:hover {
    color: #495057;
}

/* Action Buttons in Sidebar */
.offcanvas-body .btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.offcanvas-body .btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.offcanvas-body .btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    transform: translateY(-1px);
}

.offcanvas-body .btn-outline-secondary {
    color: #6c757d;
    border-color: #6c757d;
}

.offcanvas-body .btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

/* Badge for active filters */
.badge.bg-danger {
    font-size: 0.7rem;
    padding: 0.2em 0.4em;
}

/* Responsive adjustments for filter sidebar */
@media (max-width: 768px) {
    .vertical-search-bar {
        width: 35px;
        height: 120px;
    }
    
    .vertical-search-bar .search-text {
        font-size: 12px;
        letter-spacing: 1px;
    }
    
    .offcanvas {
        width: 300px !important;
    }
    
    .offcanvas-body {
        padding: 1rem;
    }
    
    .offcanvas-body .category-tree {
        max-height: 200px;
    }
    
    /* Hide description and user max bid columns on mobile to save space */
    .lots-table th:nth-child(3),
    .lots-table td:nth-child(3),
    .lots-table th:nth-child(6),
    .lots-table td:nth-child(6) {
        display: none;
    }
    
    /* Adjust column widths for mobile */
    .lots-table th:nth-child(5),
    .lots-table td:nth-child(5) {
        width: 60px;
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .offcanvas {
        width: 280px !important;
    }
    
    .offcanvas-header {
        padding: 0.75rem 1rem;
    }
    
    .offcanvas-title {
        font-size: 1rem;
    }
    
    .offcanvas-body {
        padding: 0.75rem;
    }
    
    .offcanvas-body .form-label.fw-bold {
        font-size: 0.9rem;
    }
}

/* Animation for vertical search bar */
@keyframes searchBarGlow {
    0% { box-shadow: 2px 0 10px rgba(0,0,0,0.3); }
    50% { box-shadow: 2px 0 20px rgba(0,0,0,0.5), 0 0 10px rgba(255,255,255,0.1); }
    100% { box-shadow: 2px 0 10px rgba(0,0,0,0.3); }
}

.vertical-search-bar.has-active-filters {
    animation: searchBarGlow 3s infinite;
}

.vertical-search-bar.hover-effect {
    transform: translateY(-50%) scale(1.05);
}

/* Smooth transitions for category tree */
.category-children {
    transition: all 0.3s ease;
}

.category-toggle i {
    transition: transform 0.2s ease;
}

/* Loading state for filter form */
.filter-loading {
    opacity: 0.6;
    pointer-events: none;
}

.filter-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Custom backdrop for sidebar */
.offcanvas-backdrop {
    transition: opacity 0.3s ease-in-out;
}

.offcanvas-backdrop.show {
    background-color: rgba(0, 0, 0, 0.3);
}

.offcanvas-backdrop.fade {
    opacity: 0;
}

.offcanvas-backdrop.fade.show {
    opacity: 1;
}

/* Ensure main content shifts slightly when sidebar opens */
body.offcanvas-open {
    margin-left: 0;
}

/* Hide vertical search bar when sidebar is open */
.offcanvas.show ~ .vertical-search-bar {
    opacity: 0.3;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

/* Ensure smooth transition back when sidebar closes */
.vertical-search-bar {
    transition: all 0.3s ease, opacity 0.3s ease-in-out;
}

/* Watchlist Button */
.watchlist-btn {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative !important; /* Override absolute positioning from themes */
    top: auto !important;
    left: auto !important;
    z-index: 1;
}

.watchlist-btn:hover {
    transform: scale(1.2);
}

/* Specific styling for watchlist buttons in the lot table */
.lot-table-watchlist {
    position: static !important;
    display: inline-block !important;
    width: auto !important;
    height: auto !important;
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
}

/* Hide any watchlist buttons that are not in the table */
body > .watchlist-btn,
.container > .watchlist-btn,
.navbar > .watchlist-btn,
.navbar-brand > .watchlist-btn,
.navbar-brand + .watchlist-btn,
.navbar-toggler + .watchlist-btn,
.navbar-collapse > .watchlist-btn,
.navbar-nav > .watchlist-btn,
.breadcrumb > .watchlist-btn,
.breadcrumb-item > .watchlist-btn,
.row > .watchlist-btn,
.col-md-8 > .watchlist-btn,
.col-md-4 > .watchlist-btn,
.filter-section > .watchlist-btn,
.filter-section .row > .watchlist-btn,
.filter-section .col-md-8 > .watchlist-btn,
.filter-section .col-md-4 > .watchlist-btn,
.watchlist-btn:not(.lot-table-watchlist) {
    display: none !important;
}

/* Specifically target the errant heart icon in the top left corner */
button.watchlist-btn[data-lot-id="16"]:not(.lot-table-watchlist) {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .lot-meta-item {
        margin-bottom: 5px;
    }
    
    .lot-row {
        padding: 10px;
    }
    
    .lot-thumbnail-larger {
        width: 40px;
        height: 40px;
    }
}

/* Auction Header */
.auction-header {
    margin-bottom: 30px;
}

.auction-header h1 {
    margin-bottom: 10px;
}

.auction-status {
    display: inline-block;
    margin-right: 10px;
}

/* Category Tree */
.category-tree {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Pagination */
.pagination-container {
    margin-top: 30px;
}