/**
 * Auction Overlays CSS
 * 
 * Centralized styles for all auction overlay animations and messages
 * including countdowns, sold banners, custom messages, and timer displays.
 * Features luxury design with gold accents and smooth animations.
 * 
 * @author Budnavet Development Team
 * @version 1.0.0
 */

/* ===========================================
   CSS VARIABLES & ROOT STYLES
   =========================================== */

:root {
    /* Luxury Color Palette */
    --luxury-navy: #1a2332;
    --luxury-navy-dark: #14202c;
    --luxury-gold: #d4af37;
    --luxury-gold-dark: #b8941f;
    --luxury-gold-light: #e6c659;
    --luxury-cream: #f8f6f0;
    --luxury-cream-dark: #e8e4d8;
    
    /* Animation Timing */
    --overlay-transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --luxury-ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --bounce-ease: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ===========================================
   BASE OVERLAY STYLES
   =========================================== */

.final-call-overlay,
.upcoming-lot-overlay,
.message-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: var(--overlay-transition);
    opacity: 0;
    /* Ensure overlays stay within container bounds */
    overflow: hidden;
    max-width: 100%;
    max-height: 100%;
    box-sizing: border-box;
    /* Prevent overlays from affecting parent container size */
    pointer-events: none;
    /* contain: size style layout; */ /* TEMPORARILY DISABLED for debugging */
    /* Additional text overflow prevention */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Debug borders removed - issue resolved */

.final-call-overlay.active,
.upcoming-lot-overlay.active,
.message-overlay.active {
    display: flex !important;
    opacity: 1;
    /* Re-enable pointer events when active for interaction */
    pointer-events: auto;
}

/* ===========================================
   FINAL CALL OVERLAY STYLES
   =========================================== */

.final-call-content {
    text-align: center;
    max-width: min(900px, 95%);
    max-height: 95%;
    padding: 2rem;
    overflow: visible;
    box-sizing: border-box;
    word-wrap: break-word;
    hyphens: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Luxury Final Call Circle Design - Responsive */
.final-call-circle {
    /* Force perfect circle with aspect-ratio - dramatic size for scaling */
    width: min(500px, 50vh, 60vw);
    height: min(500px, 50vh, 60vw);
    aspect-ratio: 1 / 1; /* Ensures perfect circle */
    border: 6px solid var(--luxury-gold);
    border-radius: 50%;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 auto;
    position: relative;
    animation: luxuryCountdownPulse 2s ease-in-out infinite;
    box-shadow: 
        0 0 40px rgba(212, 175, 55, 0.6),
        0 0 80px rgba(212, 175, 55, 0.3),
        inset 0 0 20px rgba(212, 175, 55, 0.2);
    background: radial-gradient(circle, rgba(212, 175, 55, 0.1) 0%, transparent 70%);
    /* Force consistent box-sizing */
    box-sizing: border-box !important;
    /* Prevent any text wrapping or line-height issues */
    line-height: 1;
}

.final-call-circle::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border: 2px solid transparent;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--luxury-gold), transparent, var(--luxury-gold)) border-box;
}

.final-call-number {
    font-family: 'Playfair Display', serif;
    font-size: min(12rem, 24vw, 24vh);
    font-weight: 700;
    color: #f8f6f0;
    text-shadow:
        0 4px 8px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(212, 175, 55, 0.8),
        0 0 80px rgba(212, 175, 55, 0.6);
    z-index: 1;
    position: relative;
    /* Perfect centering */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    text-align: center !important;
    /* Prevent any baseline or vertical-align issues */
    vertical-align: middle;
}

.final-call-text {
    font-family: 'Playfair Display', serif;
    font-size: min(6rem, 14vw, 15vh);
    font-weight: 600;
    color: #f8f6f0;
    text-shadow:
        0 4px 8px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(212, 175, 55, 0.6),
        0 0 60px rgba(212, 175, 55, 0.4);
    margin-top: 1rem;
    line-height: 1.2;
    word-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    overflow-wrap: break-word;
}

.final-call-subtitle {
    display: none;
    letter-spacing: 0.5px;
    word-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    overflow-wrap: break-word;
}

.final-call-bid {
    font-family: 'Playfair Display', serif;
    font-size: min(6rem, 14vw, 15vh);
    font-weight: 700;
    color: #f8f6f0;
    text-shadow:
        0 4px 8px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(212, 175, 55, 0.8),
        0 0 80px rgba(212, 175, 55, 0.6);
    margin-top: 1.5rem;
    padding: 1rem 2rem;
    border: 2px solid var(--luxury-gold);
    border-radius: 0.5rem;
    min-width: 200px;
    max-width: 90%;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    background: rgba(212, 175, 55, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow:
        0 8px 32px rgba(212, 175, 55, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.2);
    box-sizing: border-box;
}

/* ===========================================
   FINAL CALL ANIMATION STATES
   =========================================== */

.final-call-text.going-once {
    animation: finalCallAppear 0.5s ease-out, luxuryTextGlow 2s ease-in-out infinite alternate 0.5s;
}

.final-call-text.going-twice {
    animation: finalCallBounce 0.6s ease-out, luxuryTextGlow 2s ease-in-out infinite alternate 0.6s;
    color: #f8f6f0;
    text-shadow:
        0 4px 8px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(212, 175, 55, 0.6),
        0 0 60px rgba(212, 175, 55, 0.4);
}

.final-call-text.going-three-times {
    animation: finalCallShake 0.7s ease-out, luxuryTextGlow 1.5s ease-in-out infinite alternate 0.7s;
    color: #f8f6f0;
    text-shadow:
        0 4px 8px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(212, 175, 55, 0.6),
        0 0 60px rgba(212, 175, 55, 0.4);
}

.final-call-text.sold {
    animation: finalCallSold 1s ease-out;
    color: #f8f6f0;
    font-size: min(8rem, 18vw, 20vh) !important;
    text-shadow:
        0 4px 8px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(212, 175, 55, 0.8),
        0 0 80px rgba(212, 175, 55, 0.6);
}

.final-call-text.sold.final {
    animation: finalCallSoldFinal 1.5s ease-out, luxuryGoldPulse 2s ease-in-out infinite alternate 1.5s;
    color: #f8f6f0;
    font-size: min(7rem, 16vw, 18vh) !important;
    text-align: center;
    line-height: 1.1;
    font-weight: 700;
    text-shadow:
        0 4px 8px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(212, 175, 55, 0.8),
        0 0 80px rgba(212, 175, 55, 0.6);
}

.final-call-number.sold.final {
    animation: soldCheckmarkPulse 1.5s ease-out, luxuryCheckmarkGlow 3s ease-in-out infinite alternate 1.5s;
    color: #f8f6f0;
    font-size: min(10rem, 22vw, 26vh) !important;
    transform: scale(1.2);
    text-shadow:
        0 4px 8px rgba(0, 0, 0, 0.8),
        0 0 50px rgba(212, 175, 55, 0.8),
        0 0 100px rgba(212, 175, 55, 0.6);
}

.final-call-bid.final-price {
    color: #f8f6f0 !important;
    font-weight: 600;
    text-shadow:
        0 4px 8px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(212, 175, 55, 0.8),
        0 0 80px rgba(212, 175, 55, 0.6);
}

/* ===========================================
   FINAL CALL KEYFRAME ANIMATIONS
   =========================================== */

@keyframes luxuryCountdownPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 
            0 0 40px rgba(212, 175, 55, 0.6),
            0 0 80px rgba(212, 175, 55, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 
            0 0 60px rgba(212, 175, 55, 0.8),
            0 0 120px rgba(212, 175, 55, 0.4);
    }
}

@keyframes finalCallAppear {
    0% { 
        transform: scale(0.8) translateY(20px);
        opacity: 0;
    }
    50% {
        transform: scale(1.05) translateY(-5px);
    }
    100% { 
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes finalCallBounce {
    0% { 
        transform: scale(0.9) rotate(-2deg);
        opacity: 0;
    }
    28vw, 9vh {
        transform: scale(1.1) rotate(1deg);
    }
    50% {
        transform: scale(0.95) rotate(-0.5deg);
    }
    78vw, 9vh {
        transform: scale(1.03) rotate(0.3deg);
    }
    100% { 
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes finalCallShake {
    0% { 
        transform: scale(0.8) translateX(-10px);
        opacity: 0;
    }
    20% {
        transform: scale(1.1) translateX(8px);
    }
    40% {
        transform: scale(0.9) translateX(-6px);
    }
    60% {
        transform: scale(1.05) translateX(4px);
    }
    80% {
        transform: scale(0.95) translateX(-2px);
    }
    100% { 
        transform: scale(1) translateX(0);
        opacity: 1;
    }
}

@keyframes finalCallSold {
    0% { 
        transform: scale(0.5) rotateY(-180deg);
        opacity: 0;
    }
    30% {
        transform: scale(1.3) rotateY(-60deg);
        opacity: 0.7;
    }
    60% {
        transform: scale(0.9) rotateY(20deg);
        opacity: 0.9;
    }
    100% { 
        transform: scale(1) rotateY(0deg);
        opacity: 1;
    }
}

@keyframes finalCallSoldFinal {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes soldCheckmarkPulse {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.4);
        opacity: 0.7;
    }
    100% {
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes luxuryGoldPulse {
    0% {
        text-shadow: 
            0 4px 8px rgba(0, 0, 0, 0.8),
            0 0 20px rgba(212, 175, 55, 0.3);
    }
    100% {
        text-shadow: 
            0 4px 8px rgba(0, 0, 0, 0.8),
            0 0 40px rgba(212, 175, 55, 0.8),
            0 0 60px rgba(212, 175, 55, 0.4);
    }
}

@keyframes luxuryCheckmarkGlow {
    0% {
        text-shadow: 
            0 4px 8px rgba(0, 0, 0, 0.6),
            0 0 30px rgba(212, 175, 55, 0.4);
    }
    100% {
        text-shadow: 
            0 4px 8px rgba(0, 0, 0, 0.6),
            0 0 50px rgba(212, 175, 55, 0.8),
            0 0 80px rgba(212, 175, 55, 0.6);
    }
}

@keyframes finalPriceAppear {
    0% {
        transform: translateY(30px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes luxuryTextGlow {
    0% {
        text-shadow: 
            0 4px 8px rgba(0, 0, 0, 0.8),
            0 0 20px rgba(212, 175, 55, 0.3);
    }
    100% {
        text-shadow: 
            0 4px 8px rgba(0, 0, 0, 0.8),
            0 0 40px rgba(212, 175, 55, 0.6);
    }
}

/* ===========================================
   SOLD OVERLAY STYLES - REMOVED
   Legacy sold overlay styles removed - countdown now ends with enhanced SOLD display
   =========================================== */

/* ===========================================
   MESSAGE OVERLAY STYLES
   =========================================== */

.message-content {
    text-align: center;
    width: 1400px !important; /* Fixed width for overlay wrapper context */
    height: auto !important;
    max-height: 900px; /* 85% of 1080px */
    padding: 3rem;
    overflow: visible; /* Changed from hidden to visible to prevent cropping */
    box-sizing: border-box;
    word-wrap: break-word;
    hyphens: auto;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.message-icon-container {
    width: min(200px, 25vh, 30vw);
    height: min(200px, 25vh, 30vw);
    border: 5px solid var(--luxury-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem auto;
    position: relative;
    animation: luxuryMessagePulse 2s ease-in-out infinite;
    box-shadow: 
        0 0 30px rgba(212, 175, 55, 0.5),
        0 0 60px rgba(212, 175, 55, 0.2),
        inset 0 0 15px rgba(212, 175, 55, 0.1);
}

#message-overlay .message-icon,
#upcoming-lot-overlay .message-icon {
    font-size: 160px !important;
    color: var(--luxury-gold);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* Fallback with higher specificity */
.message-icon-container .ti.message-icon {
    font-size: 160px !important;
}

.message-title {
    font-family: 'Playfair Display', serif;
    font-size: min(10rem, 20vw, 22vh);
    font-weight: 600;
    /* Auto-resize based on content length */
    font-size: clamp(2rem, min(10rem, 20vw, 22vh), 10rem);
    /* Ensure text fits in container */
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    color: white;
    text-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(212, 175, 55, 0.3);
    margin-bottom: 1rem;
    line-height: 1.2;
    word-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    overflow-wrap: break-word;
}

/* Smaller text for long messages */
.message-title.long-text {
    font-size: clamp(2rem, min(7rem, 16vw, 18vh), 7rem) !important;
    line-height: 1.1;
}

.message-title.very-long-text {
    font-size: clamp(1.5rem, min(5rem, 14vw, 16vh), 5rem) !important;
    line-height: 1;
}

.message-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: min(1.2rem, 3vw, 3vh);
    color: rgba(255, 255, 255, 0.8);
    font-weight: 300;
    line-height: 1.5;
    word-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    overflow-wrap: break-word;
}

@keyframes luxuryMessagePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 
            0 0 30px rgba(212, 175, 55, 0.5),
            0 0 60px rgba(212, 175, 55, 0.2);
    }
    50% {
        transform: scale(1.03);
        box-shadow: 
            0 0 40px rgba(212, 175, 55, 0.7),
            0 0 80px rgba(212, 175, 55, 0.3);
    }
}

/* ===========================================
   AUTO-CLERK TIMER DISPLAY
   =========================================== */

.auto-clerk-timer-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: 
        linear-gradient(135deg, var(--luxury-navy) 0%, var(--luxury-navy-dark) 100%),
        linear-gradient(90deg, transparent 30%, rgba(255,255,255,0.4) 50%, transparent 70%);
    background-size: 100% 100%, 200% 100%;
    background-position: 0 0, -200% 0;
    border-radius: 1rem;
    padding: 2rem 4rem;
    animation: timerContainerGlow 4s ease-in-out infinite, timerBackgroundShimmer 10s ease-in-out infinite;
    width: fit-content;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(212, 175, 55, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 101;
    /* Ensure timer stays within container */
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}


.auto-clerk-timer-display::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: calc(1rem + 3px);
    background: linear-gradient(45deg, var(--luxury-gold), var(--luxury-gold));
    z-index: -1;
}


.auto-clerk-timer-display .timer-value {
    font-family: 'Courier New', 'Monaco', monospace;
    font-size: min(16rem, 15vw, 18vh);
    font-weight: 700;
    text-align: center;
    line-height: 1;
    margin: 0;
    min-width: 8ch; /* Minimum width for "00:00" format */
    display: inline-block;
    letter-spacing: 0.1em;
    white-space: nowrap; /* Prevent line breaks */
}

.auto-clerk-timer-display .timer-value.normal {
    color: var(--luxury-gold);
    text-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(212, 175, 55, 0.4);
    animation: timerShineWiggle 3s ease-in-out infinite;
}

.auto-clerk-timer-display .timer-value.warning {
    color: var(--luxury-gold);
    text-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(212, 175, 55, 0.6);
    animation: luxuryTimerPulse 2s infinite, timerShineWiggle 3s ease-in-out infinite;
}

.auto-clerk-timer-display .timer-value.danger {
    color: var(--luxury-gold);
    text-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.8),
        0 0 50px rgba(212, 175, 55, 0.8),
        0 0 80px rgba(212, 175, 55, 0.4);
    animation: luxuryTimerUrgent 1s infinite, timerShineWiggle 2s ease-in-out infinite;
}

@keyframes luxuryTimerPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

@keyframes luxuryTimerUrgent {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
        opacity: 1; 
    }
    28vw, 9vh { 
        transform: scale(1.08) rotate(-1deg); 
        opacity: 0.8; 
    }
    78vw, 9vh { 
        transform: scale(1.08) rotate(1deg); 
        opacity: 0.8; 
    }
}

/* Timer Extension Visual Feedback */
.auto-clerk-timer-display .timer-value.timer-extended {
    animation: timerExtendedPulse 1s ease-out;
}

.auto-clerk-timer-display .timer-value.timer-bounce {
    animation: timerBounce 0.6s ease-out;
}

@keyframes timerExtendedPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 40px rgba(212, 175, 55, 0.8);
        text-shadow: 
            0 4px 8px rgba(0, 0, 0, 0.8),
            0 0 60px rgba(212, 175, 55, 0.9);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
    }
}

@keyframes timerBounce {
    0% {
        transform: scale(1);
    }
    28vw, 9vh {
        transform: scale(1.15) rotate(-2deg);
    }
    50% {
        transform: scale(0.95) rotate(1deg);
    }
    78vw, 9vh {
        transform: scale(1.08) rotate(-0.5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Timer Shine and Wiggle Animation */
@keyframes timerShineWiggle {
    0% { 
        transform: rotate(0deg) scale(1);
        filter: brightness(1) drop-shadow(0 0 10px rgba(212, 175, 55, 0.3));
    }
    20% { 
        transform: rotate(-0.5deg) scale(1.02);
        filter: brightness(1.1) drop-shadow(0 0 15px rgba(212, 175, 55, 0.4));
    }
    40% { 
        transform: rotate(0.5deg) scale(1.01);
        filter: brightness(1.2) drop-shadow(0 0 20px rgba(212, 175, 55, 0.5));
    }
    60% { 
        transform: rotate(-0.3deg) scale(1.02);
        filter: brightness(1.15) drop-shadow(0 0 18px rgba(212, 175, 55, 0.45));
    }
    80% { 
        transform: rotate(0.3deg) scale(1.01);
        filter: brightness(1.05) drop-shadow(0 0 12px rgba(212, 175, 55, 0.35));
    }
    100% { 
        transform: rotate(0deg) scale(1);
        filter: brightness(1) drop-shadow(0 0 10px rgba(212, 175, 55, 0.3));
    }
}

@keyframes timerBackgroundShimmer {
    0% {
        background-position: 0 0, -200% 0;
    }
    10% {
        background-position: 0 0, 200% 0;
    }
    100% {
        background-position: 0 0, -200% 0;
    }
}

/* Timer Container Glow Animation */
@keyframes timerContainerGlow {
    0% { 
        box-shadow: 
            0 10px 40px rgba(0, 0, 0, 0.4),
            0 0 30px rgba(212, 175, 55, 0.3),
            inset 0 2px 0 rgba(255, 255, 255, 0.1);
    }
    50% { 
        box-shadow: 
            0 12px 45px rgba(0, 0, 0, 0.5),
            0 0 50px rgba(212, 175, 55, 0.5),
            0 0 100px rgba(212, 175, 55, 0.2),
            inset 0 2px 0 rgba(255, 255, 255, 0.15);
    }
    100% { 
        box-shadow: 
            0 10px 40px rgba(0, 0, 0, 0.4),
            0 0 30px rgba(212, 175, 55, 0.3),
            inset 0 2px 0 rgba(255, 255, 255, 0.1);
    }
}

/* Timer Extension Indicator Styles */
.timer-extension-indicator {
    position: absolute !important;
    pointer-events: none;
    z-index: 10001;
}

.timer-extension-indicator .extension-content {
    white-space: nowrap;
    text-align: center;
}

/* ===========================================
   LARGE SOLD INDICATOR OVERLAY
   =========================================== */

.sold-indicator-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    transition: var(--overlay-transition);
    opacity: 0;
    /* Ensure sold overlay stays within container bounds */
    overflow: hidden;
    max-width: 100%;
    max-height: 100%;
    box-sizing: border-box;
    /* Prevent overlay from affecting parent container size */
    pointer-events: none;
    contain: size style layout;
    /* Additional text overflow prevention */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.sold-indicator-overlay.active {
    display: flex !important;
    opacity: 1;
    animation: soldOverlayAppear 0.8s ease-out forwards;
    /* Re-enable pointer events when active */
    pointer-events: auto;
}

.sold-overlay-content {
    text-align: center;
    max-width: 90%;
    max-height: 90%;
    padding: 3rem;
    overflow: hidden;
    box-sizing: border-box;
    word-wrap: break-word;
    hyphens: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.sold-text {
    font-family: 'Playfair Display', serif;
    font-size: min(18rem, 30vw, 35vh);
    font-weight: 700;
    color: white;
    text-shadow:
        0 8px 16px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(212, 175, 55, 0.8),
        0 0 80px rgba(212, 175, 55, 0.6),
        0 0 120px rgba(212, 175, 55, 0.4);
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    animation: soldTextPulse 2s ease-in-out infinite;
    margin: 0;
    position: relative;
    word-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    overflow-wrap: break-word;
}

.sold-text::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    border: 3px solid rgba(212, 175, 55, 0.4);
    border-radius: 2rem;
    opacity: 0.6;
    animation: soldBorderPulse 2s ease-in-out infinite;
    box-shadow:
        0 0 30px rgba(212, 175, 55, 0.3),
        inset 0 0 20px rgba(212, 175, 55, 0.1);
}

.sold-price {
    font-family: 'Playfair Display', serif;
    font-size: min(14rem, 28vw, 32vh);
    font-weight: 600;
    color: white;
    text-shadow:
        0 4px 8px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(212, 175, 55, 0.8),
        0 0 60px rgba(212, 175, 55, 0.6),
        0 0 100px rgba(212, 175, 55, 0.4);
    line-height: 1.2;
    margin-top: 1rem;
    opacity: 0;
    animation: soldPriceAppear 0.8s ease-out 0.4s forwards;
    word-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    overflow-wrap: break-word;
}

.sold-price.show {
    display: block !important;
}

@keyframes soldOverlayAppear {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes soldTextPulse {
    0%, 100% {
        transform: scale(1);
        text-shadow:
            0 8px 16px rgba(0, 0, 0, 0.8),
            0 0 40px rgba(212, 175, 55, 0.8),
            0 0 80px rgba(212, 175, 55, 0.6),
            0 0 120px rgba(212, 175, 55, 0.4);
    }
    50% {
        transform: scale(1.02);
        text-shadow:
            0 8px 16px rgba(0, 0, 0, 0.8),
            0 0 60px rgba(212, 175, 55, 1.0),
            0 0 120px rgba(212, 175, 55, 0.8),
            0 0 180px rgba(212, 175, 55, 0.6);
    }
}

@keyframes soldBorderPulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
        box-shadow:
            0 0 30px rgba(212, 175, 55, 0.3),
            inset 0 0 20px rgba(212, 175, 55, 0.1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.02);
        box-shadow:
            0 0 50px rgba(212, 175, 55, 0.6),
            inset 0 0 30px rgba(212, 175, 55, 0.2);
    }
}

@keyframes soldPriceAppear {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}



/* ===========================================
   TEXT OVERFLOW PREVENTION FOR ALL OVERLAYS
   =========================================== */

/* Ensure video container has proper containment for all child elements */
#video-container,
.video-container,
.video-placeholder {
    overflow: hidden;
    contain: layout style;
    position: relative;
}

/* Ensure all text elements within overlays respect container bounds */
.final-call-overlay *,
.message-overlay *,
.sold-indicator-overlay *,
.upcoming-lot-overlay * {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    box-sizing: border-box;
}

/* Prevent any element from exceeding overlay dimensions */
.final-call-overlay,
.message-overlay,
.sold-indicator-overlay,
.upcoming-lot-overlay {
    /* Allow glow effects to extend beyond bounds */
    contain: style layout;
}

/* ===========================================
   UPCOMING LOT OVERLAY STYLES
   =========================================== */

/* Existing upcoming-lot-overlay background style already defined above */
.upcoming-lot-overlay {
    background: linear-gradient(135deg,
        rgba(26, 35, 50, 0.95) 0%,
        rgba(52, 73, 94, 0.95) 50%,
        rgba(26, 35, 50, 0.95) 100%);
    backdrop-filter: blur(8px);
}

/* Old upcoming lot styles removed - now using message overlay pattern */

/* Dynamic font sizing for upcoming lot horse name to always fit on one line */
#upcoming-lot-overlay #upcoming-lot-name {
    /* Dynamic viewport-based font sizing that adapts to content */
    font-size: clamp(
        1.5rem,                    /* minimum readable size */
        min(8vw, 12vh, 6rem),     /* responsive size based on viewport */
        8rem                       /* maximum size */
    ) !important;

    /* Ensure single line display */
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;

    /* Use available width efficiently */
    width: 100% !important;
    max-width: 85vw !important; /* Leave some margin */

    /* Text scaling for very long names */
    display: inline-block !important;
    transform-origin: center !important;

    /* Additional responsive adjustments */
    line-height: 1.1 !important;
    letter-spacing: -0.02em !important; /* Tighter spacing for long text */
}

/* Container query approach for better responsiveness */
.message-content {
    container-type: inline-size;
}

/* Scale down font for very long horse names using container queries */
@container (max-width: 600px) {
    #upcoming-lot-overlay #upcoming-lot-name {
        font-size: clamp(1.2rem, 6vw, 4rem) !important;
    }
}

@container (max-width: 400px) {
    #upcoming-lot-overlay #upcoming-lot-name {
        font-size: clamp(1rem, 5vw, 3rem) !important;
    }
}


/* Specific styling for upcoming lot overlay elements now handled by standard message overlay classes */

/* Animations for upcoming lot overlay */
@keyframes pulseIcon {
    0%, 100% {
        transform: scale(1);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

/* ===========================================
   RESPONSIVE DESIGN
   =========================================== */

@media (max-width: 768px) {
    .final-call-content,
    .message-content {
        padding: 1rem;
    }
    
    .sold-overlay-content {
        padding: 2rem;
    }
    
    .sold-text {
        font-size: min(6rem, 13vw, 3vh);
    }
    
    .sold-price {
        font-size: min(2.5rem, 6.5vw, 8vh);
    }
    
    .final-call-circle {
        width: min(100px, 18vw, 9vh);
        height: min(100px, 18vw, 9vh);
        aspect-ratio: 1 / 1 !important; /* Ensure perfect circle on small screens */
    }
    
    .message-title {
        font-size: 2.2rem;
    }
    
    .auto-clerk-timer-display {
        top: 20px;
        padding: 1rem 2.5rem;
    }
    
    .auto-clerk-timer-display .timer-value {
        font-size: 3.5rem;
        min-width: 6ch; /* Minimum width for medium screens */
    }
    
    .final-call-bid {
        font-size: min(2rem, 6.5vw, 8vh);
        padding: 0.8rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .message-title {
        font-size: 1.8rem;
    }
    
    .sold-text {
        font-size: min(4rem, 18vw, 9vh);
    }
    
    .sold-price {
        font-size: min(2rem, 6.5vw, 8vh);
    }
    
    .sold-overlay-content {
        padding: 1rem;
    }
    
    .auto-clerk-timer-display .timer-value {
        font-size: 2.5rem;
        min-width: 5ch; /* Minimum width for small screens */
    }
    
    .final-call-text {
        font-size: min(1.8rem, 3%);
    }
}

/* ===========================================
   ACCESSIBILITY & PRINT
   =========================================== */

@media (prefers-reduced-motion: reduce) {
    .final-call-circle,
    .message-icon-container,
    .sold-indicator-overlay,
    .sold-text,
    .sold-text::before {
        animation: none;
    }
    
    .final-call-text.going-once,
    .final-call-text.going-twice,
    .final-call-text.going-three-times,
    .final-call-text.sold {
        animation: none;
    }
}

@media print {
    .final-call-overlay,
    .message-overlay,
    .sold-indicator-overlay,
    .auto-clerk-timer-display {
        display: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .final-call-circle,
    .message-icon-container {
        border-width: 3px;
        box-shadow: none;
    }
    
    .final-call-text,
    .message-title {
        text-shadow: none;
        font-weight: 900;
    }
}