/**
 * DreamPigeon Products — Product Grid Styles
 *
 * All classes prefixed with .dp- to avoid theme conflicts (xtocky).
 *
 * @package DreamPigeon_Products
 * @version 1.0.0
 */

/* ==========================================================================
   Reset / Base
   ========================================================================== */

.dp-products-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333;
    line-height: 1.5;
    box-sizing: border-box;
}

.dp-products-wrapper *,
.dp-products-wrapper *::before,
.dp-products-wrapper *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   Toolbar (Sort + Filters)
   ========================================================================== */

.dp-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
}

.dp-toolbar-left {
    flex: 0 0 auto;
}

.dp-toolbar-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.dp-product-count {
    font-size: 14px;
    color: #666;
}

/* Filters */
.dp-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.dp-filter-prime {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    user-select: none;
}

.dp-filter-prime-checkbox {
    width: 16px;
    height: 16px;
    accent-color: #00457c;
    cursor: pointer;
}

.dp-filter-price-range {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #555;
}

.dp-filter-label {
    font-weight: 500;
}

.dp-filter-price-min,
.dp-filter-price-max {
    width: 70px;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s;
}

.dp-filter-price-min:focus,
.dp-filter-price-max:focus {
    outline: none;
    border-color: #FF9900;
}

.dp-filter-sep {
    color: #999;
}

.dp-filter-apply {
    padding: 5px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f8f8f8;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.dp-filter-apply:hover {
    background: #eee;
    border-color: #999;
}

/* Sort */
.dp-sort {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dp-sort-label {
    font-size: 13px;
    color: #555;
    font-weight: 500;
    white-space: nowrap;
}

.dp-sort-select {
    padding: 5px 28px 5px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M6 8L0 0h12z' fill='%23666'/%3E%3C/svg%3E") no-repeat right 8px center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.dp-sort-select:focus {
    outline: none;
    border-color: #FF9900;
}

/* ==========================================================================
   Product Grid Layout
   ========================================================================== */

.dp-product-grid {
    display: grid;
    gap: 20px;
    transition: opacity 0.3s ease;
}

.dp-product-grid.dp-grid--loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Column configurations */
.dp-grid--col-4 {
    grid-template-columns: repeat(4, 1fr);
}

.dp-grid--col-3 {
    grid-template-columns: repeat(3, 1fr);
}

.dp-grid--col-2 {
    grid-template-columns: repeat(2, 1fr);
}

.dp-grid--col-1 {
    grid-template-columns: 1fr;
}

/* ==========================================================================
   Product Card
   ========================================================================== */

.dp-product-card {
    position: relative;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.dp-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.dp-product-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.dp-product-link:hover,
.dp-product-link:focus,
.dp-product-link:visited {
    text-decoration: none;
    color: inherit;
}

/* Badges */
.dp-badge-wrap {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.dp-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dp-badge--best-seller {
    background: #f5a623;
    color: #fff;
}

.dp-badge--amazon-choice {
    background: #232f3e;
    color: #fff;
}

.dp-badge--prime {
    background: #00457c;
    color: #fff;
}

/* Product Image */
.dp-product-image-wrap {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 aspect ratio */
    background: #fafafa;
    overflow: hidden;
}

.dp-product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 16px;
    transition: transform 0.3s ease;
}

.dp-product-card:hover .dp-product-image {
    transform: scale(1.05);
}

.dp-product-image--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    padding: 0;
}

.dp-product-image--placeholder svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Product Info */
.dp-product-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 14px 16px 16px;
}

.dp-product-title {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: #111;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Star Rating */
.dp-product-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.dp-stars {
    --percent: calc(var(--rating) / 5 * 100%);
    display: inline-block;
    font-size: 15px;
    line-height: 1;
    letter-spacing: 1px;
}

.dp-stars::before {
    content: "\2605\2605\2605\2605\2605";
    background: linear-gradient(
        90deg,
        #f5a623 var(--percent),
        #d4d4d4 var(--percent)
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dp-rating-count {
    font-size: 12px;
    color: #888;
}

/* Price */
.dp-product-price {
    margin-bottom: 12px;
    margin-top: auto;
}

.dp-price {
    font-size: 18px;
    font-weight: 700;
    color: #111;
}

.dp-price--check {
    font-size: 14px;
    font-weight: 500;
    color: #666;
}

.dp-price-original {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
}

.dp-price-savings {
    font-size: 12px;
    color: #b12704;
    font-weight: 500;
}

/* CTA Button */
.dp-cta {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: #FF9900;
    color: #111;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    border-radius: 6px;
    transition: background 0.2s ease, transform 0.15s ease;
}

.dp-product-card:hover .dp-cta {
    background: #e68a00;
}

/* ==========================================================================
   Load More
   ========================================================================== */

.dp-load-more-wrap {
    text-align: center;
    margin: 32px 0 16px;
}

.dp-load-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 48px;
    border: 2px solid #333;
    border-radius: 25px;
    background: transparent;
    color: #333;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    line-height: 1;
    vertical-align: middle;
    transition: background 0.2s ease, color 0.2s ease;
}

.dp-load-more:hover {
    background: #333;
    color: #fff;
}

.dp-load-more:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dp-load-more--loading {
    position: relative;
    color: transparent;
}

.dp-load-more--loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #333;
    border-top-color: transparent;
    border-radius: 50%;
    animation: dp-spin 0.6s linear infinite;
}

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

/* ==========================================================================
   Empty State
   ========================================================================== */

.dp-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 16px;
}

/* ==========================================================================
   Error State
   ========================================================================== */

.dp-error {
    text-align: center;
    padding: 40px 20px;
    color: #c00;
    font-size: 15px;
    background: #fef0f0;
    border: 1px solid #fdd;
    border-radius: 8px;
}

/* ==========================================================================
   Affiliate Disclosure
   ========================================================================== */

.dp-affiliate-disclosure {
    margin-top: 24px;
    padding: 12px 16px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 6px;
}

.dp-affiliate-disclosure p {
    margin: 0;
    font-size: 12px;
    color: #888;
    line-height: 1.5;
}

/* ==========================================================================
   Carousel
   ========================================================================== */

.dp-carousel-wrapper {
    position: relative;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
}

.dp-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 20px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* hide scrollbar Firefox */
    padding: 10px 0;
}

.dp-carousel::-webkit-scrollbar {
    display: none; /* hide scrollbar Chrome */
}

.dp-carousel .dp-product-card {
    flex: 0 0 calc(25% - 15px); /* 4 per view */
    scroll-snap-align: start;
}

/* Arrow buttons */
.dp-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    cursor: pointer;
    z-index: 2;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s;
}

.dp-carousel-btn:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dp-carousel-btn--prev {
    left: -15px;
}

.dp-carousel-btn--next {
    right: -15px;
}

/* Carousel responsive — Tablet */
@media (max-width: 1024px) {
    .dp-carousel .dp-product-card {
        flex: 0 0 calc(33.33% - 14px);
    }
}

/* Carousel responsive — Small tablet / large phone */
@media (max-width: 768px) {
    .dp-carousel .dp-product-card {
        flex: 0 0 calc(50% - 10px);
    }

    .dp-carousel-btn--prev {
        left: 2px;
    }

    .dp-carousel-btn--next {
        right: 2px;
    }
}

/* Carousel responsive — Mobile */
@media (max-width: 480px) {
    .dp-carousel .dp-product-card {
        flex: 0 0 85%;
    }

    /* Override the grid mobile horizontal layout for carousel cards */
    .dp-carousel .dp-product-card {
        display: block;
    }

    .dp-carousel .dp-product-link {
        flex-direction: column;
    }

    .dp-carousel .dp-product-image-wrap {
        flex: none;
        width: 100%;
        padding-top: 100%;
        height: auto;
    }
}

/* ==========================================================================
   Animations
   ========================================================================== */

.dp-product-card {
    animation: dp-fadeIn 0.4s ease forwards;
    opacity: 0;
}

@keyframes dp-fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered animation for initial load (up to 24 items) */
.dp-product-card:nth-child(1)  { animation-delay: 0.02s; }
.dp-product-card:nth-child(2)  { animation-delay: 0.04s; }
.dp-product-card:nth-child(3)  { animation-delay: 0.06s; }
.dp-product-card:nth-child(4)  { animation-delay: 0.08s; }
.dp-product-card:nth-child(5)  { animation-delay: 0.10s; }
.dp-product-card:nth-child(6)  { animation-delay: 0.12s; }
.dp-product-card:nth-child(7)  { animation-delay: 0.14s; }
.dp-product-card:nth-child(8)  { animation-delay: 0.16s; }
.dp-product-card:nth-child(9)  { animation-delay: 0.18s; }
.dp-product-card:nth-child(10) { animation-delay: 0.20s; }
.dp-product-card:nth-child(11) { animation-delay: 0.22s; }
.dp-product-card:nth-child(12) { animation-delay: 0.24s; }
.dp-product-card:nth-child(13) { animation-delay: 0.26s; }
.dp-product-card:nth-child(14) { animation-delay: 0.28s; }
.dp-product-card:nth-child(15) { animation-delay: 0.30s; }
.dp-product-card:nth-child(16) { animation-delay: 0.32s; }
.dp-product-card:nth-child(17) { animation-delay: 0.34s; }
.dp-product-card:nth-child(18) { animation-delay: 0.36s; }
.dp-product-card:nth-child(19) { animation-delay: 0.38s; }
.dp-product-card:nth-child(20) { animation-delay: 0.40s; }
.dp-product-card:nth-child(21) { animation-delay: 0.42s; }
.dp-product-card:nth-child(22) { animation-delay: 0.44s; }
.dp-product-card:nth-child(23) { animation-delay: 0.46s; }
.dp-product-card:nth-child(24) { animation-delay: 0.48s; }

/* Cards loaded via AJAX get instant animation */
.dp-product-card.dp-card--loaded {
    animation-delay: 0s;
}

/* Filter transition */
.dp-product-card.dp-card--hidden {
    display: none;
}

/* ==========================================================================
   Responsive — Tablet (768–1024px)
   ========================================================================== */

@media (max-width: 1024px) {
    .dp-grid--col-4 {
        grid-template-columns: repeat(3, 1fr);
    }

    .dp-grid--col-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .dp-product-image {
        padding: 12px;
    }
}

/* ==========================================================================
   Responsive — Small Tablet / Large Phone (480–768px)
   ========================================================================== */

@media (max-width: 768px) {
    .dp-products-wrapper {
        padding: 0 12px;
    }

    .dp-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .dp-toolbar-right {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .dp-filters {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .dp-filter-price-range {
        width: 100%;
    }

    .dp-sort {
        width: 100%;
    }

    .dp-sort-select {
        flex: 1;
    }

    .dp-grid--col-4,
    .dp-grid--col-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .dp-grid--col-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .dp-product-grid {
        gap: 12px;
    }

    .dp-product-info {
        padding: 10px 12px 14px;
    }

    .dp-product-title {
        font-size: 13px;
    }

    .dp-price {
        font-size: 16px;
    }

    .dp-cta {
        font-size: 13px;
        padding: 8px 12px;
    }
}

/* ==========================================================================
   Responsive — Small Mobile (<480px)
   ========================================================================== */

@media (max-width: 480px) {
    .dp-grid--col-4,
    .dp-grid--col-3,
    .dp-grid--col-2 {
        grid-template-columns: 1fr;
    }

    .dp-product-card {
        display: flex;
    }

    .dp-product-link {
        flex-direction: row;
    }

    .dp-product-image-wrap {
        flex: 0 0 120px;
        width: 120px;
        padding-top: 0;
        height: 120px;
    }

    .dp-product-image {
        padding: 8px;
    }

    .dp-product-info {
        flex: 1;
        padding: 10px 12px;
    }

    .dp-badge-wrap {
        position: static;
        margin-bottom: 4px;
    }

    .dp-badge {
        font-size: 10px;
        padding: 2px 6px;
    }

    .dp-product-title {
        font-size: 13px;
        -webkit-line-clamp: 2;
        margin-bottom: 4px;
    }

    .dp-stars {
        font-size: 13px;
    }

    .dp-product-rating {
        margin-bottom: 4px;
    }

    .dp-product-price {
        margin-bottom: 8px;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.dp-product-link:focus-visible {
    outline: 2px solid #FF9900;
    outline-offset: 2px;
    border-radius: 10px;
}

.dp-sort-select:focus-visible,
.dp-filter-price-min:focus-visible,
.dp-filter-price-max:focus-visible,
.dp-filter-apply:focus-visible,
.dp-load-more:focus-visible {
    outline: 2px solid #FF9900;
    outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .dp-product-card {
        animation: none;
        opacity: 1;
    }

    .dp-product-card:hover {
        transform: none;
    }

    .dp-product-card:hover .dp-product-image {
        transform: none;
    }

    .dp-load-more--loading::after {
        animation-duration: 1.5s;
    }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
    .dp-toolbar,
    .dp-load-more-wrap,
    .dp-affiliate-disclosure {
        display: none;
    }

    .dp-product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .dp-product-card:hover {
        transform: none;
        box-shadow: none;
    }
}

/* Fix: prevent horizontal overflow from product components */
.dp-products-wrapper,
.dp-carousel-wrapper {
    max-width: 100%;
    overflow: hidden;
}


/* Prevent carousel from causing horizontal page overflow */
html, body {
    overflow-x: hidden;
}

/* ==========================================================================
   Footer Redesign — DreamPigeon
   ========================================================================== */

footer.footer {
    background: #1a1a2e !important;
    color: #c4c4c4 !important;
    border-top: 3px solid #d4a853 !important;
}

footer.footer .footer-top {
    padding: 50px 0 30px !important;
}

footer.footer .widget-title {
    color: #fff !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px !important;
    margin-bottom: 20px !important;
    padding-bottom: 12px !important;
    border-bottom: 2px solid #d4a853 !important;
    display: inline-block !important;
}

footer.footer .widget_text .textwidget,
footer.footer .widget_text .textwidget p {
    color: #a0a0b0 !important;
    font-size: 14px !important;
    line-height: 1.7 !important;
}

footer.footer .widget_nav_menu ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

footer.footer .widget_nav_menu ul li {
    margin-bottom: 10px !important;
}

footer.footer .widget_nav_menu ul li a {
    color: #a0a0b0 !important;
    text-decoration: none !important;
    font-size: 14px !important;
    transition: color 0.2s ease, padding-left 0.2s ease !important;
    display: inline-block !important;
}

footer.footer .widget_nav_menu ul li a:hover {
    color: #d4a853 !important;
    padding-left: 5px !important;
}

footer.footer .footer-bottom {
    background: #12121f !important;
    padding: 20px 0 !important;
    border-top: 1px solid #2a2a3e !important;
}

footer.footer .footer-bottom .payment-info,
footer.footer .footer-bottom .footer-left {
    color: #666680 !important;
    font-size: 13px !important;
}

footer.footer .footer-bottom .footer-menu li a {
    color: #888 !important;
}

footer.footer .footer-bottom .footer-menu li a:hover {
    color: #d4a853 !important;
}

footer.footer .footer-top img {
    opacity: 0.9;
    max-width: 200px !important;
}

footer.footer .scroll-top span {
    background: #d4a853 !important;
    color: #1a1a2e !important;
}


/* Hide empty footer section that creates gap */
footer.footer .footer-inner-top {
    display: none !important;
}

/* Override theme inline styles for footer colors */
footer.footer .footer-top,
.footer-top {
    background-color: #1a1a2e !important;
}

.footer-bottom,
footer.footer .footer-bottom {
    background-color: #12121f !important;
}

.footer-bottom .payment-info,
.footer-bottom .payment-info h5,
.footer-bottom .footer-menu li + li:before,
.footer .footer-bottom a:not(.scroll-top) {
    color: #666680 !important;
}

footer.footer .widget .widget-title {
    color: #fff !important;
}

/* Hide wpautoterms footer bar */
.wpautoterms-footer,
div[class*="wpautoterms"] {
    display: none !important;
}


.site-logo a:hover {
    color: #d4a853 !important;
}

}

.header-layout-4 .header-main .header {
    margin: 0 !important;
    padding: 0 !important;
}

.header-layout-4 .header-main .header .header-search-container {
    display: flex !important;
    align-items: center !important;
}
