/**
 * Countdown Timer Widget CSS
 * Supports circle, inline, and block styles with full customization
 */

/* Base countdown timer styles */
.countdown-timer-widget {
    position: relative;
    width: 100%;
}

.countdown-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.countdown-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.countdown-number {
    font-weight: bold;
    line-height: 1;
    transition: all 0.3s ease;
}

.countdown-label {
    font-size: 0.8em;
    opacity: 0.8;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Update animation */
.countdown-update {
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

/* Inline Style */
.countdown-style-inline .countdown-timer {
    gap: 15px;
}

.countdown-style-inline .countdown-unit {
    flex-direction: row;
    gap: 5px;
}

.countdown-style-inline .countdown-label {
    margin-top: 0;
    font-size: 0.9em;
}

.countdown-style-inline .countdown-unit:not(:last-child)::after {
    content: ':';
    margin-left: 10px;
    font-weight: bold;
    opacity: 0.6;
}

/* Block Style */
.countdown-style-block .countdown-timer {
    gap: 20px;
}

.countdown-style-block .countdown-unit {
    background: rgba(0, 0, 0, 0.05);
    padding: 20px;
    border-radius: 8px;
    min-width: 80px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.countdown-style-block .countdown-unit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.countdown-style-block .countdown-number {
    font-size: 2em;
    margin-bottom: 5px;
}

/* Circle Style */
.countdown-style-circle .countdown-timer {
    gap: 25px;
}

.countdown-style-circle .countdown-unit {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    justify-content: center;
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.countdown-style-circle .countdown-unit:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.countdown-style-circle .countdown-number {
    color: white;
    font-size: 1.8em;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.countdown-style-circle .countdown-label {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    color: inherit;
    font-size: 0.75em;
    font-weight: 600;
    white-space: nowrap;
    margin-top: 0;
}

/* Expired message styles */
.countdown-expired-message {
    display: none;
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
}

.countdown-fade-in {
    animation: countdownFadeIn 0.5s ease-in-out;
}

@keyframes countdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .countdown-timer {
        gap: 15px;
    }
    
    .countdown-style-block .countdown-unit {
        min-width: 60px;
        padding: 15px;
    }
    
    .countdown-style-block .countdown-number {
        font-size: 1.5em;
    }
    
    .countdown-style-circle .countdown-unit {
        width: 80px;
        height: 80px;
    }
    
    .countdown-style-circle .countdown-number {
        font-size: 1.4em;
    }
    
    .countdown-style-circle .countdown-label {
        bottom: -20px;
        font-size: 0.7em;
    }
}

@media (max-width: 480px) {
    .countdown-timer {
        gap: 10px;
    }
    
    .countdown-style-inline .countdown-timer {
        flex-direction: column;
        gap: 5px;
    }
    
    .countdown-style-inline .countdown-unit:not(:last-child)::after {
        display: none;
    }
    
    .countdown-style-block .countdown-unit {
        min-width: 50px;
        padding: 10px;
    }
    
    .countdown-style-circle .countdown-unit {
        width: 70px;
        height: 70px;
    }
    
    .countdown-style-circle .countdown-number {
        font-size: 1.2em;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .countdown-style-block .countdown-unit {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }
    
    .countdown-expired-message {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .countdown-style-block .countdown-unit {
        border-width: 2px;
        border-color: currentColor;
    }
    
    .countdown-style-circle .countdown-unit {
        border-width: 4px;
        border-color: currentColor;
    }
    
    .countdown-expired-message {
        border-width: 2px;
        border-color: currentColor;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .countdown-unit,
    .countdown-number,
    .countdown-update {
        transition: none;
        animation: none;
        transform: none !important;
    }
    
    .countdown-fade-in {
        animation: none;
    }
}

/* Print styles */
@media print {
    .countdown-timer-widget {
        break-inside: avoid;
    }
    
    .countdown-style-circle .countdown-unit {
        background: none !important;
        border: 2px solid #000 !important;
        box-shadow: none !important;
    }
    
    .countdown-style-circle .countdown-number {
        color: #000 !important;
        text-shadow: none !important;
    }
    
    .countdown-style-block .countdown-unit {
        background: none !important;
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
}

/* Custom color variations */
.countdown-color-primary .countdown-style-circle .countdown-unit {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
}

.countdown-color-secondary .countdown-style-circle .countdown-unit {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
}

.countdown-color-success .countdown-style-circle .countdown-unit {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.countdown-color-danger .countdown-style-circle .countdown-unit {
    background: linear-gradient(135deg, #dc3545 0%, #bd2130 100%);
}

.countdown-color-warning .countdown-style-circle .countdown-unit {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
}

.countdown-color-info .countdown-style-circle .countdown-unit {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

/* Animation variations */
.countdown-animation-pulse .countdown-unit {
    animation: countdownPulse 2s infinite;
}

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

.countdown-animation-glow .countdown-style-circle .countdown-unit {
    animation: countdownGlow 3s ease-in-out infinite alternate;
}

@keyframes countdownGlow {
    from {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }
    to {
        box-shadow: 0 4px 25px rgba(102, 126, 234, 0.4);
    }
}

/* Separator styles for inline layout */
.countdown-style-inline .countdown-separator {
    font-weight: bold;
    opacity: 0.6;
    font-size: 1.2em;
    align-self: center;
}

/* Loading state */
.countdown-loading .countdown-number {
    opacity: 0.5;
    animation: countdownLoading 1.5s ease-in-out infinite;
}

@keyframes countdownLoading {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* Focus styles for accessibility */
.countdown-timer-widget:focus-within {
    outline: 2px solid #007cba;
    outline-offset: 2px;
    border-radius: 4px;
}

/* RTL support */
[dir="rtl"] .countdown-style-inline .countdown-unit:not(:last-child)::after {
    margin-left: 0;
    margin-right: 10px;
}
