/* PWD Product Grid - Main Styles */
/* Version: 1.0.0 */

/* ===== Reset & Base ===== */
.pwd-pg-wrapper {
    position: relative;
    width: 100%;
}

.pwd-pg-wrapper *,
.pwd-pg-wrapper *::before,
.pwd-pg-wrapper *::after {
    box-sizing: border-box;
}

/* ===== Toolbar ===== */
.pwd-pg-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 10px 0;
}

.pwd-pg-toolbar-left,
.pwd-pg-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pwd-pg-results-count {
    font-size: 14px;
    color: #6b7280;
}

.pwd-pg-sort-select {
    padding: 8px 32px 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: #fff;
    font-size: 14px;
    cursor: pointer;
    appearance: auto;
    min-width: 160px;
}

/* Column Switcher */
.pwd-pg-column-switcher {
    display: flex;
    gap: 4px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
}

.pwd-pg-col-btn {
    padding: 6px 12px;
    border: none;
    background-color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
}

.pwd-pg-col-btn:hover,
.pwd-pg-col-btn.active {
    background-color: #3b82f6;
    color: #fff;
}

/* View Switcher */
.pwd-pg-view-switcher {
    display: flex;
    gap: 4px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
}

.pwd-pg-view-btn {
    padding: 6px 10px;
    border: none;
    background-color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: #6b7280;
    transition: all 0.2s ease;
}

.pwd-pg-view-btn:hover,
.pwd-pg-view-btn.active {
    background-color: #3b82f6;
    color: #fff;
}

/* ===== Grid Layout ===== */
.pwd-pg-products-grid {
    display: grid;
    gap: 20px;
}

.pwd-pg-cols-2 { grid-template-columns: repeat(2, 1fr); }
.pwd-pg-cols-3 { grid-template-columns: repeat(3, 1fr); }
.pwd-pg-cols-4 { grid-template-columns: repeat(4, 1fr); }
.pwd-pg-cols-5 { grid-template-columns: repeat(5, 1fr); }
.pwd-pg-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* Equal Height */
.pwd-pg-equal-height .pwd-pg-product-card {
    display: flex;
}

.pwd-pg-equal-height .pwd-pg-card-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pwd-pg-equal-height .pwd-pg-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pwd-pg-equal-height .pwd-pg-card-actions {
    margin-top: auto;
}

/* WC hooks (Enquire Now etc.) always at the bottom */
.pwd-pg-card-wc-hooks {
    margin-top: auto;
}

/* List View */
.pwd-pg-view-list {
    grid-template-columns: 1fr !important;
}

.pwd-pg-view-list .pwd-pg-card-inner {
    display: flex;
    flex-direction: row;
}

.pwd-pg-view-list .pwd-pg-card-image {
    width: 260px;
    min-width: 260px;
    height: auto;
    min-height: 200px;
}

.pwd-pg-view-list .pwd-pg-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ===== Product Card ===== */
.pwd-pg-product-card {
    position: relative;
}

.pwd-pg-card-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
    transition: all 0.3s ease;
}

.pwd-pg-card-inner:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Image */
.pwd-pg-card-image {
    position: relative;
    overflow: hidden;
    height: 280px;
    background: transparent;
}

.pwd-pg-card-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    transition: background 0.3s ease;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
}

.pwd-pg-card-inner:hover .pwd-pg-card-image::after {
    opacity: 1;
}

.pwd-pg-image-link {
    display: block;
    width: 100%;
    height: 100%;
}

.pwd-pg-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.pwd-pg-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.5s ease;
}

.pwd-pg-secondary-img {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
}

/* Image Cart (hidden by default, used by Preset 2) */
.pwd-pg-image-cart {
    display: none;
}

/* Badges */
.pwd-pg-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pwd-pg-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pwd-pg-badge-sale {
    background-color: #ef4444;
    color: #fff;
}

.pwd-pg-badge-stock {
    background-color: #6b7280;
    color: #fff;
}

.pwd-pg-badge-featured {
    background-color: #f59e0b;
    color: #fff;
}

/* Hover Actions */
.pwd-pg-hover-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 6px;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
}

.pwd-pg-card-inner:hover .pwd-pg-hover-actions {
    opacity: 1;
    transform: translateX(0);
}

.pwd-pg-action-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background-color: #fff;
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: all 0.2s ease;
}

.pwd-pg-action-btn:hover {
    background-color: #3b82f6;
    color: #fff;
    transform: scale(1.1);
}

.pwd-pg-action-btn.pwd-pg-active {
    background-color: #ef4444;
    color: #fff;
}

.pwd-pg-action-btn svg {
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none;
    stroke: currentColor;
    fill: none;
    flex-shrink: 0;
    visibility: visible !important;
    opacity: 1 !important;
}

.pwd-pg-action-btn.pwd-pg-active svg {
    stroke: currentColor;
}

/* Wishlist active state - filled heart */
.pwd-pg-wishlist-btn.pwd-pg-active svg {
    fill: currentColor;
}

/* Content */
.pwd-pg-card-content {
    padding: 16px;
}

.pwd-pg-card-category {
    margin-bottom: 4px;
}

.pwd-pg-card-category a {
    font-size: 12px;
    color: #6b7280;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.2s ease;
}

.pwd-pg-card-category a:hover {
    color: #3b82f6;
}

.pwd-pg-card-title {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}

.pwd-pg-card-title a {
    color: #1f2937;
    text-decoration: none;
    transition: color 0.2s ease;
}

.pwd-pg-card-title a:hover {
    color: #3b82f6;
}

.pwd-pg-card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.pwd-pg-card-rating .star-rating {
    font-size: 13px;
}

.pwd-pg-rating-count {
    font-size: 12px;
    color: #9ca3af;
}

.pwd-pg-card-price {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 12px;
}

.pwd-pg-card-price del {
    color: #9ca3af;
    font-weight: 400;
    font-size: 14px;
    margin-right: 6px;
}

.pwd-pg-card-price ins {
    text-decoration: none;
    color: #ef4444;
}

.pwd-pg-card-excerpt {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 12px;
}

/* Actions */
.pwd-pg-card-actions {
    margin-top: auto;
}

/* Buttons Base */
.pwd-pg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.4;
}

.pwd-pg-btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.pwd-pg-add-to-cart,
.pwd-pg-select-options {
    width: 100%;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    text-align: center;
}

.pwd-pg-add-to-cart {
    background-color: #3b82f6;
    color: #fff;
}

.pwd-pg-add-to-cart:hover {
    background-color: #2563eb;
}

.pwd-pg-add-to-cart.pwd-pg-added {
    background-color: #10b981;
}

.pwd-pg-select-options {
    background: transparent;
    color: #3b82f6;
    border: 1px solid #3b82f6;
}

.pwd-pg-select-options:hover {
    background-color: #3b82f6;
    color: #fff;
}

.pwd-pg-btn-outline {
    background: transparent;
    border: 1px solid currentColor;
}

/* Out of Stock Card */
.pwd-pg-out-of-stock .pwd-pg-card-image::after {
    background: rgba(255, 255, 255, 0.5);
}

/* ===== No Products ===== */
.pwd-pg-no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 16px;
}

/* ===== Pagination ===== */
.pwd-pg-pagination {
    margin-top: 30px;
    text-align: center;
}

.pwd-pg-pagination ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 0;
    margin: 0;
}

.pwd-pg-pagination li {
    display: inline-block;
}

.pwd-pg-pagination a,
.pwd-pg-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #374151;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pwd-pg-pagination a:hover {
    background: #f3f4f6;
    border-color: #3b82f6;
    color: #3b82f6;
}

.pwd-pg-pagination .current {
    background-color: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
    cursor: default;
}

/* Load More */
.pwd-pg-load-more {
    text-align: center;
    margin-top: 30px;
}

.pwd-pg-load-more-btn {
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 600;
    background-color: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwd-pg-load-more-btn:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
}

.pwd-pg-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Infinite Scroll Trigger */
.pwd-pg-infinite-trigger {
    text-align: center;
    padding: 30px;
}

/* Spinner */
.pwd-pg-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: pwd-pg-spin 0.7s linear infinite;
    margin: 0 auto;
}

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

/* ===== Skeleton Loading ===== */
.pwd-pg-skeleton-card {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.pwd-pg-skeleton-image {
    height: 280px;
    background: #e5e7eb;
}

.pwd-pg-skeleton-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pwd-pg-skeleton-line {
    height: 14px;
    border-radius: 4px;
    background: #e5e7eb;
}

.pwd-pg-skeleton-pulse {
    animation: pwd-pg-pulse 1.5s ease-in-out infinite;
}

@keyframes pwd-pg-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== Toast Notifications ===== */
.pwd-pg-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 12px 20px;
    background-color: #1f2937;
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    z-index: 99999;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    max-width: 320px;
}

.pwd-pg-toast.pwd-pg-toast-show {
    opacity: 1;
    transform: translateY(0);
}

.pwd-pg-toast.pwd-pg-toast-success {
    background-color: #10b981;
}

.pwd-pg-toast.pwd-pg-toast-error {
    background-color: #ef4444;
}

/* ===== Filter Position: Top Alignment ===== */
.pwd-pg-filter-top.pwd-pg-filter-align-right .pwd-pg-filter-bar-inner {
    justify-content: flex-end;
}

.pwd-pg-filter-top.pwd-pg-filter-align-center .pwd-pg-filter-bar-inner {
    justify-content: center;
}

/* ===== Filter Position: Sidebar Layout ===== */
.pwd-pg-layout-sidebar {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    align-items: start;
}

.pwd-pg-layout-sidebar.pwd-pg-sidebar-right {
    grid-template-columns: 1fr 260px;
}

.pwd-pg-layout-sidebar.pwd-pg-sidebar-right .pwd-pg-sidebar-filter {
    order: 2;
}

.pwd-pg-layout-sidebar.pwd-pg-sidebar-right .pwd-pg-main-content {
    order: 1;
}

.pwd-pg-sidebar-filter {
    position: sticky;
    top: 80px;
}

.pwd-pg-sidebar-filter .pwd-pg-filter-bar {
    border-radius: 10px;
}

.pwd-pg-sidebar-filter .pwd-pg-filter-bar-inner {
    flex-direction: column;
}

.pwd-pg-sidebar-filter .pwd-pg-filter-group {
    width: 100%;
}

.pwd-pg-sidebar-filter .pwd-pg-filter-select {
    width: 100%;
}

.pwd-pg-main-content {
    min-width: 0;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .pwd-pg-layout-sidebar {
        grid-template-columns: 1fr;
    }
    .pwd-pg-layout-sidebar.pwd-pg-sidebar-right .pwd-pg-sidebar-filter,
    .pwd-pg-layout-sidebar.pwd-pg-sidebar-right .pwd-pg-main-content {
        order: unset;
    }
    .pwd-pg-sidebar-filter {
        position: static;
    }
    .pwd-pg-cols-6 { grid-template-columns: repeat(4, 1fr); }
    .pwd-pg-cols-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .pwd-pg-cols-6,
    .pwd-pg-cols-5,
    .pwd-pg-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .pwd-pg-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .pwd-pg-toolbar-right {
        justify-content: space-between;
    }

    .pwd-pg-view-list .pwd-pg-card-inner {
        flex-direction: column;
    }

    .pwd-pg-view-list .pwd-pg-card-image {
        width: 100%;
        min-width: 100%;
        height: 200px;
    }

    .pwd-pg-column-switcher {
        display: none;
    }
}

@media (max-width: 480px) {
    .pwd-pg-cols-3,
    .pwd-pg-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .pwd-pg-card-image {
        height: 180px;
    }

    .pwd-pg-card-content {
        padding: 10px;
    }

    .pwd-pg-card-title {
        font-size: 13px;
    }
}
