/* Blog Pagination Styling - Professional & Responsive Design */

/* Main pagination wrapper */
.tp-pagination-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 40px 0;
    padding: 20px 0;
}

/* Pagination list container */
.tp-pagination-wrap ul {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

/* Individual pagination items */
.tp-pagination-wrap li {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Base styles for pagination links and buttons */
.tp-pagination-wrap a,
.tp-pagination-wrap button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 8px 12px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background-color: #ffffff;
    color: #374151;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* Hover effects for pagination links */
.tp-pagination-wrap a:hover,
.tp-pagination-wrap button:hover:not(:disabled) {
    background-color: #f8fafc;
    border-color: #3b82f6;
    color: #3b82f6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

/* Active page styling */
.tp-pagination-wrap .active,
.tp-pagination-wrap button.active {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-color: #3b82f6;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.tp-pagination-wrap .active:hover,
.tp-pagination-wrap button.active:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-1px);
}

/* Previous and Next button styling */
.tp-pagination-wrap .prev-page,
.tp-pagination-wrap .next-page {
    min-width: 48px;
    font-size: 14px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border-color: #6366f1;
    color: #ffffff;
    font-weight: 600;
}

.tp-pagination-wrap .prev-page:hover:not(:disabled),
.tp-pagination-wrap .next-page:hover:not(:disabled) {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    border-color: #4f46e5;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

/* Disabled state for navigation buttons */
.tp-pagination-wrap button:disabled {
    background-color: #f3f4f6;
    border-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

.tp-pagination-wrap button:disabled:hover {
    background-color: #f3f4f6;
    border-color: #e5e7eb;
    color: #9ca3af;
    transform: none;
    box-shadow: none;
}

/* Three dots separator styling */
.tp-pagination-wrap span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 8px 12px;
    font-size: 16px;
    font-weight: 500;
    color: #6b7280;
    background-color: transparent;
    border: none;
    cursor: default;
}

/* Icon styling within buttons */
.tp-pagination-wrap i {
    font-size: 14px;
    line-height: 1;
}

/* Focus states for accessibility */
.tp-pagination-wrap a:focus,
.tp-pagination-wrap button:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Active state animation */
.tp-pagination-wrap a::before,
.tp-pagination-wrap button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.tp-pagination-wrap a:hover::before,
.tp-pagination-wrap button:hover:not(:disabled)::before {
    left: 100%;
}

/* Responsive Design */

/* Large screens (1200px and up) */
@media (min-width: 1200px) {
    .tp-pagination-wrap ul {
        gap: 12px;
    }
    
    .tp-pagination-wrap a,
    .tp-pagination-wrap button {
        min-width: 48px;
        height: 48px;
        font-size: 16px;
        padding: 10px 14px;
    }
    
    .tp-pagination-wrap .prev-page,
    .tp-pagination-wrap .next-page {
        min-width: 52px;
    }
}

/* Medium screens (768px to 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
    .tp-pagination-wrap ul {
        gap: 10px;
    }
    
    .tp-pagination-wrap a,
    .tp-pagination-wrap button {
        min-width: 44px;
        height: 44px;
        font-size: 15px;
        padding: 9px 12px;
    }
    
    .tp-pagination-wrap .prev-page,
    .tp-pagination-wrap .next-page {
        min-width: 48px;
    }
}

/* Small screens (576px to 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .tp-pagination-wrap {
        margin: 30px 0;
        padding: 15px 0;
    }
    
    .tp-pagination-wrap ul {
        gap: 8px;
    }
    
    .tp-pagination-wrap a,
    .tp-pagination-wrap button {
        min-width: 40px;
        height: 40px;
        font-size: 14px;
        padding: 8px 10px;
    }
    
    .tp-pagination-wrap .prev-page,
    .tp-pagination-wrap .next-page {
        min-width: 44px;
    }
    
    /* Hide some page numbers on smaller screens */
    .tp-pagination-wrap li:nth-child(n+8):nth-last-child(n+4) {
        display: none;
    }
}

/* Extra small screens (up to 575px) */
@media (max-width: 575px) {
    .tp-pagination-wrap {
        margin: 25px 0;
        padding: 10px 0;
    }
    
    .tp-pagination-wrap ul {
        gap: 6px;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .tp-pagination-wrap a,
    .tp-pagination-wrap button {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
        padding: 6px 8px;
        border-radius: 6px;
    }
    
    .tp-pagination-wrap .prev-page,
    .tp-pagination-wrap .next-page {
        min-width: 40px;
    }
    
    /* Show only essential pagination elements on mobile */
    .tp-pagination-wrap li:nth-child(n+6):nth-last-child(n+3) {
        display: none;
    }
    
    /* Ensure prev/next buttons are always visible */
    .tp-pagination-wrap li:first-child,
    .tp-pagination-wrap li:last-child {
        display: block !important;
    }
    
    /* Show current page and adjacent pages */
    .tp-pagination-wrap li:has(.active),
    .tp-pagination-wrap li:has(.active) + li,
    .tp-pagination-wrap li:has(.active) - li {
        display: block !important;
    }
}

/* Ultra small screens (up to 320px) */
@media (max-width: 320px) {
    .tp-pagination-wrap ul {
        gap: 4px;
    }
    
    .tp-pagination-wrap a,
    .tp-pagination-wrap button {
        min-width: 32px;
        height: 32px;
        font-size: 12px;
        padding: 4px 6px;
    }
    
    .tp-pagination-wrap .prev-page,
    .tp-pagination-wrap .next-page {
        min-width: 36px;
    }
    
    /* Show minimal pagination on very small screens */
    .tp-pagination-wrap li:nth-child(n+4):nth-last-child(n+2) {
        display: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .tp-pagination-wrap a,
    .tp-pagination-wrap button {
        border-width: 3px;
        font-weight: 600;
    }
    
    .tp-pagination-wrap .active,
    .tp-pagination-wrap button.active {
        background: #000000;
        border-color: #000000;
        color: #ffffff;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .tp-pagination-wrap a,
    .tp-pagination-wrap button {
        transition: none;
    }
    
    .tp-pagination-wrap a::before,
    .tp-pagination-wrap button::before {
        display: none;
    }
    
    .tp-pagination-wrap a:hover,
    .tp-pagination-wrap button:hover:not(:disabled) {
        transform: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .tp-pagination-wrap a,
    .tp-pagination-wrap button {
        background-color: #1f2937;
        border-color: #374151;
        color: #e5e7eb;
    }
    
    .tp-pagination-wrap a:hover,
    .tp-pagination-wrap button:hover:not(:disabled) {
        background-color: #374151;
        border-color: #60a5fa;
        color: #60a5fa;
    }
    
    .tp-pagination-wrap .active,
    .tp-pagination-wrap button.active {
        background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
        border-color: #60a5fa;
    }
    
    .tp-pagination-wrap button:disabled {
        background-color: #111827;
        border-color: #374151;
        color: #6b7280;
    }
    
    .tp-pagination-wrap span {
        color: #9ca3af;
    }
}

/* Print styles */
@media print {
    .tp-pagination-wrap {
        display: none;
    }
}

/* Loading state for AJAX pagination */
.tp-pagination-wrap.loading {
    opacity: 0.6;
    pointer-events: none;
}

.tp-pagination-wrap.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #3b82f6;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Smooth scroll behavior for pagination navigation */
html {
    scroll-behavior: smooth;
}

/* Ensure proper spacing in blog context */
#blog-pagination {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid #e5e7eb;
}

@media (max-width: 767px) {
    #blog-pagination {
        margin-top: 40px;
        padding-top: 30px;
    }
}

/* Performance optimizations */
.tp-pagination-wrap {
    contain: layout style;
    will-change: transform;
}

.tp-pagination-wrap a,
.tp-pagination-wrap button {
    backface-visibility: hidden;
    transform: translateZ(0);
}