﻿/* DateTime Helper Styles */

.utc-date {
    display: inline;
    transition: color 0.3s ease;
}

.utc-date.loading {
    color: #6c757d;
    opacity: 0.7;
}

/* ===== COUNTDOWN TIMER STYLES ===== */

.countdown-timer {
    font-family: 'Courier New', Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-weight: bold;
    letter-spacing: 1px;
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    background-color: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.95em;
    min-width: 4rem;
    text-align: center;
}

/* حالت عادی - سبز */
.countdown-timer:not(.warning):not(.danger):not(.expired) {
    color: #198754;
    border-color: rgba(25, 135, 84, 0.2);
    background-color: rgba(25, 135, 84, 0.05);
}

/* حالت هشدار - نارنجی */
.countdown-timer.warning {
    color: #fd7e14 !important;
    border-color: rgba(253, 126, 20, 0.3);
    background-color: rgba(253, 126, 20, 0.1);
    animation: pulse-warning 1.5s ease-in-out infinite;
    font-weight: 700;
}

/* حالت خطر - قرمز */
.countdown-timer.danger {
    color: #dc3545 !important;
    border-color: rgba(220, 53, 69, 0.4);
    background-color: rgba(220, 53, 69, 0.1);
    animation: pulse-danger 0.8s ease-in-out infinite;
    font-weight: 900;
    text-shadow: 0 0 3px rgba(220, 53, 69, 0.5);
}

/* حالت منقضی شده - خاکستری */
.countdown-timer.expired {
    color: #6c757d !important;
    border-color: rgba(108, 117, 125, 0.3);
    background-color: rgba(108, 117, 125, 0.1);
    animation: none;
    font-style: italic;
    opacity: 0.8;
}

/* انیمیشن‌ها */
@keyframes pulse-warning {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.8; 
        transform: scale(1.02);
    }
}

@keyframes pulse-danger {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4);
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.05);
        box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
    }
}

/* انیمیشن ظاهر شدن */
.countdown-timer {
    animation: fadeInScale 0.3s ease-out;
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* تاریخ‌های قدیمی */
.utc-date.old-date {
    color: #6c757d;
    font-style: italic;
}

/* تاریخ‌های آینده */
.utc-date.future-date {
    color: #28a745;
}

/* تاریخ امروز */
.utc-date.today {
    color: #007bff;
    font-weight: 600;
}

/* انیمیشن لود شدن */
.utc-date.loading::after {
    content: '...';
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0%, 33% { content: '.'; }
    34%, 66% { content: '..'; }
    67%, 100% { content: '...'; }
}

/* ===== RTL SUPPORT ===== */
[dir="rtl"] .countdown-timer {
    direction: ltr;
    display: inline-block;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 576px) {
    .countdown-timer {
        font-size: 0.85em;
        padding: 0.2rem 0.4rem;
        min-width: 3.5rem;
        letter-spacing: 0.5px;
    }
    
    .utc-date {
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .countdown-timer {
        font-size: 0.8em;
        padding: 0.15rem 0.3rem;
        min-width: 3rem;
        letter-spacing: 0.3px;
    }
}

/* ===== DARK THEME SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    .utc-date {
        color: #e9ecef;
    }
    
    .utc-date.old-date {
        color: #adb5bd;
    }
    
    .countdown-timer {
        border-color: rgba(255, 255, 255, 0.1);
        background-color: rgba(255, 255, 255, 0.02);
    }
    
    .countdown-timer:not(.warning):not(.danger):not(.expired) {
        color: #20c997;
        border-color: rgba(32, 201, 151, 0.2);
        background-color: rgba(32, 201, 151, 0.05);
    }
    
    .countdown-timer.warning {
        border-color: rgba(253, 126, 20, 0.4);
        background-color: rgba(253, 126, 20, 0.15);
    }
    
    .countdown-timer.danger {
        border-color: rgba(220, 53, 69, 0.5);
        background-color: rgba(220, 53, 69, 0.15);
    }
    
    .countdown-timer.expired {
        color: #adb5bd !important;
        border-color: rgba(173, 181, 189, 0.3);
        background-color: rgba(173, 181, 189, 0.1);
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .countdown-timer {
        border-width: 2px;
        font-weight: 900;
    }
    
    .countdown-timer.warning {
        border-color: #fd7e14;
        color: #fd7e14 !important;
        background-color: rgba(253, 126, 20, 0.2);
    }
    
    .countdown-timer.danger {
        border-color: #dc3545;
        color: #dc3545 !important;
        background-color: rgba(220, 53, 69, 0.2);
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .countdown-timer {
        animation: none !important;
        color: #000 !important;
        background: none !important;
        border: 1px solid #000 !important;
        font-weight: bold;
    }
    
    .countdown-timer::after {
        content: " (در زمان چاپ)";
        font-size: 0.8em;
        color: #6c757d;
        font-weight: normal;
    }
    
    .countdown-timer.expired::after {
        content: " (منقضی شده)";
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    .countdown-timer,
    .countdown-timer.warning,
    .countdown-timer.danger {
        animation: none !important;
        transition: none !important;
    }
    
    .countdown-timer.warning {
        border-left: 4px solid #fd7e14;
    }
    
    .countdown-timer.danger {
        border-left: 4px solid #dc3545;
    }
}

/* ===== FOCUS AND ACCESSIBILITY ===== */
.countdown-timer:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* برای screen readers */
.countdown-timer[aria-live="polite"] {
    position: relative;
}

.countdown-timer::before {
    content: attr(aria-label);
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ===== CUSTOM VARIANTS ===== */

/* Large countdown */
.countdown-timer.countdown-lg {
    font-size: 1.25em;
    padding: 0.5rem 1rem;
    min-width: 6rem;
    letter-spacing: 2px;
}

/* Small countdown */
.countdown-timer.countdown-sm {
    font-size: 0.8em;
    padding: 0.15rem 0.3rem;
    min-width: 3rem;
    letter-spacing: 0.5px;
}

/* Minimal countdown */
.countdown-timer.countdown-minimal {
    border: none;
    background: none;
    padding: 0;
    font-weight: 600;
}

/* Bordered countdown */
.countdown-timer.countdown-bordered {
    border-width: 2px;
    border-style: solid;
}

/* Pill countdown */
.countdown-timer.countdown-pill {
    border-radius: 50rem;
    padding: 0.375rem 0.75rem;
}

/* Badge style countdown */
.countdown-timer.countdown-badge {
    font-size: 0.75em;
    padding: 0.25em 0.6em;
    border-radius: 0.375rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}