/*
 * Modern Theme
 * Card grid layout, serif fonts, refined colors.
 * Loaded conditionally via theme_loader.php when Site Theme = 'modern'.
 */

:root {
    --accent: #1a5276;
    --accent-light: #2980b9;
    --gold: #d4a843;
    --gold-dark: #b8922e;
    --text: #2c3e50;
    --text-muted: #7f8c8d;
    --border: #e0e0e0;
    --hover-bg: #f8f9fa;
    --danger: #c0392b;
    --success: #27ae60;
}

/* ── Base ── */
* { box-sizing: border-box; }
body {
    font-family: 'Georgia', 'Times New Roman', serif !important;
    color: var(--text);
}
header, .content, .carousel-box, .tag-section, footer {
    box-sizing: border-box;
}

/* ── Search bar ── */
.search-bar form {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    gap: 0;
}
.search-bar input[type="text"] {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid var(--border);
    border-right: none;
    border-radius: 6px 0 0 6px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.search-bar input[type="text"]:focus {
    border-color: var(--accent-light);
}
.search-bar button {
    padding: 12px 24px;
    background: var(--accent);
    color: #fff;
    border: 2px solid var(--accent);
    border-radius: 0 6px 6px 0;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}
.search-bar button:hover {
    background: var(--accent-light);
    border-color: var(--accent-light);
}

/* ── Announcements ── */
.announcement-banner {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark)) !important;
    color: #fff !important;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ── Countdown ── */
.countdown {
    font-family: 'Courier New', monospace !important;
    color: var(--gold) !important;
    letter-spacing: 2px;
}

/* Modern lot detail: wrap the countdown + end-time in a prominent card so it
   stops blending into the page background. The card uses the same accent
   gradient as .modern-auction-header so the two read as a matched family.
   `.countdown-block` is rendered only by view_auction.php; legacy themes
   never see it because no other CSS targets the class. */
.modern-lot-detail .countdown-block {
    display: block;
    max-width: 480px;
    margin: 28px auto;
    padding: 22px 32px 18px;
    background: linear-gradient(135deg, var(--accent), #1a3c5e);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(15, 38, 64, 0.25);
    text-align: center;
    color: #fff;
    position: relative;
}
.modern-lot-detail .countdown-block::before {
    content: 'TIME REMAINING';
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 4px;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 10px;
}
.modern-lot-detail .countdown-block .countdown {
    font-size: 2.1em;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--gold) !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    margin: 0;
}
.modern-lot-detail .countdown-block .countdown-end-time {
    margin: 10px 0 0;
    font-size: 0.78em;
    color: rgba(255, 255, 255, 0.78);
    font-family: 'Inter', system-ui, sans-serif;
    letter-spacing: 0.3px;
}
/* When the listing is in its final stretch, swap to an urgent red gradient.
   `.countdown.is-ending` is added by the JS countdown tick below a threshold
   (handled in view_auction.php). Wrapping the whole block via :has() so the
   outer card flips too — Safari 15.4+, Chrome 105+, Firefox 121+. */
.modern-lot-detail .countdown-block:has(.countdown.is-ending) {
    background: linear-gradient(135deg, #b3261e, #6e1311);
    box-shadow: 0 10px 30px rgba(127, 18, 12, 0.35);
    animation: aas-countdown-pulse 1.6s ease-in-out infinite;
}
.modern-lot-detail .countdown-block:has(.countdown.is-ending) .countdown {
    color: #ffeb3b !important;
}
@keyframes aas-countdown-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.015); }
}
@media (max-width: 600px) {
    .modern-lot-detail .countdown-block { padding: 18px 18px 14px; }
    .modern-lot-detail .countdown-block .countdown { font-size: 1.5em; letter-spacing: 2px; }
}

/* ── Auction header banner ── */
.modern-auction-header {
    width: 80%;
    margin: 0 auto 20px;
    padding: 30px;
    background: linear-gradient(135deg, var(--accent), #1a3c5e);
    border-radius: 10px;
    color: #fff;
    text-align: center;
}
.modern-auction-header h2 {
    font-size: 1.8em;
    margin: 0 0 5px;
    font-weight: 400;
    font-style: italic;
}
.modern-auction-header h3 {
    font-size: 0.95em;
    margin: 0 0 15px;
    font-weight: 400;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.modern-auction-header .countdown {
    font-size: 2.2em;
    margin: 15px 0 8px;
}
.modern-auction-header .end-time {
    font-size: 0.85em;
    opacity: 0.7;
}

/* ── Filter bar ── */
.filter-bar {
    width: 80%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.filter-bar .lot-count {
    font-size: 14px;
    color: var(--text-muted);
}
.filter-bar select {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    cursor: pointer;
}

/* ── Card grid ── */
.lot-grid {
    width: 80%;
    margin: 0 auto 25px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}
.lot-card {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: left;
    text-decoration: none;
    color: inherit;
    /* Flex column so the .card-body can grow and pin its footer to the
       bottom — keeps the price/bid row aligned across the grid row no
       matter how long each card's title runs. */
    display: flex;
    flex-direction: column;
    height: 100%;
}
.lot-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.lot-card .card-img {
    width: 100%;
    height: 220px;
    object-fit: contain;
    display: block;
    background: #f5f5f5;
    padding: 10px;
}
.lot-card .card-body {
    padding: 16px;
    /* Grow to fill the card and become a flex column so .card-footer can
       use margin-top:auto to pin itself to the bottom. */
    flex: 1;
    display: flex;
    flex-direction: column;
}
.lot-card .card-lot-num {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.lot-card .card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.3;
    color: var(--text);
}
.lot-card .card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Push to the bottom of the flex-column .card-body so price/bids align
       across cards in the same grid row, even when titles wrap differently. */
    margin-top: auto;
    padding-top: 10px;
}
.lot-card .card-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}
.lot-card .card-bids {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--hover-bg);
    padding: 4px 10px;
    border-radius: 12px;
}
.lot-card .card-estimate {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Trending ── */
.trending-section {
    width: 80%;
    margin: 0 auto 20px;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.trending-section h2 {
    font-size: 1.1em;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin: 0 0 15px;
    font-weight: 600;
}
.trending-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 5px;
}
.trending-item { flex: 0 0 auto; width: 130px; }
.trending-item img {
    width: 100%;
    height: 130px;
    object-fit: contain;
    background: #f5f5f5;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s;
    padding: 5px;
}
.trending-item img:hover { transform: scale(1.05); }

/* ── Preview banner ── */
.preview-banner {
    display: block;
    width: 80%;
    margin: 0 auto 20px;
    padding: 18px 25px;
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.5px;
    transition: opacity 0.2s;
    text-align: center;
}
.preview-banner:hover { opacity: 0.9; }
.preview-banner span {
    font-weight: 400;
    opacity: 0.85;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: block;
    margin-bottom: 4px;
}

/* ── Tags ── */
.modern-tag-section {
    width: 80%;
    margin: 0 auto 25px;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    text-align: center;
}
.modern-tag-section h2 {
    font-size: 1.1em;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin: 0 0 15px;
    font-weight: 600;
}
.tag {
    background: var(--accent) !important;
    font-size: 14px;
    transition: background 0.2s;
}
.tag:hover {
    background: var(--accent-light) !important;
}

/* ── Empty states ── */
.empty-state {
    width: 80%;
    margin: 0 auto 25px;
    padding: 60px 30px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    color: var(--text-muted);
    text-align: center;
}
.empty-state p { font-size: 16px; margin: 0; }

/* ── View page (lot detail) ── */
.modern-lot-detail h2 {
    font-weight: 400;
    font-size: 1.6em;
}
.modern-lot-detail .price-tag {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--accent);
    margin: 10px 0;
}
.modern-lot-detail .sold-tag {
    font-size: 1.2em;
    color: var(--danger);
    font-weight: bold;
    margin-top: 20px;
}
.modern-lot-detail .detail-grid {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 15px 0;
}
.modern-lot-detail .detail-chip {
    padding: 8px 18px;
    background: var(--hover-bg);
    border-radius: 20px;
    font-size: 14px;
    color: var(--text);
}
.modern-lot-detail .detail-chip strong {
    color: var(--accent);
}
.modern-lot-detail .btn-buy {
    display: inline-block;
    margin: 20px 0;
    padding: 14px 35px;
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    font-family: inherit;
    font-weight: bold;
    transition: background 0.2s;
}
.modern-lot-detail .btn-buy:hover { background: #219a52; }
.modern-lot-detail .btn-bid {
    display: inline-block;
    padding: 12px 30px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-family: inherit;
    transition: background 0.2s;
}
.modern-lot-detail .btn-bid:hover { background: var(--accent-light); }
.modern-lot-detail .bid-input {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    width: 150px;
    margin-right: 8px;
    transition: border-color 0.2s;
}
.modern-lot-detail .bid-input:focus { border-color: var(--accent-light); }

.share-buttons a {
    border-radius: 6px !important;
}

/* ── Info page ── */
.modern-info .info-section {
    text-align: left;
}
.modern-info .info-section h2 {
    border-bottom-color: var(--accent) !important;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .modern-auction-header, .filter-bar, .lot-grid,
    .trending-section, .modern-tag-section, .empty-state,
    .preview-banner {
        width: 95% !important;
    }
    .lot-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
    .lot-card .card-img { height: 160px; }
    .modern-auction-header .countdown { font-size: 1.5em; }
    .modern-auction-header h2 { font-size: 1.3em; }
    .search-bar form { max-width: 100%; }
}
