/**
 * Doomas Pack Builder
 * Responsive production stylesheet
 */

.dm-pack-builder-page,
.dm-pack-builder-page * {
    box-sizing: border-box;
}

.dm-pack-builder-page {
    direction: rtl;
    width: 100%;
    min-height: 100vh;
    padding: 32px 16px 170px;
    background: #f7f8fa;
    color: #1f2937;
}

.dm-pack-builder-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
}

/* =========================================================
   Header
   ========================================================= */

.dm-pack-builder-header {
    margin-bottom: 24px;
    text-align: center;
}

.dm-pack-builder-title {
    margin: 0 0 8px;
    color: #1f2937;
    font-size: 36px;
    font-weight: 900;
    line-height: 1.4;
}

.dm-pack-builder-description {
    margin: 0;
    color: #6b7280;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.9;
}

.dm-pack-builder-rule {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 10px;
    padding: 8px 14px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background: #eff6ff;
    color: #475569;
    font-size: 14px;
    line-height: 1.6;
}

.dm-pack-builder-rule strong {
    color: #0f172a;
    font-weight: 900;
}

/* =========================================================
   Categories
   ========================================================= */

.dm-pack-builder-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 4px 0 14px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.dm-pack-builder-filters::-webkit-scrollbar {
    display: none;
}

.dm-pack-filter {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 9px 21px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #ffffff;
    color: #374151;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.dm-pack-filter:hover {
    border-color: #e53935;
    color: #e53935;
    transform: translateY(-1px);
}

.dm-pack-filter.is-active {
    border-color: #e53935;
    background: #e53935;
    color: #ffffff;
}

/* =========================================================
   Products
   ========================================================= */

.dm-pack-products-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.dm-pack-product-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #e8ebef;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.dm-pack-product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.09);
}

.dm-pack-product-card.is-hidden {
    display: none !important;
}

.dm-pack-product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 12px;
    overflow: hidden;
    background: #ffffff;
}

.dm-pack-product-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.dm-pack-discount-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    padding: 6px 10px;
    border-radius: 999px;
    background: #16a34a;
    color: #ffffff;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.22);
}

.dm-pack-product-info {
    padding: 15px;
}

.dm-pack-product-title {
    display: -webkit-box;
    min-height: 50px;
    margin: 0 0 10px;
    overflow: hidden;
    color: #1f2937;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.65;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.dm-pack-product-pricing {
    min-height: 74px;
    margin-bottom: 12px;
    padding: 9px 10px;
    border-radius: 12px;
    background: #f8fafc;
}

.dm-pack-product-regular-price,
.dm-pack-product-price {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.dm-pack-product-regular-price {
    margin-bottom: 6px;
}

.dm-pack-price-label {
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.dm-pack-product-regular-price del {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 700;
    text-decoration-color: #ef4444;
    text-decoration-thickness: 2px;
    white-space: nowrap;
}

.dm-pack-product-regular-price del .woocommerce-Price-amount,
.dm-pack-product-regular-price del .woocommerce-Price-currencySymbol {
    color: inherit !important;
}

.dm-pack-product-price {
    margin: 0;
    color: #15803d;
}

.dm-pack-product-price strong {
    color: #15803d;
    font-size: 14px;
    font-weight: 900;
    white-space: nowrap;
}

.dm-pack-product-price .woocommerce-Price-amount,
.dm-pack-product-price .woocommerce-Price-currencySymbol {
    color: inherit !important;
}

/* =========================================================
   Quantity
   ========================================================= */

.dm-pack-product-quantity {
    display: grid;
    grid-template-columns: 42px minmax(36px, 1fr) 42px;
    align-items: center;
    min-height: 44px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 13px;
    background: #ffffff;
}

.dm-pack-quantity-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    padding: 0;
    border: 0;
    background: #f1f5f9;
    color: #1e293b;
    font-family: inherit;
    font-size: 23px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.dm-pack-quantity-button:hover {
    background: #e53935;
    color: #ffffff;
}

.dm-pack-quantity-value {
    text-align: center;
    color: #111827;
    font-size: 16px;
    font-weight: 900;
}

/* Selected product */

.dm-pack-product-card.has-selection {
    border-color: #22c55e;
    box-shadow: 0 9px 25px rgba(34, 197, 94, 0.14);
}

.dm-pack-product-card.has-selection::before {
    content: "✓";
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #22c55e;
    color: #ffffff;
    font-size: 16px;
    font-weight: 900;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.28);
}

.dm-pack-product-card.has-selection .dm-pack-product-quantity {
    border-color: #22c55e;
}

.dm-pack-product-card.has-selection .dm-pack-quantity-value {
    color: #15803d;
}

/* =========================================================
   Summary - Desktop
   ========================================================= */

.dm-pack-builder-summary {
    position: fixed;
    right: 50%;
    bottom: 18px;
    z-index: 999;
    display: grid;
    grid-template-columns: minmax(190px, 1fr) minmax(360px, 1.6fr) minmax(210px, auto);
    align-items: center;
    gap: 16px;
    width: calc(100% - 32px);
    max-width: 1120px;
    min-height: 94px;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.17);
    transform: translateX(50%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.dm-pack-summary-progress {
    min-width: 0;
}

.dm-pack-progress-text {
    margin-bottom: 7px;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.6;
}

.dm-pack-progress-track {
    width: 100%;
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.dm-pack-progress-bar {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #22c55e;
    transition: width 0.3s ease;
}

.dm-pack-summary-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 18px;
    min-width: 0;
}

.dm-pack-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.6;
}

.dm-pack-summary-row > span {
    white-space: nowrap;
}

.dm-pack-summary-row strong {
    color: #1e293b;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.dm-pack-summary-discount strong {
    color: #16a34a;
}

.dm-pack-summary-final {
    grid-column: span 2;
    margin-top: 2px;
    padding-top: 5px;
    border-top: 1px dashed #dbe2ea;
}

.dm-pack-summary-final,
.dm-pack-summary-final strong {
    color: #0f172a;
    font-size: 14px;
    font-weight: 900;
}

.dm-pack-remaining-wrapper {
    display: none;
}

.dm-pack-add-to-cart {
    width: 100%;
    min-width: 210px;
    min-height: 52px;
    padding: 12px 20px;
    border: 0;
    border-radius: 14px;
    background: #e53935;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.6;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        transform 0.2s ease,
        opacity 0.2s ease;
}

.dm-pack-add-to-cart:not(:disabled):hover {
    background: #c62828;
    transform: translateY(-1px);
}

.dm-pack-add-to-cart:disabled {
    background: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
    opacity: 1;
}

/* Empty state */

.dm-pack-builder-empty {
    padding: 48px 20px;
    color: #64748b;
    text-align: center;
}

/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 1100px) {

    .dm-pack-products-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dm-pack-builder-summary {
        grid-template-columns: minmax(170px, 0.8fr) minmax(330px, 1.4fr) minmax(190px, auto);
    }
}

/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 767px) {

    .dm-pack-builder-page {
        padding: 14px 10px 245px;
    }

    .dm-pack-builder-container {
        width: 100%;
        max-width: 100%;
    }

    .dm-pack-builder-header {
        margin-bottom: 12px;
    }

    .dm-pack-builder-title {
        margin-bottom: 5px;
        font-size: 29px;
        line-height: 1.4;
    }

    .dm-pack-builder-description {
        padding: 0 5px;
        font-size: 14px;
        line-height: 1.8;
    }

    .dm-pack-builder-rule {
        margin-top: 7px;
        padding: 6px 10px;
        font-size: 12px;
    }

    .dm-pack-builder-filters {
        gap: 7px;
        margin: 0 -10px 12px;
        padding: 8px 10px 12px;
    }

    .dm-pack-filter {
        min-height: 40px;
        padding: 8px 17px;
        font-size: 13px;
    }

    .dm-pack-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .dm-pack-product-card {
        border-radius: 16px;
    }

    .dm-pack-product-card:hover {
        transform: none;
    }

    .dm-pack-product-image {
        height: 160px;
        aspect-ratio: auto;
        padding: 7px;
    }

    .dm-pack-discount-badge {
        top: 7px;
        left: 7px;
        padding: 4px 7px;
        font-size: 9px;
    }

    .dm-pack-product-info {
        padding: 9px;
    }

    .dm-pack-product-title {
        min-height: 40px;
        margin-bottom: 6px;
        font-size: 12px;
        line-height: 1.65;
    }

    .dm-pack-product-pricing {
        min-height: 62px;
        margin-bottom: 7px;
        padding: 7px;
    }

    .dm-pack-product-regular-price,
    .dm-pack-product-price {
        gap: 3px;
    }

    .dm-pack-product-regular-price {
        margin-bottom: 3px;
    }

    .dm-pack-price-label {
        font-size: 8px;
    }

    .dm-pack-product-regular-price del {
        font-size: 9px;
    }

    .dm-pack-product-price strong {
        font-size: 10px;
    }

    .dm-pack-product-quantity {
        grid-template-columns: 36px minmax(25px, 1fr) 36px;
        min-height: 38px;
        border-radius: 10px;
    }

    .dm-pack-quantity-button {
        height: 38px;
        font-size: 20px;
    }

    .dm-pack-quantity-value {
        font-size: 14px;
    }

    .dm-pack-product-card.has-selection::before {
        top: 7px;
        right: 7px;
        width: 23px;
        height: 23px;
        font-size: 13px;
    }

    /*
     * خلاصه در موبایل:
     * بالای منوی ثابت پایین سایت
     */
    .dm-pack-builder-summary {
        position: fixed;
        right: 0;
        bottom: 64px;
        left: 0;
        z-index: 999;
        display: block;
        width: 100%;
        max-width: none;
        min-height: 0;
        margin: 0;
        padding: 9px 11px 10px;
        border: 0;
        border-top: 1px solid #e2e8f0;
        border-radius: 17px 17px 0 0;
        background: rgba(255, 255, 255, 0.99);
        box-shadow: 0 -8px 25px rgba(15, 23, 42, 0.13);
        transform: none;
    }

    .dm-pack-summary-progress {
        margin-bottom: 6px;
    }

    .dm-pack-progress-text {
        margin-bottom: 4px;
        overflow: hidden;
        color: #475569;
        font-size: 10px;
        font-weight: 800;
        line-height: 1.45;
        text-align: center;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .dm-pack-progress-track {
        height: 5px;
    }

    .dm-pack-summary-details {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 3px 12px;
        margin-bottom: 6px;
    }

    .dm-pack-summary-row {
        gap: 4px;
        font-size: 9px;
        line-height: 1.5;
    }

    .dm-pack-summary-row > span,
    .dm-pack-summary-row strong {
        overflow: hidden;
        font-size: 9px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .dm-pack-summary-final {
        grid-column: span 2;
        margin-top: 1px;
        padding-top: 3px;
    }

    .dm-pack-summary-final,
    .dm-pack-summary-final > span,
    .dm-pack-summary-final strong {
        font-size: 11px;
    }

    .dm-pack-remaining-wrapper {
        display: block;
        margin-bottom: 6px;
        padding: 4px 7px;
        border-radius: 7px;
        background: #fff7ed;
        color: #9a3412;
        text-align: center;
    }

    #dm-pack-remaining-text {
        display: block;
        overflow: hidden;
        font-size: 9px;
        font-weight: 800;
        line-height: 1.45;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .dm-pack-add-to-cart {
        width: 100%;
        min-width: 0;
        min-height: 42px;
        padding: 8px 12px;
        border-radius: 11px;
        font-size: 12px;
        line-height: 1.5;
    }
}

/* =========================================================
   Small Mobile
   ========================================================= */

@media (max-width: 390px) {

    .dm-pack-builder-page {
        padding-right: 8px;
        padding-bottom: 238px;
        padding-left: 8px;
    }

    .dm-pack-builder-title {
        font-size: 26px;
    }

    .dm-pack-builder-description {
        font-size: 13px;
    }

    .dm-pack-products-grid {
        gap: 7px;
    }

    .dm-pack-product-image {
        height: 142px;
    }

    .dm-pack-product-info {
        padding: 7px;
    }

    .dm-pack-product-title {
        min-height: 38px;
        font-size: 11px;
    }

    .dm-pack-product-pricing {
        padding: 6px;
    }

    .dm-pack-price-label {
        font-size: 7px;
    }

    .dm-pack-product-regular-price del,
    .dm-pack-product-price strong {
        font-size: 8px;
    }

    .dm-pack-builder-summary {
        padding-right: 9px;
        padding-left: 9px;
    }
}
/* =========================================================
   Pack Builder Product Cards Refinement
   ========================================================= */

.dm-pack-builder-rule {
    flex-direction: column;
    gap: 3px;
}

.dm-pack-builder-rule-payment {
    color: #15803d;
    font-size: 13px;
    font-weight: 800;
}

.dm-pack-builder-rule-payment strong {
    color: #15803d;
}

/* کارت محصول */
.dm-pack-product-card {
    border-radius: 22px;
}

.dm-pack-product-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.dm-pack-product-info {
    display: flex;
    flex-direction: column;
}

.dm-pack-product-title {
    text-align: center;
}

.dm-pack-product-pricing {
    border: 1px solid #edf0f3;
    background: #fbfcfd;
}

/* کنترل تعداد حرفه‌ای‌تر */
.dm-pack-product-quantity {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px;
    border: 1px solid #dbe2e8;
    border-radius: 16px;
    background: #f8fafc;
    overflow: visible;
}

.dm-pack-quantity-button {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #19afe3;
    color: #ffffff;
    font-size: 24px;
    font-weight: 900;
    box-shadow: 0 5px 12px rgba(25, 175, 227, 0.22);
}

.dm-pack-quantity-button:hover {
    background: #1298c8;
    color: #ffffff;
}

.dm-pack-quantity-button:active {
    transform: scale(0.94);
}

.dm-pack-quantity-value {
    flex: 1 1 auto;
    min-width: 34px;
    color: #0f172a;
    font-size: 18px;
    font-weight: 900;
    text-align: center;
}

.dm-pack-product-card.has-selection .dm-pack-product-quantity {
    border-color: #22c55e;
    background: #f0fdf4;
}

.dm-pack-product-card.has-selection .dm-pack-quantity-minus {
    background: #1f2547;
    box-shadow: 0 5px 12px rgba(31, 37, 71, 0.22);
}

.dm-pack-product-card.has-selection .dm-pack-quantity-plus {
    background: #22c55e;
    box-shadow: 0 5px 12px rgba(34, 197, 94, 0.22);
}

/* موبایل */
@media (max-width: 767px) {

    .dm-pack-builder-rule {
        width: 100%;
        padding: 8px 10px;
        line-height: 1.6;
    }

    .dm-pack-builder-rule > span {
        display: block;
    }

    .dm-pack-builder-rule-payment {
        font-size: 11px;
    }

    .dm-pack-product-card {
        border-radius: 18px;
    }

    .dm-pack-product-image {
        height: 150px;
        padding: 10px;
    }

    .dm-pack-product-title {
        min-height: 39px;
        font-size: 12px;
        line-height: 1.55;
    }

    .dm-pack-product-pricing {
        min-height: 60px;
        padding: 7px 8px;
        border-radius: 11px;
    }

    .dm-pack-product-quantity {
        min-height: 46px;
        padding: 4px;
        border-radius: 14px;
    }

    .dm-pack-quantity-button {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
        border-radius: 11px;
        font-size: 23px;
    }

    .dm-pack-quantity-value {
        font-size: 17px;
    }
}

@media (max-width: 390px) {

    .dm-pack-product-image {
        height: 136px;
    }

    .dm-pack-quantity-button {
        flex-basis: 36px;
        width: 36px;
        height: 36px;
    }

    .dm-pack-product-quantity {
        min-height: 42px;
    }
}

/* =========================================================
   Pack Builder Entry - Doomas Packs Category
   ========================================================= */

.dm-pack-builder-entry,
.dm-pack-builder-entry * {
    box-sizing: border-box;
}

.dm-pack-builder-entry {
    width: 100%;
    margin: 0 0 28px;
    padding: 0 15px;
    direction: rtl;
}

.dm-pack-builder-entry-content {
    position: relative;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 38px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    background:
        radial-gradient(
            circle at left center,
            rgba(229, 57, 53, 0.09),
            transparent 38%
        ),
        #ffffff;
    text-align: center;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
}

.dm-pack-builder-entry-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #fff1f2;
    color: #e53935;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.6;
}

.dm-pack-builder-entry h2 {
    margin: 0 0 8px;
    color: #1f2937;
    font-size: 28px;
    font-weight: 900;
    line-height: 1.5;
}

.dm-pack-builder-entry p {
    margin: 0 0 20px;
    color: #64748b;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.9;
}

.dm-pack-builder-entry-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 12px 30px;
    border-radius: 14px;
    background: #e53935;
    color: #ffffff !important;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.6;
    text-decoration: none !important;
    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}

.dm-pack-builder-entry-button:hover,
.dm-pack-builder-entry-button:focus {
    background: #c62828;
    color: #ffffff !important;
    transform: translateY(-2px);
}

@media (max-width: 767px) {

    .dm-pack-builder-entry {
        margin-bottom: 18px;
        padding: 0 10px;
    }

    .dm-pack-builder-entry-content {
        padding: 24px 16px;
        border-radius: 19px;
    }

    .dm-pack-builder-entry h2 {
        font-size: 22px;
    }

    .dm-pack-builder-entry p {
        font-size: 14px;
    }

    .dm-pack-builder-entry-button {
        width: 100%;
    }
}