.kw-container {
    /* متغیرهای رنگی */
    --kw-primary: #A81010;
    --kw-border: #e2e8f0;

}


.kw-container { font-family: inherit; margin: 20px 0; color: #2c3338; }
.kw-main-title { font-size: 20px; font-weight: bold; margin-bottom: 20px; border-bottom: 2px solid var(--kw-primary); padding-bottom: 8px; }
.kw-grid-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kw-card-group {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-right: 4px solid var(--kw-primary);
    border-radius: 8px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.kw-card-group:hover {
    border-color: var(--kw-primary);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.12);
    transform: translateX(-4px);
}

.kw-card-group h3 {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--kw-primary);
}

.kw-card-group p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.6;
}

.kw-breadcrumb { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; background: #f6f7f7; padding: 10px 14px; border-radius: 6px; }
.kw-btn-back { background: #fff; border: 1px solid #ccd0d4; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.kw-btn-back:hover { background: #f0f0f1; }
.kw-bread-title { font-weight: bold; font-size: 14px; }
.kw-counter-badge { margin-right: auto; background: var(--kw-primary); color: #fff; padding: 4px 10px; border-radius: 15px; font-size: 12px; }

.kw-grid-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.kw-btn-cat { background: #fff; border: 1px solid #c3c4c7; padding: 14px 16px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 600; text-align: center; transition: all 0.2s; }
.kw-btn-cat:hover { background: var(--kw-primary); color: #fff; var(--kw-primary); }

.kw-tree-flow { display: flex; flex-direction: column; gap: 15px; margin-bottom: 20px; }
.kw-tree-node { background: #fff; border: 1px solid #dcdcde; border-right: 4px solid var(--kw-primary); border-radius: 6px; padding: 16px; }
.kw-node-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.kw-node-hint { font-size: 12px; color: #8c8f94; }
.kw-node-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.kw-chip {
    background: #f6f7f7;
    border: 1px solid #c3c4c7;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-align: center;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.kw-chip:hover {
    border-color: var(--kw-primary);
    background: #f0f6fc;
}

.kw-chip.active {
    background: var(--kw-primary);
    color: #fff;
    border-color: var(--kw-primary);
    font-weight: bold;
}

.kw-notice-box { text-align: center; padding: 20px; background: #fff3cd; border: 1px solid #ffeeba; border-radius: 8px; margin: 20px 0; }
.kw-btn-show-all { background: var(--kw-primary); color: #fff; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: bold; }

.kw-p-pricing {
    flex: 0 0 25%;
    text-align: right;
}

.kw-tier-summary {
    margin-top: 4px !important;
    font-size: 14px !important;
    color: #232528 !important;
    line-height: 1.4!important;
}


.kw-products-list { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

.kw-p-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #1e293b;
}

.kw-p-price { font-size: 13px; font-weight: bold; color: var(--kw-primary); }

.kw-variation-select { width: 100%; height: 38px; padding: 0 10px 0 26px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; background: #fff; appearance: none; -webkit-appearance: none; cursor: pointer; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; outline: none; }
.kw-select-arrow { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); pointer-events: none; color: #64748b; display: flex; align-items: center; }

.kw-qty-box { display: inline-flex; align-items: center; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; overflow: hidden; height: 38px; width: 95px; }
.kw-qty-btn { width: 30px; height: 100%; border: none; background: #f8fafc; color: #334155; font-size: 16px; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
.kw-qty-btn:hover { background: #e2e8f0; }
.kw-qty-input { width: 35px; height: 100%; border: none; border-left: 1px solid #e2e8f0; border-right: 1px solid #e2e8f0; text-align: center; font-size: 14px; font-weight: bold; padding: 0; outline: none; background: transparent; }

.kw-btn-add { background: var(--kw-primary); color: #fff; border: none; padding: 0 14px; height: 38px; min-width: 115px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: bold; transition: background 0.15s; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; flex-shrink: 0; }
.kw-btn-add:hover { background: #e61818; }

.kw-qty-input::-webkit-outer-spin-button,
.kw-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.kw-qty-input[type=number] { -moz-appearance: textfield; }

.kw-btn-detail { background: #f8fafc; color: #475569; border: 1px solid #cbd5e1; padding: 0 14px; height: 36px; border-radius: 6px; font-size: 12px; text-decoration: none; display: inline-flex; align-items: center; }
.kw-btn-detail:hover { background: #e2e8f0; }
.kw-badge-out { color: #dc2626; font-size: 13px; font-weight: bold; background: #fef2f2; border: 1px solid #fecaca; padding: 0 14px; height: 36px; border-radius: 6px; display: inline-flex; align-items: center; }

.kw-loading-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.8); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 99999; }
.kw-spinner { width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid var(--kw-primary); border-radius: 50%; animation: kwSpin 0.8s linear infinite; margin-bottom: 10px; }
@keyframes kwSpin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.ksn-product-card-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.ksn-variation-row {
    width: 100%;
}

.ksn-variation-select {
    width: 100% !important;
    height: 38px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 13px;
    padding: 4px 8px;
    background-color: #fff;
}

.ksn-cart-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.ksn-cart-row .ksn-qty-group {
    display: flex;
    align-items: center;
}

.ksn-cart-row .ksn-btn-add {
    flex: 1;
    height: 38px;
    white-space: nowrap;
}


.kw-tier-line {
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}
.kw-tier-line.kw-tier-active {
    background-color: #dcfce7;
    color: var(--kw-primary) !important;
    font-weight: bold;
    border-right: 3px solid var(--kw-primary);
}
.kw-live-total {
    margin-top: 5px;
    font-size: 13px;
    color: #b45309;
    font-weight: 600;
}

.kw-sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #ffffff;
    border-top: 2px solid #e2e8f0;
    box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.12);
    padding: 12px 20px;
    font-family: inherit;
    direction: rtl;
}

.kw-sticky-bar-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.kw-sticky-info {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 15px;
    color: #1e293b;
}

.kw-sticky-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kw-sticky-divider {
    width: 1px;
    height: 22px;
    background: #cbd5e1;
}

.kw-sticky-label {
    color: #64748b;
    font-size: 14px;
}

.kw-sticky-price {
    font-weight: 800;
    font-size: 17px;
    color: #0f172a;
}

.kw-sticky-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #b91c1c;
    color: #ffffff !important;
    font-size: 15px;
    font-weight: 700;
    padding: 10px 24px;
    border-radius: 8px;
    text-decoration: none !important;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(185, 28, 28, 0.25);
}

.kw-sticky-btn:hover {
    background: #991b1b;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(185, 28, 28, 0.35);
}

.kw-price-wrapper { display: flex; flex-direction: column; align-items: flex-start; }
.kw-price-top { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }

.kw-price-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    margin-bottom: 4px;
}

.kw-discount-badge {
    background: var(--kw-primary);
    color: #ffffff;
    font-size: 1em;
    font-weight: bold;
    padding: 1px 6px;
    border-radius: 12px;
    line-height: 1.4;
}

.kw-old-price {
    color: #8c8c8c;
    font-size: 0.82em;
    text-decoration: line-through;
}

.kw-current-price {
    color: #1e293b;
    font-weight: bold;
    font-size: 1em;
    text-decoration: none;
}

.kw-out-of-stock-label, .kw-no-price {
    color: #e53935;
    font-weight: bold;
    font-size: 0.9em;
}

.kw-product-row { display: flex; align-items: center; justify-content: space-between; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.03); flex-wrap: wrap; gap: 12px; }

.kw-p-info {
    flex: 1;
    min-width: 0;
}

.kw-p-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
    min-width: 480px; 
}

.kw-variation-wrap {
    width: 170px;
    flex-shrink: 0;
}

.kw-card-group {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding-left: 60px;
}

.kw-card-content {
    flex: 1;
}

.kw-group-arrow {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--kw-primary);
    opacity: 1;
}



@media (min-width: 768px) {
    .ksn-product-card-actions {
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
    }
    .ksn-variation-row {
        width: auto;
        min-width: 160px;
    }
    .ksn-cart-row {
        width: auto;
    }
}

@media (max-width: 767.98px) {
    .kw-sticky-bar {
        padding: 10px 14px;
    }
    .kw-sticky-bar-container {
        flex-direction: column;
        gap: 10px;
    }
    .kw-sticky-info {
        width: 100%;
        justify-content: space-between;
        font-size: 13px;
        gap: 8px;
    }
    .kw-sticky-price {
        font-size: 15px;
    }
    .kw-sticky-btn {
        width: 100%;
        padding: 10px;
        font-size: 14px;
    }

    .kw-grid-groups {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 12px;
    }

    .kw-card-group {
        border-right: 1px solid #e2e8f0;
        border-top: 3px solid #0073aa;
        padding: 16px;
    }

    .kw-card-group:hover {
        transform: translateY(-2px);
    }

    .kw-node-options {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        align-items: stretch; 
    }

    .kw-chip {
        width: 100%;
        min-height: 42px;
        padding: 8px 10px;
        font-size: 12px;
        border-radius: 8px;
        box-sizing: border-box;
    }

    .kw-product-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .kw-p-info, .kw-p-pricing, .kw-p-actions {
        width: 100%;
    }
    .kw-p-actions {
        justify-content: space-between;
    }
}
