/* ==========================================================================
   Latest Products - Modern Design
   ========================================================================== */

:root {
    --lp-primary: #6c5ce7;
    --lp-primary-hover: #5a4fd9;
    --lp-secondary: #64748b;
    --lp-success: #10b981;
    --lp-text: #1e293b;
    --lp-text-light: #64748b;
    --lp-border: #e2e8f0;
    --lp-bg: #ffffff;
    --lp-bg-hover: #f8fafc;
    --lp-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --lp-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --lp-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --lp-radius: 12px;
    --lp-radius-sm: 8px;
}

/* Wrapper */
.lp-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: inherit;
}

/* Inherit fonts from WordPress theme */
.lp-wrapper * {
    font-family: inherit;
}

/* ==========================================================================
   Table View
   ========================================================================== */

.lp-table-wrapper {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
    margin-bottom: 40px;
}

/* Buttons for table */
.lp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--lp-radius-sm);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lp-btn-primary {
    background: var(--lp-primary);
    color: white;
    border: none;
    white-space: nowrap;
}

.lp-btn-primary:hover {
    background: var(--lp-primary-hover);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(108, 92, 231, 0.3);
}

.lp-btn-sm {
    padding: 10px 20px;
    font-size: 14px;
    min-width: 100px;
}

.lp-category-tag {
    display: inline-block;
    padding: 4px 12px;
    background: #f1f5f9;
    color: var(--lp-text);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.lp-category-tag:hover {
    background: #e2e8f0;
    color: var(--lp-primary);
}

.lp-date {
    font-size: 12px;
    color: var(--lp-text-light);
    font-weight: 500;
}

.lp-products-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: none;
}

.lp-products-table thead {
    background: linear-gradient(135deg, var(--lp-primary) 0%, #7c6ee8 100%);
}

.lp-products-table th {
    padding: 16px 20px;
    text-align: left;
    color: white;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lp-products-table tbody tr {
    border: none;
    border-bottom: none;
    transition: background 0.2s ease;
}

.lp-products-table tbody tr:last-child {
    border-bottom: none;
}

.lp-products-table tbody tr:hover {
    background: rgba(108, 92, 231, 0.03);
}

.lp-products-table td {
    padding: 16px 20px;
    vertical-align: middle;
}

.lp-products-table td:first-child {
    width: 200px;
    min-width: 200px;
}

.lp-table-thumbnail {
    width: 200px;
    height: 118px;
    border-radius: 8px;
    overflow: visible;
    background: transparent;
    position: relative;
    flex-shrink: 0;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lp-table-thumbnail img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    background: transparent;
    padding: 0;
}


/* Ensure images are visible even when lazy loading */
.lp-table-thumbnail img.lazy-load {
    min-height: 118px;
    background: #f8f9fa;
}

.lp-product-link {
    color: var(--lp-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: color 0.2s ease;
}

.lp-product-link:hover {
    color: var(--lp-primary);
}

.lp-author {
    color: var(--lp-text-light);
    font-size: 14px;
}

.lp-table-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.lp-table-actions .lp-btn {
    min-width: 100px;
    text-align: center;
}

/* ==========================================================================
   Pagination - Page Numbers Only
   ========================================================================== */

.lp-pagination-container {
    display: flex !important;
    justify-content: center;
    align-items: center;
    margin-top: 50px !important;
    margin-bottom: 60px !important;
    padding: 30px 20px !important;
    position: relative;
    min-height: 100px;
    background: rgba(108, 92, 231, 0.05) !important;
    border-radius: var(--lp-radius);
    border: 2px solid rgba(108, 92, 231, 0.2) !important;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.1);
    scroll-margin-bottom: 100px;
    visibility: visible !important;
    opacity: 1 !important;
}

.lp-pagination-numbers {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.lp-page-btn,
.lp-page-number {
    visibility: visible !important;
    opacity: 1 !important;
    display: inline-flex !important;
}

/* Page Numbers */
.lp-pagination-numbers {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.lp-page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #ffffff;
    border: 2px solid var(--lp-primary);
    border-radius: var(--lp-radius-sm);
    color: var(--lp-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(108, 92, 231, 0.2);
    font-weight: 600;
}

.lp-page-btn:hover:not(:disabled) {
    background: var(--lp-primary);
    color: white;
    border-color: var(--lp-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(108, 92, 231, 0.3);
}

.lp-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #d1d5db;
    color: #9ca3af;
    background: #f9fafb;
    box-shadow: none;
}

.lp-page-numbers {
    display: flex;
    gap: 6px;
}

.lp-page-number {
    min-width: 48px;
    height: 48px;
    padding: 0 16px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: var(--lp-radius-sm);
    color: var(--lp-text);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lp-page-number:hover {
    background: rgba(108, 92, 231, 0.1);
    border-color: var(--lp-primary);
    color: var(--lp-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(108, 92, 231, 0.2);
}

.lp-page-number.active {
    background: var(--lp-primary);
    color: white;
    border-color: var(--lp-primary);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.4);
    font-weight: 700;
}

/* Spinner */
.lp-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.lp-spinner-ring {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(108, 92, 231, 0.1);
    border-top-color: var(--lp-primary);
    border-radius: 50%;
    animation: lp-spin 0.8s linear infinite;
}

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

.lp-loading .lp-spinner {
    display: block;
}

.lp-loading .lp-load-more,
.lp-loading .lp-pagination-numbers {
    opacity: 0.5;
    pointer-events: none;
}

/* No Products */
.lp-no-products {
    text-align: center;
    padding: 60px 20px;
    color: var(--lp-text-light);
    font-size: 16px;
}

/* ==========================================================================
   Additional Visibility Improvements
   ========================================================================== */

/* Ensure pagination is always visible */
.lp-pagination-container {
    z-index: 10;
    visibility: visible !important;
    opacity: 1 !important;
    display: flex !important;
}

/* Add scroll padding to ensure pagination is visible when scrolled to */
html {
    scroll-padding-bottom: 100px;
}

.lp-page-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
    flex-shrink: 0;
}

/* Better contrast for buttons */
.lp-page-btn:not(:disabled),
.lp-page-number {
    background: #ffffff;
    border: 2px solid var(--lp-primary);
}

.lp-page-btn:not(:disabled):hover,
.lp-page-number:hover {
    background: var(--lp-primary);
    color: #ffffff;
}

/* Ensure table is readable on all screens */
.lp-products-table {
    font-size: 14px;
}

.lp-products-table th {
    white-space: nowrap;
}

.lp-products-table td {
    word-wrap: break-word;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 1024px) {
    .lp-wrapper {
        padding: 15px;
    }
    
    .lp-products-table th,
    .lp-products-table td {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .lp-products-table td:first-child {
        width: 180px;
        min-width: 180px;
    }
    
    .lp-table-thumbnail {
        width: 180px;
        height: 106px;
    }
}

@media (max-width: 768px) {
    .lp-wrapper {
        padding: 12px;
    }
    
    /* Table responsive */
    .lp-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .lp-products-table {
        min-width: 700px;
    }
    
    .lp-products-table th,
    .lp-products-table td {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .lp-products-table td:first-child {
        width: 150px;
        min-width: 150px;
    }
    
    .lp-table-thumbnail {
        width: 150px;
        height: 88px;
    }
    
    .lp-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .lp-pagination-container {
        padding: 15px 10px;
        margin-top: 30px;
    }
    
    .lp-page-btn,
    .lp-page-number {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 14px;
        padding: 0 10px;
    }
}

@media (max-width: 640px) {
    .lp-wrapper {
        padding: 10px;
    }
    
    .lp-table-wrapper {
        border-radius: 8px;
        margin-bottom: 30px;
    }
    
    /* Stack table for mobile */
    .lp-products-table thead {
        display: none;
    }
    
    .lp-products-table,
    .lp-products-table tbody,
    .lp-products-table tr,
    .lp-products-table td {
        display: block;
        width: 100%;
    }
    
    .lp-products-table tr {
        margin-bottom: 20px;
        border: none;
        border-radius: 0;
        overflow: visible;
        background: transparent;
        box-shadow: none;
    }
    
    .lp-products-table td {
        position: relative;
        padding: 12px 16px 12px 140px;
        min-height: 50px;
        display: flex;
        align-items: center;
        border: none;
    }
    
    .lp-products-table td:last-child {
        border: none;
    }
    
    .lp-products-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 16px;
        font-weight: 600;
        color: var(--lp-text);
        font-size: 13px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .lp-products-table td:first-child {
        padding: 16px;
        justify-content: center;
        border: none;
    }
    
    .lp-products-table td:first-child:before {
        display: none;
    }
    
    .lp-table-thumbnail {
        width: 100%;
        max-width: 280px;
        height: 165px;
        margin: 0 auto;
    }
    
    .lp-table-thumbnail img {
        object-fit: contain;
    }
    
    .lp-pagination-numbers {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .lp-page-btn,
    .lp-page-number {
        width: 42px;
        height: 42px;
        min-width: 42px;
        font-size: 14px;
        padding: 0 10px;
    }
    
    .lp-pagination-container {
        padding: 25px 15px !important;
        margin-top: 40px !important;
        margin-bottom: 50px !important;
        min-height: 90px;
    }
    
    .lp-btn {
        padding: 10px 18px;
        font-size: 13px;
        width: 100%;
        justify-content: center;
    }
    
    .lp-table-actions {
        flex-direction: column;
        width: 100%;
    }
}

/* ==========================================================================
   Lazy Loading
   ========================================================================== */

img.lazy-load {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img.lazy-load.loaded,
img:not(.lazy-load) {
    opacity: 1;
}


/* ==========================================================================
   Dark Mode Support (Optional)
   ========================================================================== */

/* Additional responsive breakpoints */
@media (max-width: 480px) {
    .lp-wrapper {
        padding: 8px;
    }
    
    .lp-page-btn,
    .lp-page-number {
        width: 42px;
        height: 42px;
        min-width: 42px;
        font-size: 14px;
    }
    
    .lp-pagination-container {
        padding: 25px 15px !important;
        margin-top: 40px !important;
        margin-bottom: 50px !important;
        min-height: 90px;
    }
    
    .lp-table-thumbnail {
        max-width: 280px;
        height: 165px;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --lp-text: #f1f5f9;
        --lp-text-light: #94a3b8;
        --lp-border: #334155;
        --lp-bg: #1e293b;
        --lp-bg-hover: #334155;
    }
}
