/* Hide popup by default */
.hidden {
    display: none !important;
}

/* Auction Page Title */
.auction-title {
    text-align: center;
    color: #1c7c3a;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 2.2rem;
    font-weight: 700;
}

/* Auction Grid */
.auction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    padding: 40px;
}

/* Auction Card */
.auction-card {
    background: #8fffa8;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    position: relative;
}

.auction-card:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.auction-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
}

.auction-card h3 {
    margin: 8px 0;
    font-size: 1.2rem;
    color: #1c7c3a;
}

.auction-card p {
    margin: 0;
    font-size: 0.95rem;
    color: #333;
}

/* ⭐ Winning Star */
.winning-star {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 22px;
    color: gold;
    text-shadow: 0 0 6px rgba(0,0,0,0.4);
    cursor: default;
    z-index: 5;

    background: #6a0dad;
    padding: 6px 10px;
    border-radius: 8px;
    box-shadow: 0 0 6px rgba(0,0,0,0.4);
}

/* ⭐ Tooltip */
.winning-star:hover::after {
    content: "You Are Winning";
    position: absolute;
    top: -32px;
    left: 0;
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Prevent background scroll */
body.popup-open {
    overflow: hidden;
}

/* Popup overlay */
#itemPopup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* Popup content */
.popup-content {
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    display: flex;
    gap: 20px;
    width: 700px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.popup-left img {
    width: 280px;
    height: 280px;
    object-fit: cover;
    border-radius: 8px;
}

.popup-right {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.popup-right input {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    width: 100%;
}

.popup-right button {
    align-self: flex-start;
}

/* Close button */
.popup-close-btn {
    margin-top: 10px;
    padding: 10px 16px;
    background: #d9534f;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s ease;
}

.popup-close-btn:hover {
    background: #c9302c;
}

/* Mobile Fixes */
@media (max-width: 600px) {
    .auction-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
        padding: 20px;
    }

    .auction-card img {
        height: 150px;
    }

    .winning-star {
        font-size: 18px;
        padding: 4px 8px;
    }
}

@media (max-width: 400px) {
    .auction-grid {
        grid-template-columns: 1fr;
    }

    .auction-card {
        padding: 12px;
    }

    .auction-card img {
        height: 140px;
    }
}

@media (max-width: 768px) {
    .popup-content {
        flex-direction: column;
        align-items: center;
    }

    .popup-left img {
        width: 100%;
        height: auto;
    }
}

.auction-close {
    font-size: 0.9rem;
    color: #555;
    margin-top: 8px;
    line-height: 1.4;
}

/* =========================================
   TABLETS
========================================= */

@media (max-width: 1024px) {

    .auction-grid {
        padding: 20px;
        gap: 18px;
    }

    .auction-title {
        font-size: 1.8rem;
    }

    .popup-content {
        width: 90vw;
    }
}

/* =========================================
   PHONES
========================================= */

@media (max-width: 768px) {

    .auction-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 12px;
    }

    .auction-card {
        padding: 12px;
    }

    .auction-card img {
        height: 140px;
    }

    .auction-card h3 {
        font-size: 1rem;
    }

    .auction-card p {
        font-size: 0.85rem;
    }

    .auction-title {
        font-size: 1.5rem;
        margin-top: 10px;
    }

    .popup-content {
        flex-direction: column;
        width: 95vw;
        max-width: none;
        padding: 18px;
        gap: 16px;
    }

    .popup-left {
        width: 100%;
    }

    .popup-left img {
        width: 100%;
        height: auto;
        max-height: 280px;
    }

    .popup-right {
        width: 100%;
    }

    .popup-right input {
        min-height: 48px;
        box-sizing: border-box;
        font-size: 16px;
    }

    .popup-right button {
        width: 100%;
        min-height: 50px;
        align-self: stretch;
    }

    .popup-close-btn {
        width: 100%;
        min-height: 50px;
    }

    /* Tooltips don't work well on touchscreens */
    .winning-star:hover::after {
        display: none;
    }
}

/* =========================================
   SMALL PHONES
========================================= */

@media (max-width: 480px) {

    .auction-grid {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    .auction-card {
        padding: 10px;
    }

    .auction-card img {
        height: 220px;
    }

    .auction-card h3 {
        font-size: 1.1rem;
    }

    .popup-content {
        width: calc(100vw - 20px);
        padding: 14px;
    }

    .winning-star {
        top: 6px;
        left: 6px;
        font-size: 16px;
        padding: 4px 6px;
    }

    .auction-close {
        font-size: 0.8rem;
    }
}