/**
 * Frattis Live Polling Styles
 */

/* Refresh Countdown Display */
.live-refresh-countdown {
    display: inline-block;
    min-width: 20px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: #666;
}

.live-refresh-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #888;
    padding: 4px 8px;
    background: #f5f5f5;
    border-radius: 4px;
}

.live-refresh-wrapper .live-refresh-label {
    color: #999;
}

/* Update Animation */
.live-updated {
    animation: liveUpdateFlash 0.5s ease;
}

@keyframes liveUpdateFlash {
    0% {
        background-color: rgba(100, 126, 110, 0.3);
    }
    100% {
        background-color: transparent;
    }
}

/* Price highlight on update */
.live-current-price-value.live-updated {
    color: #647e6e;
}

/* Bid count highlight */
.live-bid-count-value.live-updated,
.live-bidders-count-value.live-updated {
    color: #ab836a;
}

/* Auction ended state */
.live-auction-item.auction-ended {
    opacity: 0.7;
}

.live-auction-item.auction-ended .live-current-price-value {
    color: #999;
}

/* Compact countdown for grids */
.live-countdown-compact {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    z-index: 10;
}

/* Single page countdown display */
.single-auction-refresh {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #888;
}

.single-auction-refresh .live-refresh-countdown {
    background: #647e6e;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 24px;
}

/* Pulse animation for low countdown */
.live-refresh-countdown.countdown-low {
    animation: countdownPulse 1s infinite;
}

@keyframes countdownPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Loading state */
.live-auction-item.live-loading {
    position: relative;
}

.live-auction-item.live-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

/* Frattis Live Countdown Shortcode */
.frattis-countdown {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
}

.frattis-countdown .countdown-part {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
}

.frattis-countdown .countdown-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    min-width: 1.5em;
    text-align: right;
}

.frattis-countdown .countdown-label {
    font-size: 0.85em;
    color: inherit;
    opacity: 0.8;
}

.frattis-countdown.frattis-countdown-expired {
    color: #999;
    font-style: italic;
}

/* Countdown update flash */
.frattis-countdown.live-updated {
    animation: countdownExtendedFlash 0.8s ease;
}

@keyframes countdownExtendedFlash {
    0% {
        background-color: rgba(100, 126, 110, 0.4);
        transform: scale(1.02);
    }
    100% {
        background-color: transparent;
        transform: scale(1);
    }
}

/* Extension count */
.live-extension-count-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.live-extension-count-value.live-updated {
    color: #ab836a;
}

/* Shimmer loading state — hides stale cached values while fetching fresh data */
.live-current-price-value,
.live-bid-count-value,
.live-bidders-count-value,
.live-minimum-bid-value,
.live-extension-count-value {
    color: transparent !important;
    background: linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.10) 50%, rgba(0,0,0,0.06) 75%);
    background-size: 200% 100%;
    animation: frattisShimmer 1.5s ease-in-out infinite;
    border-radius: 3px;
    transition: color 0.3s ease;
}

/* Overlay shimmer for bid status — covers stale backgrounds/icons/text */
html .live-bid-status {
    position: relative;
    overflow: hidden;
    opacity: 1 !important;
}

html .live-bid-status::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #eee 25%, #e0e0e0 50%, #eee 75%);
    background-size: 200% 100%;
    animation: frattisShimmer 1.5s ease-in-out infinite;
    border-radius: 12px;
    z-index: 1;
}

/* Overlay shimmer for quick bid buttons container */
html .frattis-quick-bids-buttons {
    position: relative;
    overflow: hidden;
}

html .frattis-quick-bids-buttons::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #eee 25%, #e0e0e0 50%, #eee 75%);
    background-size: 200% 100%;
    animation: frattisShimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
    z-index: 1;
}

.frattis-quick-bid-btn {
    opacity: 0;
    transition: opacity 0.3s ease;
}

@keyframes frattisShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

body.frattis-live-ready .live-current-price-value,
body.frattis-live-ready .live-bid-count-value,
body.frattis-live-ready .live-bidders-count-value,
body.frattis-live-ready .live-minimum-bid-value,
body.frattis-live-ready .live-extension-count-value {
    color: inherit !important;
    background: none;
    animation: none;
}

body.frattis-live-ready .live-bid-status::after,
body.frattis-live-ready .frattis-quick-bids-buttons::after {
    content: none;
}

body.frattis-live-ready .frattis-quick-bid-btn {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .live-refresh-wrapper {
        font-size: 11px;
        padding: 3px 6px;
    }

    .live-countdown-compact {
        font-size: 10px;
    }

    .frattis-countdown {
        font-size: 0.9em;
    }

    .frattis-countdown .countdown-label {
        font-size: 0.8em;
    }
}
