/**
 * MTQ Countdown Display Styles
 * Dynamic CSS for countdown show/hide functionality
 */

/* Base countdown styles */
.countdown-section {
    position: relative;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* Title styling */
.countdown-title {
    font-family: 'Playfair Display', serif;
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

/* Location and date styling */
.countdown-location {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    transition: all 0.3s ease;
}

@media (min-width: 1024px) {
    .countdown-location {
        justify-content: flex-start;
    }
}

/* Grid container for countdown numbers */
.countdown-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin: 1.5rem 0;
    width: 100%;
    max-width: 100%;
}

@media (min-width: 640px) {
    .countdown-grid {
        gap: 0.75rem;
    }
}

@media (min-width: 768px) {
    .countdown-grid {
        gap: 1rem;
    }
}

/* Keep single row even on very small screens but adjust padding */
@media (max-width: 320px) {
    .countdown-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.25rem;
        gap: 0.25rem;
    }
}

/* Individual countdown items */
.countdown-item {
    background: rgba(248, 250, 252, 0.8);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(226, 232, 240, 0.6);
    border-radius: 1rem;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.countdown-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -8px rgba(37, 99, 235, 0.3);
    border-color: rgba(37, 99, 235, 0.4);
}

/* Countdown numbers */
.countdown-number {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1e293b;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1;
    margin-bottom: 0.25rem;
    transition: all 0.3s ease;
}

@media (min-width: 768px) {
    .countdown-number {
        font-size: 2.25rem;
    }
}

/* Countdown labels */
.countdown-label {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

@media (min-width: 768px) {
    .countdown-label {
        font-size: 0.875rem;
    }
}

/* Completed state */
.countdown-completed {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid #10b981;
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    animation: completedPulse 3s ease-in-out infinite;
}

.countdown-completed h4 {
    color: #065f46;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.countdown-completed p {
    color: #047857;
    margin-bottom: 1rem;
}

/* Paused state */
.countdown-paused {
    background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
    border: 2px solid #f59e0b;
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    animation: pausedBlink 2s ease-in-out infinite;
}

.countdown-paused h4 {
    color: #92400e;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.countdown-paused p {
    color: #b45309;
}

/* Mobile responsive for completed/paused states */
@media (max-width: 640px) {
    .countdown-completed,
    .countdown-paused {
        padding: 1.5rem 1rem;
        border-radius: 0.75rem;
        margin: 1rem 0;
    }
    
    .countdown-completed h4,
    .countdown-paused h4 {
        font-size: 1.25rem !important;
        margin-bottom: 0.375rem;
    }
    
    .countdown-completed p,
    .countdown-paused p {
        font-size: 0.875rem;
        line-height: 1.5;
        margin-bottom: 0.75rem;
    }
    
    .countdown-completed div:first-child,
    .countdown-paused div:first-child {
        font-size: 2.5rem !important;
        margin-bottom: 0.75rem !important;
    }
}

@media (max-width: 480px) {
    .countdown-completed,
    .countdown-paused {
        padding: 1.25rem 0.75rem;
    }
    
    .countdown-completed h4,
    .countdown-paused h4 {
        font-size: 1.125rem !important;
    }
    
    .countdown-completed p,
    .countdown-paused p {
        font-size: 0.8125rem;
    }
    
    .countdown-completed div:first-child,
    .countdown-paused div:first-child {
        font-size: 2rem !important;
        margin-bottom: 0.5rem !important;
    }
}

/* Progress bar */
.countdown-progress {
    background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%);
    height: 0.5rem;
    border-radius: 9999px;
    transition: width 1s ease;
    position: relative;
    overflow: hidden;
}

.countdown-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: progressShimmer 2s infinite;
}

/* Animations */
@keyframes completedPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
}

@keyframes pausedBlink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

@keyframes progressShimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Dynamic visibility classes - akan diatur oleh PHP */
.hide-countdown-title .countdown-title {
    display: none;
}

.hide-countdown-date .countdown-location .countdown-date,
.hide-countdown-date .countdown-location span[title*="tanggal"] {
    display: none;
}

.hide-countdown-location .countdown-location .countdown-loc,
.hide-countdown-location .countdown-location span[title*="lokasi"] {
    display: none;
}

/* Hide progress bar when setting is disabled */
.hide-countdown-progress .countdown-progress-container {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    /* Countdown section spacing */
    .countdown-section {
        margin-bottom: 1.5rem;
    }
    
    /* Title responsive */
    .countdown-title {
        font-size: 1.25rem !important;
        line-height: 1.4;
        margin-bottom: 0.75rem !important;
    }
    
    /* Location/date info responsive */
    .countdown-location {
        font-size: 0.875rem;
        line-height: 1.5;
        margin-bottom: 1rem !important;
        gap: 0.25rem;
        text-align: center;
    }
    
    /* Grid layout - single row on all screen sizes */
    .countdown-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: 1fr;
        gap: 0.25rem;
        margin: 1rem 0;
    }
    
    /* Countdown items mobile optimization */
    .countdown-item {
        padding: 0.75rem 0.5rem;
        border-radius: 0.75rem;
        min-height: 70px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    /* Numbers size for mobile */
    .countdown-number {
        font-size: 1.25rem !important;
        margin-bottom: 0.125rem;
        font-weight: 800;
    }
    
    /* Labels size for mobile */
    .countdown-label {
        font-size: 0.625rem !important;
        letter-spacing: 0.05em;
        line-height: 1;
    }
    
    /* Social sharing mobile */
    .countdown-section + div {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .countdown-section + div > div {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 480px) {
    .countdown-title {
        font-size: 1.125rem !important;
    }
    
    .countdown-location {
        font-size: 0.8125rem;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .countdown-grid {
        gap: 0.375rem;
        margin: 0.75rem 0;
    }
    
    .countdown-item {
        padding: 0.625rem 0.375rem;
        min-height: 60px;
    }
    
    .countdown-number {
        font-size: 1.125rem !important;
    }
    
    .countdown-label {
        font-size: 0.5625rem !important;
    }
}

/* Landscape mobile phones */
@media (max-width: 768px) and (orientation: landscape) {
    .countdown-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: 1fr;
        gap: 0.5rem;
    }
    
    .countdown-item {
        padding: 0.5rem 0.25rem;
        min-height: 50px;
    }
    
    .countdown-number {
        font-size: 1rem !important;
    }
    
    .countdown-label {
        font-size: 0.5rem !important;
    }
}

/* Dark mode support (jika theme mendukung) */
@media (prefers-color-scheme: dark) {
    .countdown-item {
        background: rgba(15, 23, 42, 0.8);
        border-color: rgba(51, 65, 85, 0.6);
    }
    
    .countdown-number {
        color: #e2e8f0;
    }
    
    .countdown-label {
        color: #94a3b8;
    }
}

/* Override Tailwind classes to ensure our responsive design works */
.countdown-section .countdown-grid {
    display: grid !important;
}

.countdown-section .countdown-item {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
}

.countdown-section .countdown-number {
    display: block !important;
    text-align: center !important;
}

.countdown-section .countdown-label {
    display: block !important;
    text-align: center !important;
}

/* Ensure proper spacing on mobile */
@media (max-width: 640px) {
    .countdown-section .countdown-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.25rem !important;
    }
    
    .countdown-section .countdown-item {
        padding: 0.5rem 0.25rem !important;
        min-height: 60px !important;
    }
    
    .countdown-section .countdown-number {
        font-size: 1.25rem !important;
        line-height: 1.2 !important;
        margin-bottom: 0.25rem !important;
    }
    
    .countdown-section .countdown-label {
        font-size: 0.625rem !important;
        line-height: 1.3 !important;
    }
}

@media (max-width: 480px) {
    .countdown-section .countdown-number {
        font-size: 1.125rem !important;
    }
    
    .countdown-section .countdown-label {
        font-size: 0.5625rem !important;
    }
}

@media (max-width: 320px) {
    .countdown-section .countdown-grid {
        gap: 0.25rem !important;
    }
    
    .countdown-section .countdown-item {
        padding: 0.625rem 0.375rem !important;
        min-height: 60px !important;
    }
}

/* Print styles */
@media print {
    .countdown-section {
        page-break-inside: avoid;
    }
    
    .countdown-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .countdown-item {
        border: 1px solid #ccc;
        box-shadow: none;
    }
}
