/* Beautiful Catalog Pagination Styles */

/* Main pagination container */
#item_pagination {
    margin-top: 40px;
    margin-bottom: 40px;
}

#item_pagination .pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Individual pagination items */
#item_pagination .pagination .page-item {
    margin: 0;
}

#item_pagination .pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    color: #6c757d;
    background-color: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Hover effects */
#item_pagination .pagination .page-link:hover {
    color: #ffffff;
    background: linear-gradient(135deg, #377dff 0%, #2c63d2 100%);
    border-color: #377dff;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(55, 125, 255, 0.4);
    z-index: 2;
}

/* Active page styling */
#item_pagination .pagination .page-item.active .page-link {
    color: #ffffff;
    background: linear-gradient(135deg, #377dff 0%, #2c63d2 100%);
    border-color: #377dff;
    box-shadow: 0 6px 20px rgba(55, 125, 255, 0.4);
    transform: translateY(-2px);
    font-weight: 600;
}

#item_pagination .pagination .page-item.active .page-link:hover {
    transform: translateY(-2px) scale(1.02);
}

/* Disabled state */
#item_pagination .pagination .page-item.disabled .page-link {
    color: #adb5bd;
    background-color: #f8f9fa;
    border-color: #e9ecef;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

#item_pagination .pagination .page-item.disabled .page-link:hover {
    transform: none;
    box-shadow: none;
    background-color: #f8f9fa;
    border-color: #e9ecef;
    color: #adb5bd;
}

/* Previous/Next button styling */
#item_pagination .pagination .page-item:first-child .page-link,
#item_pagination .pagination .page-item:last-child .page-link {
    font-weight: 600;
    padding: 0 16px;
    min-width: 80px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-color: #dee2e6;
}

#item_pagination .pagination .page-item:first-child .page-link:hover,
#item_pagination .pagination .page-item:last-child .page-link:hover {
    background: linear-gradient(135deg, #377dff 0%, #2c63d2 100%);
    border-color: #377dff;
}

/* Ellipsis styling */
#item_pagination .pagination .page-item .page-link[aria-label="..."] {
    border: none;
    background: transparent;
    color: #6c757d;
    cursor: default;
    box-shadow: none;
    font-weight: bold;
    font-size: 16px;
}

#item_pagination .pagination .page-item .page-link[aria-label="..."]:hover {
    background: transparent;
    color: #6c757d;
    transform: none;
    box-shadow: none;
}

/* Responsive design */
@media (max-width: 768px) {
    #item_pagination {
        margin-top: 30px;
        margin-bottom: 30px;
    }
    
    #item_pagination .pagination {
        gap: 4px;
    }
    
    #item_pagination .pagination .page-link {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
        padding: 0 8px;
        border-radius: 8px;
    }
    
    #item_pagination .pagination .page-item:first-child .page-link,
    #item_pagination .pagination .page-item:last-child .page-link {
        min-width: 60px;
        padding: 0 10px;
    }
    
    .pagination-info {
        font-size: 12px;
        margin-bottom: 15px;
    }
    
    .pagination-per-page {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    #item_pagination .pagination .page-link {
        min-width: 32px;
        height: 32px;
        font-size: 12px;
        padding: 0 6px;
        border-radius: 6px;
    }
    
    #item_pagination .pagination .page-item:first-child .page-link,
    #item_pagination .pagination .page-item:last-child .page-link {
        min-width: 50px;
        padding: 0 8px;
        font-size: 11px;
    }
    
    /* Hide middle page numbers on very small screens */
    #item_pagination .pagination .page-item:not(.active):not(:first-child):not(:last-child):not(.disabled) {
        display: none;
    }
    
    /* Show active and adjacent pages */
    #item_pagination .pagination .page-item.active + .page-item,
    #item_pagination .pagination .page-item.active - .page-item {
        display: flex !important;
    }
}

/* Animation for page transitions */
#item_pagination .pagination .page-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s ease;
    z-index: 1;
}

#item_pagination .pagination .page-link:hover::before {
    left: 100%;
}

/* Loading state */
#item_pagination.loading .pagination {
    opacity: 0.6;
    pointer-events: none;
    filter: blur(1px);
}

#item_pagination.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #377dff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pagination info text styling */
.pagination-info {
    text-align: left;
    color: #6c757d;
    font-size: 14px;
    font-weight: 500;
}

.pagination-info strong {
    color: #377dff;
    font-weight: 600;
}

.pagination-per-page {
    text-align: right;
}

.pagination-per-page small {
    color: #adb5bd;
    font-size: 12px;
    font-weight: 500;
}

/* Enhanced focus states for accessibility */
#item_pagination .pagination .page-link:focus {
    outline: 3px solid rgba(55, 125, 255, 0.3);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(55, 125, 255, 0.1);
    z-index: 3;
}

/* Smooth page transition effect */
.catalog-transition {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.catalog-transition.loading {
    opacity: 0.7;
    transform: translateY(10px);
}

/* Pulse animation for active page */
@keyframes pulse {
    0% {
        box-shadow: 0 6px 20px rgba(55, 125, 255, 0.4);
    }
    50% {
        box-shadow: 0 8px 25px rgba(55, 125, 255, 0.6);
    }
    100% {
        box-shadow: 0 6px 20px rgba(55, 125, 255, 0.4);
    }
}

#item_pagination .pagination .page-item.active .page-link {
    animation: pulse 2s ease-in-out infinite;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    #item_pagination .pagination .page-link {
        color: #e9ecef;
        background-color: #343a40;
        border-color: #495057;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    
    #item_pagination .pagination .page-link:hover {
        background: linear-gradient(135deg, #377dff 0%, #2c63d2 100%);
        border-color: #377dff;
    }
    
    #item_pagination .pagination .page-item.disabled .page-link {
        color: #6c757d;
        background-color: #495057;
        border-color: #6c757d;
    }
    
    .pagination-info {
        color: #adb5bd;
    }
    
    .pagination-info strong {
        color: #66b3ff;
    }
}