/* Product Grid AJAX Styles */

/* Container */
.pga-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 0;
}

/* Tabs Navigation */
.pga-tabs {
    display: flex;
    flex-wrap: nowrap;
    /*gap: 8px;*/
    margin-bottom: 30px;
    background: #f5f5f5;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
    /*padding: 8px;*/
    border-radius: 12px;
    align-items: stretch;
}

.pga-tabs::-webkit-scrollbar {
    height: 6px;
}

.pga-tabs::-webkit-scrollbar-track {
    background: #f8fafc;
}

.pga-tabs::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.pga-tabs::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.pga-category-tab {
    margin-right:0px !important;
    background: transparent;
    border: none;
    padding: 16px 20px;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-decoration: none;
    outline: none;
    position: relative;
    flex-shrink: 0;
    min-width: 90px;
    min-height: 80px;
    /*border-radius: 10px;*/
    box-sizing: border-box;
}

.pga-category-tab:hover {
    background: rgba(255, 255, 255, 0.5);
    color: #333;
}

.pga-category-tab.active {
    background: #dc2626 !important;
    color: #ffffff !important;
    z-index: 1;
    height: auto;
    min-height: 80px;
}

.pga-category-tab.active:hover {
    background: #dc2626 !important;
    color: #ffffff !important;
}

/* Tab icons */
.pga-tab-icon {
    width: 28px;
    height: 28px;
    object-fit: cover;
    transition: all 0.3s ease;
    border-radius: 4px;
    margin-bottom: 6px;
}

.pga-category-tab.has-icon {
    padding: 16px 20px;
    flex-direction: column;
    text-align: center;
    min-height: 80px;
    height: 100%;
     margin-bottom: 0px;
}

.pga-category-tab.has-icon > img{
    width: 28px;
    height: 28px;
    margin-bottom: 6px;
}

.pga-tab-text {
    font-weight: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    max-width: 70px;
}

/* Default icon for tabs without image */
.pga-tab-default-icon {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: currentColor;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-bottom: 6px;
}

.pga-category-tab.active .pga-tab-default-icon {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

.pga-category-tab.active .pga-tab-icon {
    filter: brightness(1.1);
}

.pga-category-tab:hover .pga-tab-default-icon {
    transform: scale(1.05);
}

/* Smooth scrolling behavior for tabs */
.pga-tabs {
    scroll-behavior: smooth;
    position: relative;
}

/* Responsive styles for tabs */
@media (max-width: 768px) {
    .pga-tabs {
        /*padding: 6px;*/
        display:flex;
        flex-wrap: wrap;
        /*gap: 4px;*/
    }
    
    .pga-category-tab {
        min-width: 75px;
        min-height: 70px;
        padding: 12px 14px;
    }
    
    .pga-tab-text {
        font-size: 11px;
        max-width: 55px;
    }
    
    .pga-tab-icon,
    .pga-tab-default-icon {
        width: 22px;
        height: 22px;
    }
    
    .pga-category-tab.has-icon {
        min-height: 70px;
        padding: 12px 14px;
    }
}

@media (max-width: 480px) {
    .pga-tabs {
        /*padding: 4px;*/
        gap: 3px;
    }
    
    .pga-category-tab {
        min-width: 65px;
        min-height: 60px;
        padding: 10px 12px;
    }
    
    .pga-tab-text {
        font-size: 10px;
        max-width: 50px;
    }
    
    .pga-tab-icon,
    .pga-tab-default-icon {
        width: 20px;
        height: 20px;
    }
    
    .pga-tab-default-icon {
        font-size: 9px;
    }
    
    .pga-category-tab.has-icon {
        min-height: 60px;
        padding: 10px 12px;
    }
}

/* Grid Container */
.pga-grid-wrap {
    position: relative;
    min-height: 200px;
    padding: 0 10px;
}

.pga-grid {
    display: grid;
    gap: 25px;
    margin-bottom: 30px;
    transition: opacity 0.3s ease;
    width: 100%;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* Grid columns responsive - improved system */
.pga-grid.cols-1 { 
    grid-template-columns: 1fr;
    max-width: 600px;
}

.pga-grid.cols-2 { 
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    max-width: 800px;
}

.pga-grid.cols-3 { 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.pga-grid.cols-4 { 
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.pga-grid.cols-5 { 
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.pga-grid.cols-6 { 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Loading state */
.pga-grid.pga-loading-state {
    opacity: 0.6;
    pointer-events: none;
}

/* Grid items container */
.pga-grid-items {
    display: contents;
}

/* Ensure equal heights for all items */
.pga-grid {
    align-items: stretch;
}

/* Auto-fit improvements */
@supports (display: grid) {
    .pga-grid.cols-3 {
        grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    }
    
    .pga-grid.cols-4 {
        grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
    }
    
    .pga-grid.cols-5 {
        grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    }
    
    .pga-grid.cols-6 {
        grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    }
}

/* Grid Items */
.pga-item {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
    height: 100%;
    min-height: 250px;
    width: 100%;
}

.pga-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(145deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
}

/*.pga-item:hover {*/
/*    transform: translateY(-10px) scale(1.02);*/
/*    box-shadow: 0 25px 60px rgba(234, 80, 80, 0.3);*/
/*}*/

.pga-item:hover::before {
    opacity: 1;
}

.pga-thumb {
    display: block;
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.pga-thumb::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pga-thumb:hover::after {
    opacity: 1;
}

.pga-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: brightness(1.02) saturate(1.1);
}

.pga-thumb:hover img {
    transform: scale(1.08) rotate(1deg);
    filter: brightness(1.05) saturate(1.2);
}

.pga-no-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-style: italic;
    font-weight: 500;
}

.pga-title {
    padding: 10px;
    flex-grow: 1;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1;
}

.pga-title a {
    text-decoration: none;
    color: #2d3748;
    font-size: 16px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
}

.pga-title a:hover {
    color: #e53538;
    transform: translateY(-1px);
}

/* Messages */
.pga-loading,
.pga-empty,
.pga-error {
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    margin: 20px 0;
}

.pga-loading {
    position: relative;
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
    display: flex; /* Make it a flex container */
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
    height: 100%; /* Take full height of parent */
    flex-direction: column; /* Stack content vertically */
}

.pga-loading:before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #3b82f6;
    border-right-color: transparent;
    animation: pga-spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

.pga-empty {
    background: #fefce8;
    color: #a16207;
    font-style: italic;
    border: 1px solid #fde047;
}

.pga-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

/* Pagination */
.pga-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 30px 0;
}

.pga-page-btn {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 8px 12px;
    min-width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pga-page-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #1f2937;
}

.pga-page-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

.pga-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.pga-page-btn:disabled:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.pga-dots {
    color: #9ca3af;
    padding: 0 8px;
    font-weight: bold;
}

/* Animations */
@keyframes pga-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pga-fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(30px) scale(0.95); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

@keyframes pga-slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pga-pulse {
    0%, 100% { 
        transform: scale(1); 
        box-shadow: 0 8px 32px rgba(102, 126, 234, 0.6);
    }
    50% { 
        transform: scale(1.02); 
        box-shadow: 0 12px 40px rgba(102, 126, 234, 0.8);
    }
}

.pga-grid-items {
    animation: pga-fadeIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pga-item {
    animation: pga-slideInUp 0.5s ease-out both;
}

.pga-item:nth-child(2) { animation-delay: 0.1s; }
.pga-item:nth-child(3) { animation-delay: 0.2s; }
.pga-item:nth-child(4) { animation-delay: 0.3s; }
.pga-item:nth-child(5) { animation-delay: 0.4s; }
.pga-item:nth-child(6) { animation-delay: 0.5s; }



/* Utility classes for better responsive control */
.pga-grid-responsive {
    --gap: 25px;
    --min-item-width: 250px;
    display: grid;
    gap: var(--gap);
    grid-template-columns: repeat(auto-fit, minmax(min(var(--min-item-width), 100%), 1fr));
}

/* Container queries support (if available) */
@container (max-width: 600px) {
    .pga-grid {
        --min-item-width: 200px;
        --gap: 15px;
    }
}

/* Fallback for older browsers */
@supports not (container-type: inline-size) {
    @media (max-width: 600px) {
        .pga-grid {
            gap: 15px;
        }
    }
}

/* Perfect square aspect ratio for product images */
.pga-thumb {
    aspect-ratio: 6 / 3;
}

@media (max-width: 575px) {
    .pga-thumb {
        aspect-ratio: 6 / 3;
    }
}

/* Large Desktop - 1200px+ */
@media (min-width: 1200px) {
    .pga-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
    .pga-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
    .pga-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
    .pga-grid.cols-6 { grid-template-columns: repeat(6, 1fr); }
}

/* Desktop - 992px to 1199px */
@media (min-width: 992px) and (max-width: 1199px) {
    .pga-grid.cols-4,
    .pga-grid.cols-5,
    .pga-grid.cols-6 { grid-template-columns: repeat(3, 1fr); }
    .pga-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* Tablet - 768px to 991px */
@media (min-width: 768px) and (max-width: 991px) {
    .pga-container {
        padding: 15px;
        margin: 10px;
    }
    
    .pga-grid-wrap {
        padding: 0 15px;
    }
    
    .pga-grid {
        gap: 20px;
    }
    
    .pga-tab-icon,
    .pga-tab-default-icon {
        /*width: 110px;*/
        /*height: 110px;*/
        font-size: 40px;
    }
    
    .pga-category-tab.has-icon {
        /*min-height: 160px;*/
        /*min-width: 140px;*/
    }
    
    .pga-grid.cols-1 { grid-template-columns: 1fr; }
    .pga-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
    .pga-grid.cols-3,
    .pga-grid.cols-4,
    .pga-grid.cols-5,
    .pga-grid.cols-6 { grid-template-columns: repeat(2, 1fr); }
    
    .pga-item {
        min-height: 300px;
    }
}

/* Mobile Large - 576px to 767px */
@media (min-width: 576px) and (max-width: 767px) {
    .pga-container {
        padding: 15px;
        margin: 8px;
    }
    
    .pga-grid-wrap {
        padding: 0 10px;
    }
    
    .pga-tabs {
        gap: 1px;
        margin-bottom: 25px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .pga-tabs::-webkit-scrollbar {
        height: 4px;
    }
    
    .pga-category-tab {
        padding: 10px 16px;
        font-size: 13px;
        min-height: 40px;
    }
    
    .pga-category-tab.has-icon {
        padding: 12px 15px;
        flex-direction: column;
        /*min-height: 140px;*/
        /*min-width: 120px;*/
        text-align: center;
    }
    
    .pga-tab-icon,
    .pga-tab-default-icon {
        width: 100px;
        height: 100px;
        font-size: 36px;
    }
    
    .pga-tab-text {
        font-size: 11px;
        margin-top: 6px;
    }
    
    .pga-grid {
        gap: 18px;
        margin-bottom: 25px;
    }
    
    .pga-grid.cols-1 { grid-template-columns: 1fr; }
    .pga-grid.cols-2,
    .pga-grid.cols-3,
    .pga-grid.cols-4,
    .pga-grid.cols-5,
    .pga-grid.cols-6 { 
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pga-item {
        min-height: 280px;
    }
    
    .pga-title {
        padding: 16px;
    }
    
    .pga-title a {
        font-size: 15px;
    }
    
    .pga-pagination {
        gap: 6px;
        margin: 25px 0;
    }
    
    .pga-page-btn {
        padding: 8px 10px;
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
}

/* Mobile Small - up to 575px */
@media (max-width: 575px) {
    .pga-container {
        padding: 12px;
        margin: 5px;
    }
    
    .pga-grid-wrap {
        padding: 0 5px;
    }
    
    .pga-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 0;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 0;
        background: transparent;
        overflow: visible;
    }
    
    .pga-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .pga-category-tab {
        flex: 1 1 25%;
        min-width: 0;
        padding: 8px 10px;
        font-size: 12px;
        min-height: 80px;
    }
    
    .pga-category-tab.has-icon {
        flex: 1 1 25%;
        padding: 8px 10px;
        min-height: 80px;
        text-align: center;
    }
    
    .pga-tab-icon,
    .pga-tab-default-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    .pga-tab-text {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 10px;
        margin-top: 4px;
    }
    
    .pga-grid {
        gap: 15px;
    }
    
    /* Single column for very small screens */
    .pga-grid.cols-1,
    .pga-grid.cols-2,
    .pga-grid.cols-3,
    .pga-grid.cols-4,
    .pga-grid.cols-5,
    .pga-grid.cols-6 {
        grid-template-columns: 1fr;
    }
    
    .pga-item {
        /*min-height: 350px;*/
        max-width: 100%;
    }
    
    .pga-thumb {
        aspect-ratio: 6/3;
    }
    
    .pga-title {
        padding: 16px;
        flex-grow: 1;
    }
    
    .pga-title a {
        font-size: 15px;
        line-height: 1.4;
    }
    
    .pga-pagination {
        gap: 4px;
        flex-wrap: wrap;
    }
    
    .pga-page-btn {
        padding: 6px 8px;
        min-width: 32px;
        height: 32px;
        font-size: 12px;
    }
}

/* Extra small phones - 320px to 374px */
@media (max-width: 374px) {
    .pga-container {
        margin: 2px;
        padding: 8px;
    }
    
    .pga-tabs {
        gap: 1px;
        margin-bottom: 20px;
    }
    
    .pga-category-tab {
        min-width: 60px;
        max-width: 90px;
        padding: 6px 8px;
        font-size: 11px;
        min-height: 32px;
    }
    
    .pga-category-tab.has-icon {
        padding: 6px 8px;
        flex-direction: column;
        /*min-height: 80px;*/
        /*min-width: 60px;*/
        text-align: center;
    }
    
    .pga-tab-icon,
    .pga-tab-default-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .pga-tab-text {
        font-size: 9px;
        margin-top: 3px;
    }
    
    .pga-grid {
        gap: 12px;
    }
    
    .pga-item {
        min-height: 320px;
    }
    
    .pga-title {
        padding: 12px;
    }
    
    .pga-title a {
        font-size: 14px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .pga-item {
        background: #2c2c2c;
        color: #e0e0e0;
    }
    
    .pga-title a {
        color: #e0e0e0;
    }
    
    .pga-title a:hover {
        color: #4a9eff;
    }
    
    .pga-category-tab {
        background: transparent;
        color: #e0e0e0;
    }
    
    .pga-category-tab:hover {
        background: transparent;
        color: #4a9eff;
    }
    
    .pga-category-tab.active {
        background: transparent;
        color: #4a9eff;
    }
    
    .pga-page-btn {
        background: #2c2c2c;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .pga-page-btn:hover {
        background: #3c3c3c;
        border-color: #4a9eff;
        color: #4a9eff;
    }
    
    .pga-page-btn.active {
        background: #4a9eff;
        border-color: #4a9eff;
        color: #ffffff;
    }
}

/* Print styles */
@media print {
    .pga-tabs,
    .pga-pagination {
        display: none;
    }
    
    .pga-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
    
    .pga-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
