/**
 * Countdown Timer Widget CSS - Production Ready
 * 
 * @package RelayoutDesigns
 * @version 1.0.0
 * @author Relayout Designs
 * 
 * Features:
 * - 8 Awesome Styles: Modern Block, Circle, Flip Card, Neon Glow, Progress Ring, Glass Morphism, Minimal Line, Inline
 * - Animation Effects: Pulse, Bounce, Glow, Shake with performance optimization
 * - Color Schemes: 8 beautiful variations with proper contrast ratios
 * - Responsive Design: Mobile-first approach with proper breakpoints
 * - Accessibility: High contrast mode, reduced motion support, focus states
 * - Performance: Hardware acceleration, efficient animations, minimal reflows
 * - Browser Support: Modern browsers with graceful fallbacks
 * - Elementor Compatible: No hardcoded inline styles, fully customizable
 * 
 * Structure:
 * 1. Base Styles & Utilities
 * 2. Timer Styles (8 variations)
 * 3. Animation Effects
 * 4. Color Schemes
 * 5. Responsive Design
 * 6. Accessibility Features
 * 7. Print Styles
 */

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

/* PRO Badge Styling (replaces hardcoded inline styles) */
.relayout-pro-badge {
    color: #ff6b35;
    font-weight: bold;
    font-size: 10px;
    background: #fff3f0;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 5px;
    display: inline-block;
    vertical-align: middle;
}

/* Error message styling */
.countdown-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

/* Hidden elements (replaces display: none inline styles) */
.countdown-hidden {
    display: none !important;
}

/* Progress bar styling (replaces hardcoded width) */
.countdown-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    margin-bottom: 20px;
    overflow: hidden;
}

.countdown-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%; /* Default, updated via JS */
}

/* Progress bar data attribute styles */
.countdown-progress-fill[data-progress="0"] { width: 0% !important; }
.countdown-progress-fill[data-progress="10"] { width: 10% !important; }
.countdown-progress-fill[data-progress="20"] { width: 20% !important; }
.countdown-progress-fill[data-progress="30"] { width: 30% !important; }
.countdown-progress-fill[data-progress="40"] { width: 40% !important; }
.countdown-progress-fill[data-progress="50"] { width: 50% !important; }
.countdown-progress-fill[data-progress="60"] { width: 60% !important; }
.countdown-progress-fill[data-progress="70"] { width: 70% !important; }
.countdown-progress-fill[data-progress="80"] { width: 80% !important; }
.countdown-progress-fill[data-progress="90"] { width: 90% !important; }
.countdown-progress-fill[data-progress="100"] { width: 100% !important; }

/* Percentage display */
.countdown-percentage {
    text-align: center;
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 18px;
    color: #667eea;
}

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

.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    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-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.countdown-number {
    font-weight: bold;
    line-height: 1;
    transition: all 0.3s ease;
    font-size: 2em;
    margin-bottom: 5px;
}

.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;
}

/* Legacy block style for backward compatibility */
.countdown-timer.style-block {
    gap: 20px;
}

.countdown-timer.style-block .countdown-item {
    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-timer.style-block .countdown-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

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

.countdown-timer.style-circle .countdown-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    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-timer.style-circle .countdown-item:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.countdown-timer.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-timer.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;
}

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

.countdown-timer.style-modern-block .countdown-item {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%) !important;
    padding: 25px 20px !important;
    border-radius: 16px !important;
    min-width: 90px !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    overflow: hidden;
}

.countdown-timer.style-modern-block .countdown-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.countdown-timer.style-modern-block .countdown-item:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12) !important;
}

.countdown-timer.style-modern-block .countdown-number {
    font-size: 2.2em !important;
    font-weight: 700 !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px !important;
}

/* Flip Card Style */
.countdown-timer.style-flip-card {
    gap: 15px;
}

.countdown-timer.style-flip-card .countdown-item {
    perspective: 1000px;
    width: 80px;
    height: 100px;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.flip-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.flip-card {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.flip-front, .flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background: linear-gradient(145deg, #2c3e50 0%, #34495e 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.8em;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.flip-back {
    transform: rotateY(180deg);
    background: linear-gradient(145deg, #667eea 0%, #764ba2 100%);
}

.flip-card.flipping {
    transform: rotateY(180deg);
}

/* Neon Glow Style */
.countdown-timer.style-neon-glow {
    gap: 30px;
    background: #0a0a0a;
    padding: 30px;
    border-radius: 20px;
}

.countdown-timer.style-neon-glow .countdown-item {
    background: transparent;
    border: 2px solid #00ffff;
    border-radius: 12px;
    padding: 20px;
    min-width: 80px;
    box-shadow: 
        0 0 20px #00ffff,
        inset 0 0 20px rgba(0, 255, 255, 0.1);
    animation: neonPulse 2s ease-in-out infinite alternate;
}

.countdown-timer.style-neon-glow .countdown-number {
    color: #00ffff;
    font-size: 2em;
    font-weight: 700;
    text-shadow: 0 0 10px #00ffff;
}

.countdown-timer.style-neon-glow .countdown-label {
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.7em;
}

@keyframes neonPulse {
    from {
        box-shadow: 
            0 0 20px #00ffff,
            inset 0 0 20px rgba(0, 255, 255, 0.1);
    }
    to {
        box-shadow: 
            0 0 30px #00ffff,
            0 0 40px #00ffff,
            inset 0 0 30px rgba(0, 255, 255, 0.2);
    }
}

/* Progress Ring Style */
.countdown-timer.style-progress-ring {
    gap: 25px;
}

.countdown-timer.style-progress-ring .countdown-item {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.progress-ring-container {
    position: relative;
    width: 120px;
    height: 120px;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: rgba(0, 0, 0, 0.1);
    stroke-width: 8;
}

.progress-ring-fill {
    fill: none;
    stroke: url(#progressGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 339.292;
    transition: stroke-dashoffset 0.3s ease;
}

.progress-ring-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-ring-content .countdown-number {
    font-size: 1.8em;
    font-weight: 700;
    color: #667eea;
}

/* Glass Morphism Style */
.countdown-timer.style-glass-morphism {
    gap: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 30px;
}

.countdown-timer.style-glass-morphism .countdown-item {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 20px;
    min-width: 80px;
    transition: all 0.3s ease;
}

.countdown-timer.style-glass-morphism .countdown-item:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-3px);
}

.countdown-timer.style-glass-morphism .countdown-number {
    font-size: 2em;
    font-weight: 700;
    color: #333;
}

/* Minimal Line Style */
.countdown-timer.style-minimal-line {
    gap: 40px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 20px;
}

.countdown-timer.style-minimal-line .countdown-item {
    text-align: center;
    position: relative;
}

.countdown-timer.style-minimal-line .countdown-number {
    font-size: 3em;
    font-weight: 300;
    color: #333;
    line-height: 1;
}

.countdown-timer.style-minimal-line .countdown-label {
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #666;
    margin-top: 10px;
}

.countdown-timer.style-minimal-line .countdown-item::after {
    content: '';
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background: #667eea;
    transition: width 0.3s ease;
}

.countdown-timer.style-minimal-line .countdown-item:hover::after {
    width: 50px;
}

/* Animation Classes */
.countdown-fade-in {
    animation: countdownFadeIn 0.5s ease-in-out;
}

.countdown-fade-out {
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

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

.animation-bounce .countdown-item {
    animation: countdownBounce 1s infinite;
}

.animation-glow .countdown-item {
    animation: countdownGlow 2s ease-in-out infinite alternate;
}

.animation-shake .countdown-item {
    animation: countdownShake 0.5s ease-in-out infinite;
}

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

@keyframes countdownBounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@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); }
}

@keyframes countdownShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* Color Schemes */
.color-gradient-blue .countdown-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.color-gradient-purple .countdown-item {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.color-gradient-orange .countdown-item {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
}

.color-neon-cyan .countdown-item {
    background: #000;
    border: 2px solid #00ffff;
    box-shadow: 0 0 20px #00ffff;
    color: #00ffff;
}

.color-neon-pink .countdown-item {
    background: #000;
    border: 2px solid #ff00ff;
    box-shadow: 0 0 20px #ff00ff;
    color: #ff00ff;
}

.color-dark-mode .countdown-timer-widget {
    background: #1a1a1a;
    color: #ffffff;
}

.color-dark-mode .countdown-item {
    background: #2d2d2d;
    border: 1px solid #404040;
    color: #ffffff;
}

.color-minimal-mono .countdown-item {
    background: transparent;
    border: 1px solid #ccc;
    color: #333;
}

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

/* Duplicate removed - already defined above */

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

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

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .countdown-timer.style-modern-block .countdown-item {
        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-timer.style-modern-block .countdown-item {
        border-width: 2px;
        border-color: currentColor;
    }
    
    .countdown-timer.style-circle .countdown-item {
        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-timer.style-circle .countdown-item {
        background: none !important;
        border: 2px solid #000 !important;
        box-shadow: none !important;
    }
    
    .countdown-timer.style-circle .countdown-number {
        color: #000 !important;
        text-shadow: none !important;
    }
    
    .countdown-timer.style-modern-block .countdown-item {
        background: none !important;
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
}

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

.countdown-timer.style-inline .countdown-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 5px !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.countdown-timer.style-inline .countdown-number {
    font-size: 1.5em !important;
    margin-bottom: 0 !important;
}

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

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

/* 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;
    }
}

/* ========================================
   6. ACCESSIBILITY FEATURES
   ======================================== */

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

.countdown-item:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Reduced motion support for accessibility */
@media (prefers-reduced-motion: reduce) {
    .countdown-timer-widget *,
    .countdown-timer-widget *::before,
    .countdown-timer-widget *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   7. PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* Hardware acceleration for animations */
.countdown-item,
.flip-card,
.progress-ring-fill {
    will-change: transform;
    transform: translateZ(0);
}

/* Optimize repaints */
.countdown-number {
    contain: layout style paint;
}

/* ========================================
   8. BROWSER COMPATIBILITY
   ======================================== */

/* Fallbacks for older browsers */
.countdown-timer.style-glass-morphism .countdown-item {
    background: rgba(255, 255, 255, 0.15);
    /* Fallback for browsers without backdrop-filter */
}

@supports (backdrop-filter: blur(10px)) {
    .countdown-timer.style-glass-morphism .countdown-item {
        backdrop-filter: blur(10px);
    }
}

/* Fallback for CSS Grid */
@supports not (display: grid) {
    .countdown-timer {
        display: flex;
        flex-wrap: wrap;
    }
}

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