/* ================================================================
   WC DPM — Shop / Archive Page Styles
   ================================================================ */

/* ================================================================
   LAYOUT FIXES — The7 theme on WooCommerce shop/archive pages
   shop.css only loads on is_shop / is_product_category / is_product_tag
   so every rule here is safely scoped to those pages.
   ================================================================ */

/* Fix The7 inline margin on shop content div */
#content.content.sunny {
    margin-left: 0 !important;
    padding-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Remove The7 #main padding that shifts content on archive pages */
#main {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* The7's .wf-container-main adds horizontal padding — remove on archive pages */
#main > .wf-wrap,
#main > .wf-wrap > .wf-container-main {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100% !important;
}

/* Content area: no float, full width */
.content-area,
#content {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Hide theme sidebar on shop/archive (no sidebar layout) */
#sidebar,
.sidebar-area,
.wpb-sidebar {
    display: none !important;
}

/* Footer 100% width — .wf-container-main is The7's inner wrapper
   that can add constraining padding inherited from the page layout */
#footer,
#footer .wf-wrap,
#footer .wf-container-main {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
}

/* ── Page wrapper ─────────────────────────────────────────────── */
.wc-dpm-shop-wrap {
    max-width: 1320px;
    margin: 0 auto 60px;
    padding: 0 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Page title ───────────────────────────────────────────────── */
.wc-dpm-shop-header { margin-bottom: 16px; }
.wc-dpm-shop-title {
    font-size: 34px;
    font-weight: 800;
    color: #1a202c;
    margin: 0 0 6px;
    padding: 0;
    letter-spacing: -.4px;
}

/* ── Toolbar ──────────────────────────────────────────────────── */
.wc-dpm-shop-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 10px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #64748b;
}
.wc-dpm-shop-toolbar .woocommerce-result-count { margin: 0; font-size: 14px; color: #64748b; }
.wc-dpm-shop-toolbar .woocommerce-ordering { margin: 0; }
.wc-dpm-shop-toolbar select {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 14px;
    background: #fff;
    color: #374151;
}

/* ================================================================
   PRODUCT GRID — 4 columns
   The7 theme sets its own widths on .wf-cell (its product item class),
   so we override those here to make the CSS grid work correctly.
   ================================================================ */
.wc-dpm-shop-wrap ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 22px !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
}
/* The7's .wf-cell items have inline/CSS percentage widths — reset them */
.wc-dpm-shop-wrap ul.products .wf-cell,
.wc-dpm-shop-wrap ul.products li {
    width: auto !important;
    max-width: none !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ================================================================
   PRODUCT CARD  (.wc-dpm-card class added via content-product.php)
   ================================================================ */
.wc-dpm-shop-wrap li.wc-dpm-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    text-align: left;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.25s ease, transform 0.2s ease, border-color 0.2s ease;
    float: none;
    width: auto;
}

.wc-dpm-shop-wrap li.wc-dpm-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 16px 40px rgba(59, 130, 246, 0.18);
    transform: translateY(-5px);
}

/* ── Card link wrapper ────────────────────────────────────────── */
.wc-dpm-card__link {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-decoration: none;
    color: inherit;
}
.wc-dpm-card__link:hover {
    text-decoration: none;
    color: inherit;
}

/* ── Product image ────────────────────────────────────────────── */
.wc-dpm-card__image {
    overflow: hidden;
    line-height: 0;
}
.wc-dpm-card__img {
    width: 100%;
    height: 210px;
    object-fit: cover;
    display: block;
    border-radius: 12px 12px 0 0;
    transition: transform 0.35s ease;
    margin: 0;
}
.wc-dpm-card:hover .wc-dpm-card__img {
    transform: scale(1.05);
}

/* ── Sale badge ───────────────────────────────────────────────── */
.wc-dpm-card__badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
}

/* ── Card body ────────────────────────────────────────────────── */
.wc-dpm-card__body {
    padding: 14px 16px 8px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* ── Product title ────────────────────────────────────────────── */
.wc-dpm-card__title {
    font-size: 17px;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Star rating + review count ──────────────────────────────── */
.wc-dpm-card__rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.wc-dpm-card__rating .star-rating {
    font-size: 16px;
    color: #f59e0b;
    display: inline-block;
    overflow: visible;
    width: auto;
    margin: 0;
}
.wc-dpm-card__rating .star-rating span {
    color: #f59e0b;
}
.wc-dpm-card__rating .star-rating::before {
    color: #e2e8f0;
}
.wc-dpm-card__review-count {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

/* ── Price ────────────────────────────────────────────────────── */
.wc-dpm-card__price {
    margin-top: auto;
    padding-top: 8px;
}
.wc-dpm-card__price .price {
    font-size: 26px;
    font-weight: 900;
    color: #1e293b;
    line-height: 1.2;
    display: block;
}
.wc-dpm-card__price .price del {
    display: block;
    font-size: 14px;
    font-weight: 400;
    color: #94a3b8;
    text-decoration: line-through;
    margin-bottom: 2px;
}
.wc-dpm-card__price .price ins {
    text-decoration: none;
    color: #1e293b;
    font-weight: 900;
}

/* ── Add to Cart button ───────────────────────────────────────── */
.wc-dpm-card__footer {
    padding: 0 16px 16px;
}
.wc-dpm-card__footer .button,
.wc-dpm-card__footer a.button {
    display: block;
    padding: 11px 16px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    letter-spacing: 0.2px;
    transition: background 0.15s ease;
    width: 100%;
    box-sizing: border-box;
}
.wc-dpm-card__footer .button:hover,
.wc-dpm-card__footer a.button:hover {
    background: #1d4ed8;
    color: #ffffff;
    text-decoration: none;
}
.wc-dpm-card__footer .button.added  { background: #059669; }
.wc-dpm-card__footer .button.loading { opacity: 0.75; }

/* ── Pagination ───────────────────────────────────────────────── */
.wc-dpm-shop-wrap .woocommerce-pagination {
    margin-top: 36px;
    text-align: center;
}
.wc-dpm-shop-wrap .woocommerce-pagination ul {
    display: inline-flex;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.wc-dpm-shop-wrap .woocommerce-pagination ul li a,
.wc-dpm-shop-wrap .woocommerce-pagination ul li span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.wc-dpm-shop-wrap .woocommerce-pagination ul li a:hover { background: #eff6ff; border-color: #2563eb; color: #2563eb; }
.wc-dpm-shop-wrap .woocommerce-pagination ul li span.current { background: #2563eb; border-color: #2563eb; color: #fff; }

/* ── Notices ──────────────────────────────────────────────────── */
.wc-dpm-shop-wrap .woocommerce-info,
.wc-dpm-shop-wrap .woocommerce-message,
.wc-dpm-shop-wrap .woocommerce-error {
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .wc-dpm-shop-wrap ul.products { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
    .wc-dpm-shop-wrap ul.products { grid-template-columns: repeat(2, 1fr); }
    .wc-dpm-shop-wrap { padding: 0 16px; }
}
@media (max-width: 520px) {
    .wc-dpm-shop-wrap ul.products { grid-template-columns: 1fr; }
}

/* ================================================================
   THE7 THEME FALLBACK
   The7 uses its own content-product.php with different class names.
   These rules style The7's markup when our template override is
   blocked by the theme.
   HTML: article > figure.woocom-project > figcaption.woocom-list-content
   ================================================================ */
.wc-dpm-shop-wrap article.product figure.woocom-project {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.25s ease, transform 0.2s ease, border-color 0.2s ease;
    margin: 0;
    height: 100%;
}
.wc-dpm-shop-wrap article.product figure.woocom-project:hover {
    border-color: #3b82f6;
    box-shadow: 0 16px 40px rgba(59, 130, 246, 0.18);
    transform: translateY(-5px);
}

/* Image area — overflow on the <a> link (not on the wrapper) so
   The7's cart popup notification can appear outside the image bounds */
.wc-dpm-shop-wrap article.product figure.woocom-project .woo-buttons-on-img {
    position: relative;
    flex-shrink: 0;
    line-height: 0;
    border-radius: 12px 12px 0 0;
}
.wc-dpm-shop-wrap article.product figure.woocom-project .woo-buttons-on-img > a.alignnone {
    display: block;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
    line-height: 0;
}
.wc-dpm-shop-wrap article.product figure.woocom-project .woo-buttons-on-img a img:first-child {
    width: 100%;
    height: 210px;
    object-fit: cover;
    display: block;
    border-radius: 12px 12px 0 0;
    transition: transform 0.35s ease;
    margin: 0;
}
.wc-dpm-shop-wrap article.product figure.woocom-project:hover .woo-buttons-on-img a img:first-child {
    transform: scale(1.05);
}
/* Hide The7's "show on hover" second image */
.wc-dpm-shop-wrap article.product .show-on-hover.back-image {
    display: none !important;
}

/* ── Add to Cart button ─────────────────────────────────────────
   Keep it hidden by default, slide up on card hover.
   This preserves The7's AJAX click/notification behavior while
   looking clean (no permanent bar blocking the image).
   ────────────────────────────────────────────────────────────── */
.wc-dpm-shop-wrap article.product .woo-buttons {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2563eb;
    text-align: center;
    line-height: normal;
    border-radius: 0;
    padding: 0;
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.2s ease, transform 0.2s ease;
    /* Reset any The7 positioning */
    box-shadow: none;
    border: none;
    margin: 0;
}
.wc-dpm-shop-wrap article.product figure.woocom-project:hover .woo-buttons {
    opacity: 1;
    transform: translateY(0);
}
.wc-dpm-shop-wrap article.product .woo-buttons:hover {
    background: #1d4ed8;
}
.wc-dpm-shop-wrap article.product .woo-buttons a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 16px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    width: 100%;
    box-sizing: border-box;
    background: transparent;
    border: none;
    border-radius: 0;
    margin: 0;
}
.wc-dpm-shop-wrap article.product .woo-buttons a:hover {
    color: #ffffff;
    text-decoration: none;
}
/* Show the text, keep the icon */
.wc-dpm-shop-wrap article.product .woo-buttons .filter-popup {
    display: inline;
    color: #ffffff;
}
.wc-dpm-shop-wrap article.product .woo-buttons .popup-icon {
    display: inline-block;
    color: #ffffff;
    font-size: 15px;
}

/* ── Figcaption — CSS named grid areas ──────────────────────────
   ┌─────────────────────────────────┐
   │  price  (full width)            │
   │  title  (full width)            │
   │  [stars]   [review count]       │
   └─────────────────────────────────┘
   ────────────────────────────────────────────────────────────── */
.wc-dpm-shop-wrap article.product figcaption.woocom-list-content {
    padding: 16px 16px 18px;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas:
        "price   price"
        "title   title"
        "spacer  spacer"
        "stars   reviews";
    flex: 1;
    text-align: left;
}

/* Price */
.wc-dpm-shop-wrap article.product figcaption.woocom-list-content .price {
    grid-area: price;
    font-size: 28px;
    font-weight: 900;
    color: #1e293b;
    line-height: 1.1;
    margin: 0 0 6px;
    display: block;
}
.wc-dpm-shop-wrap article.product figcaption.woocom-list-content .price del {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: #94a3b8;
    text-decoration: line-through;
    margin-bottom: 2px;
}
.wc-dpm-shop-wrap article.product figcaption.woocom-list-content .price ins {
    text-decoration: none;
    color: #1e293b;
    font-weight: 900;
}

/* Title */
.wc-dpm-shop-wrap article.product figcaption.woocom-list-content h4.entry-title {
    grid-area: title;
    font-size: 15px;
    font-weight: 600;
    color: #475569;
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.wc-dpm-shop-wrap article.product figcaption.woocom-list-content h4.entry-title a {
    color: #475569;
    text-decoration: none;
}
.wc-dpm-shop-wrap article.product figcaption.woocom-list-content h4.entry-title a:hover {
    color: #2563eb;
}

/* Stars — bottom-left, let WooCommerce render its own star font.
   IMPORTANT: use margin-top NOT padding-top here.
   padding-top shifts ::before (empty stars backdrop) down but the inner
   span (filled stars) is position:absolute from top:0, so they'd mis-align. */
.wc-dpm-shop-wrap article.product figcaption.woocom-list-content .star-rating {
    grid-area: stars;
    display: block;
    width: 5.4em;
    min-width: 5.4em;
    font-size: 16px;
    overflow: hidden;
    position: relative;
    height: 1em;
    line-height: 1;
    color: #f59e0b;          /* empty stars: amber */
    margin-top: 12px;
    align-self: center;
}
.wc-dpm-shop-wrap article.product figcaption.woocom-list-content .star-rating::before {
    color: #f59e0b;
}
.wc-dpm-shop-wrap article.product figcaption.woocom-list-content .star-rating span {
    color: #d97706;          /* filled stars: dark amber */
}
.wc-dpm-shop-wrap article.product figcaption.woocom-list-content .star-rating span::before {
    color: #d97706;
}

/* Review count — same row as stars, vertically centred */
.wc-dpm-shop-wrap article.product figcaption.woocom-list-content .wc-dpm-review-count {
    grid-area: reviews;
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
    display: flex;
    align-items: center;
    padding-left: 8px;
    margin-top: 12px;
    align-self: center;
}

